@wcstack/state 2.5.0 → 2.5.1
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/auto.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.esm.js +86 -94
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -492,15 +492,13 @@ interface IStateAddress {
|
|
|
492
492
|
readonly listIndex: IListIndex | null;
|
|
493
493
|
readonly parentAddress: IStateAddress | null;
|
|
494
494
|
}
|
|
495
|
-
interface
|
|
495
|
+
interface ITreePath {
|
|
496
496
|
readonly stateElement: IStateElement;
|
|
497
497
|
readonly pathInfo: IPathInfo;
|
|
498
|
-
readonly parentAbsolutePathInfo: IAbsolutePathInfo | null;
|
|
499
498
|
}
|
|
500
499
|
interface IAbsoluteStateAddress {
|
|
501
|
-
readonly absolutePathInfo:
|
|
500
|
+
readonly absolutePathInfo: ITreePath;
|
|
502
501
|
readonly listIndex: IListIndex | null;
|
|
503
|
-
readonly parentAbsoluteAddress: IAbsoluteStateAddress | null;
|
|
504
502
|
}
|
|
505
503
|
|
|
506
504
|
/**
|
package/dist/index.esm.js
CHANGED
|
@@ -289,10 +289,10 @@ function raiseError(message) {
|
|
|
289
289
|
throw new Error(`[@wcstack/state] ${message}`);
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
const _cache$
|
|
292
|
+
const _cache$3 = new Map();
|
|
293
293
|
let id = 0;
|
|
294
294
|
function getPathInfo(path) {
|
|
295
|
-
let pathInfo = _cache$
|
|
295
|
+
let pathInfo = _cache$3.get(path);
|
|
296
296
|
if (typeof pathInfo !== "undefined") {
|
|
297
297
|
return pathInfo;
|
|
298
298
|
}
|
|
@@ -307,7 +307,7 @@ function getPathInfo(path) {
|
|
|
307
307
|
`argument of $getAll / $setAll — and only when the state declares a $recursion anchor.`);
|
|
308
308
|
}
|
|
309
309
|
pathInfo = Object.freeze(new PathInfo(path));
|
|
310
|
-
_cache$
|
|
310
|
+
_cache$3.set(path, pathInfo);
|
|
311
311
|
return pathInfo;
|
|
312
312
|
}
|
|
313
313
|
class PathInfo {
|
|
@@ -3070,65 +3070,15 @@ const disconnectedCallbackSymbol = Symbol("$$disconnectedCallback");
|
|
|
3070
3070
|
const updatedCallbackSymbol = Symbol("$$updatedCallback");
|
|
3071
3071
|
const errorCallbackSymbol = Symbol("$$errorCallback");
|
|
3072
3072
|
|
|
3073
|
-
const _cache$3 = new WeakMap();
|
|
3074
|
-
function getAbsolutePathInfo(stateElement, pathInfo) {
|
|
3075
|
-
if (_cache$3.has(stateElement)) {
|
|
3076
|
-
const pathMap = _cache$3.get(stateElement);
|
|
3077
|
-
if (pathMap.has(pathInfo)) {
|
|
3078
|
-
return pathMap.get(pathInfo);
|
|
3079
|
-
}
|
|
3080
|
-
}
|
|
3081
|
-
else {
|
|
3082
|
-
_cache$3.set(stateElement, new WeakMap());
|
|
3083
|
-
}
|
|
3084
|
-
const absolutePathInfo = Object.freeze(new AbsolutePathInfo(stateElement, pathInfo));
|
|
3085
|
-
_cache$3.get(stateElement).set(pathInfo, absolutePathInfo);
|
|
3086
|
-
return absolutePathInfo;
|
|
3087
|
-
}
|
|
3088
|
-
class AbsolutePathInfo {
|
|
3089
|
-
pathInfo;
|
|
3090
|
-
stateElement;
|
|
3091
|
-
parentAbsolutePathInfo;
|
|
3092
|
-
constructor(stateElement, pathInfo) {
|
|
3093
|
-
this.pathInfo = pathInfo;
|
|
3094
|
-
this.stateElement = stateElement;
|
|
3095
|
-
if (pathInfo.parentPathInfo === null) {
|
|
3096
|
-
this.parentAbsolutePathInfo = null;
|
|
3097
|
-
}
|
|
3098
|
-
else {
|
|
3099
|
-
this.parentAbsolutePathInfo = getAbsolutePathInfo(stateElement, pathInfo.parentPathInfo);
|
|
3100
|
-
}
|
|
3101
|
-
}
|
|
3102
|
-
}
|
|
3103
|
-
|
|
3104
3073
|
const _cache$2 = new WeakMap();
|
|
3105
3074
|
const _cacheNullListIndex$1 = new WeakMap();
|
|
3106
3075
|
class AbsoluteStateAddress {
|
|
3107
3076
|
absolutePathInfo;
|
|
3108
3077
|
listIndex;
|
|
3109
|
-
_parentAbsoluteAddress;
|
|
3110
3078
|
constructor(absolutePathInfo, listIndex) {
|
|
3111
3079
|
this.absolutePathInfo = absolutePathInfo;
|
|
3112
3080
|
this.listIndex = listIndex;
|
|
3113
3081
|
}
|
|
3114
|
-
get parentAbsoluteAddress() {
|
|
3115
|
-
if (typeof this._parentAbsoluteAddress !== 'undefined') {
|
|
3116
|
-
return this._parentAbsoluteAddress;
|
|
3117
|
-
}
|
|
3118
|
-
const parentAbsolutePathInfo = this.absolutePathInfo.parentAbsolutePathInfo;
|
|
3119
|
-
if (parentAbsolutePathInfo === null) {
|
|
3120
|
-
return null;
|
|
3121
|
-
}
|
|
3122
|
-
const lastSegment = this.absolutePathInfo.pathInfo.segments[this.absolutePathInfo.pathInfo.segments.length - 1];
|
|
3123
|
-
let parentListIndex = null;
|
|
3124
|
-
if (lastSegment === WILDCARD) {
|
|
3125
|
-
parentListIndex = this.listIndex?.parentListIndex ?? null;
|
|
3126
|
-
}
|
|
3127
|
-
else {
|
|
3128
|
-
parentListIndex = this.listIndex;
|
|
3129
|
-
}
|
|
3130
|
-
return this._parentAbsoluteAddress = createAbsoluteStateAddress(parentAbsolutePathInfo, parentListIndex);
|
|
3131
|
-
}
|
|
3132
3082
|
}
|
|
3133
3083
|
function createAbsoluteStateAddress(absolutePathInfo, listIndex) {
|
|
3134
3084
|
if (listIndex === null) {
|
|
@@ -3156,6 +3106,64 @@ function createAbsoluteStateAddress(absolutePathInfo, listIndex) {
|
|
|
3156
3106
|
}
|
|
3157
3107
|
}
|
|
3158
3108
|
|
|
3109
|
+
/**
|
|
3110
|
+
* ツリー(`<wcs-state>` 要素)に固定したパス。絶対アドレスの intern の中間ノードであり、
|
|
3111
|
+
* 行バインディングのパターン台帳のキーでもある(docs/state-row-instantiation-redesign.md §3-3)。
|
|
3112
|
+
*
|
|
3113
|
+
* 表は「要素を弱キーにした WeakMap → PathInfo をキーにした Map」の 2 段。PathInfo はページの
|
|
3114
|
+
* 寿命だけ生きる(強参照の Map に載っている)ので内側は WeakMap である必要が無く、Map のほうが
|
|
3115
|
+
* 引きが速い。各段は get 1 回と undefined 比較で引く — has してから get する形は同じ表を
|
|
3116
|
+
* 2 回引いていた。読みのベンチ(e2e/bench/plain-read.mjs)では、キャッシュを引く読みが
|
|
3117
|
+
* getter で約 1ns、行の getter で 3〜5ns 速くなり、この関数を通らない素のパスの読みは変わらない
|
|
3118
|
+
* (docs/spikes/state-address-intern-placement/README.md の main-tp)。
|
|
3119
|
+
*
|
|
3120
|
+
* ノードへの強参照経路は要素の WeakMap エントリ(ephemeron)だけなので、要素が DOM から外れれば
|
|
3121
|
+
* ノードごと回収される(e2e/tests/state-address-gc.spec.ts)。
|
|
3122
|
+
*/
|
|
3123
|
+
const treePathsByElement = new WeakMap();
|
|
3124
|
+
function getTreePath(stateElement, pathInfo) {
|
|
3125
|
+
let table = treePathsByElement.get(stateElement);
|
|
3126
|
+
if (table === undefined) {
|
|
3127
|
+
table = new Map();
|
|
3128
|
+
treePathsByElement.set(stateElement, table);
|
|
3129
|
+
}
|
|
3130
|
+
let treePath = table.get(pathInfo);
|
|
3131
|
+
if (treePath === undefined) {
|
|
3132
|
+
treePath = Object.freeze(new TreePath(stateElement, pathInfo));
|
|
3133
|
+
table.set(pathInfo, treePath);
|
|
3134
|
+
}
|
|
3135
|
+
return treePath;
|
|
3136
|
+
}
|
|
3137
|
+
class TreePath {
|
|
3138
|
+
pathInfo;
|
|
3139
|
+
stateElement;
|
|
3140
|
+
constructor(stateElement, pathInfo) {
|
|
3141
|
+
this.pathInfo = pathInfo;
|
|
3142
|
+
this.stateElement = stateElement;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
/**
|
|
3147
|
+
* ツリー非依存のアドレスを、`stateElement`(どのツリーか)まで確定した絶対アドレスへ持ち上げる。
|
|
3148
|
+
*
|
|
3149
|
+
* 恒久台帳(cache / bindings / baseline / updater の queue)はモジュール単一でツリーをまたぐので、
|
|
3150
|
+
* キーは必ずこちらを使う — `IStateAddress` をそのままキーにすると、同じパス形状や同じ配列を持つ
|
|
3151
|
+
* 2 つの `<wcs-state>` が混線する(__tests__/addressLedgerKeyGuard.test.ts が番人)。
|
|
3152
|
+
*
|
|
3153
|
+
* 持ち上げは選択の余地が無い決定的な変換で、以前は各呼び出し元が 2 行で手書きしていた。
|
|
3154
|
+
* ここに集めて、intern の関数(getTreePath / createAbsoluteStateAddress)を src/address/ の外から
|
|
3155
|
+
* 直接呼ばせない(__tests__/addressImportBoundary.test.ts が番人)。2 本の型を 1 本に畳む統合
|
|
3156
|
+
* (docs/state-address-unification-design.md)は、素のパスの読みを退行させることが実測で分かり、
|
|
3157
|
+
* 閉じた(同 §12)— この持ち上げは残る。
|
|
3158
|
+
*/
|
|
3159
|
+
function liftAddress(stateElement, address) {
|
|
3160
|
+
return createAbsoluteStateAddress(getTreePath(stateElement, address.pathInfo), address.listIndex);
|
|
3161
|
+
}
|
|
3162
|
+
/** `IStateAddress` を経ずに、構成要素から直接絶対アドレスを作る。 */
|
|
3163
|
+
function absoluteAddressOf(stateElement, pathInfo, listIndex) {
|
|
3164
|
+
return createAbsoluteStateAddress(getTreePath(stateElement, pathInfo), listIndex);
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3159
3167
|
const rootNodeByFragment = new WeakMap();
|
|
3160
3168
|
function setRootNodeByFragment(fragment, rootNode) {
|
|
3161
3169
|
if (rootNode === null) {
|
|
@@ -3316,9 +3324,7 @@ function getAbsoluteStateAddressByBinding(binding, knownRootNode) {
|
|
|
3316
3324
|
if (stateElement === null) {
|
|
3317
3325
|
raiseError(`No state tree found on this root for binding.`);
|
|
3318
3326
|
}
|
|
3319
|
-
|
|
3320
|
-
absoluteStateAddress =
|
|
3321
|
-
createAbsoluteStateAddress(absolutePathInfo, listIndex);
|
|
3327
|
+
absoluteStateAddress = absoluteAddressOf(stateElement, binding.statePathInfo, listIndex);
|
|
3322
3328
|
absoluteStateAddressByBinding.set(binding, absoluteStateAddress);
|
|
3323
3329
|
return absoluteStateAddress;
|
|
3324
3330
|
}
|
|
@@ -5785,7 +5791,7 @@ class BindingSession {
|
|
|
5785
5791
|
if (stateElement === null) {
|
|
5786
5792
|
raiseError(`No state tree found on this root for binding.`);
|
|
5787
5793
|
}
|
|
5788
|
-
const absolutePathInfo =
|
|
5794
|
+
const absolutePathInfo = getTreePath(stateElement, binding.statePathInfo);
|
|
5789
5795
|
addBindingByPattern(absolutePathInfo, listIndex, binding);
|
|
5790
5796
|
record.patternPathInfo = absolutePathInfo;
|
|
5791
5797
|
record.patternListIndex = listIndex;
|
|
@@ -10396,7 +10402,7 @@ async function buildBindings(root) {
|
|
|
10396
10402
|
}
|
|
10397
10403
|
}
|
|
10398
10404
|
|
|
10399
|
-
var version = "2.5.
|
|
10405
|
+
var version = "2.5.1";
|
|
10400
10406
|
var pkg = {
|
|
10401
10407
|
version: version};
|
|
10402
10408
|
|
|
@@ -13726,11 +13732,10 @@ function forgetGeneration(stateElement, previousState, generatedPaths) {
|
|
|
13726
13732
|
function forgetCacheEntries(stateElement, previousState, generatedPaths) {
|
|
13727
13733
|
for (const concretePath of generatedPaths) {
|
|
13728
13734
|
const pathInfo = getPathInfo(concretePath);
|
|
13729
|
-
const absPathInfo = getAbsolutePathInfo(stateElement, pathInfo);
|
|
13730
13735
|
const lists = pathInfo.wildcardParentPathInfos;
|
|
13731
13736
|
const forget = (owner, ownerListIndex, level) => {
|
|
13732
13737
|
if (level === lists.length) {
|
|
13733
|
-
setCacheEntryByAbsoluteStateAddress(
|
|
13738
|
+
setCacheEntryByAbsoluteStateAddress(absoluteAddressOf(stateElement, pathInfo, ownerListIndex), null);
|
|
13734
13739
|
return;
|
|
13735
13740
|
}
|
|
13736
13741
|
// 直前のリストの行(または state のルート)から、次のリストまでの相対セグメントを辿る
|
|
@@ -14293,7 +14298,7 @@ function assertNoScanFeedback(stateElement, streamEntry) {
|
|
|
14293
14298
|
*
|
|
14294
14299
|
* - モジュールスコープの collector を立てて readonly proxy 上で args を評価し、
|
|
14295
14300
|
* getByAddress を通った読みを絶対アドレス(IAbsoluteStateAddress)として捕捉する。
|
|
14296
|
-
*
|
|
14301
|
+
* TreePath / AbsoluteStateAddress は両方キャッシュ済みのため、捕捉した
|
|
14297
14302
|
* アドレスは drain バッチと Set.has のインスタンス同一性で O(1) 照合できる(§2-1)。
|
|
14298
14303
|
* - collectStreamDependency は getByAddress のホットパスから毎読み呼ばれるため、
|
|
14299
14304
|
* collector === null なら即 return し、それ以外の計算を一切しない。
|
|
@@ -14313,8 +14318,7 @@ function collectStreamDependency(stateElement, address) {
|
|
|
14313
14318
|
if (collector === null) {
|
|
14314
14319
|
return;
|
|
14315
14320
|
}
|
|
14316
|
-
|
|
14317
|
-
collector.add(createAbsoluteStateAddress(absolutePathInfo, address.listIndex));
|
|
14321
|
+
collector.add(liftAddress(stateElement, address));
|
|
14318
14322
|
}
|
|
14319
14323
|
/**
|
|
14320
14324
|
* args を readonly proxy で同期評価し、読まれたパスを entry.depAddresses に
|
|
@@ -15680,7 +15684,8 @@ function primeComputedWatches(stateElement) {
|
|
|
15680
15684
|
stateElement.createState("readonly", (state) => {
|
|
15681
15685
|
for (const entry of targets) {
|
|
15682
15686
|
try {
|
|
15683
|
-
|
|
15687
|
+
// ワイルドカードを含まない watch パスなので、listIndex は常に null
|
|
15688
|
+
setComputedSnapshot(stateElement, absoluteAddressOf(stateElement, entry.pathInfo, null), state[entry.path]);
|
|
15684
15689
|
}
|
|
15685
15690
|
catch (e) {
|
|
15686
15691
|
// 初回評価の throw は接続を巻き添えにしない(発火時と同じ隔離方針、§7-1)
|
|
@@ -15689,10 +15694,6 @@ function primeComputedWatches(stateElement) {
|
|
|
15689
15694
|
}
|
|
15690
15695
|
});
|
|
15691
15696
|
}
|
|
15692
|
-
/** ワイルドカードを含まない watch パスの絶対アドレス(listIndex は常に null) */
|
|
15693
|
-
function absoluteAddressOf(stateElement, entry) {
|
|
15694
|
-
return createAbsoluteStateAddress(getAbsolutePathInfo(stateElement, entry.pathInfo), null);
|
|
15695
|
-
}
|
|
15696
15697
|
/**
|
|
15697
15698
|
* 前回評価値のスナップショット台帳(computedSnapshots)に載せる entry か。
|
|
15698
15699
|
*
|
|
@@ -15772,9 +15773,9 @@ function fireWatchHits(batch, activeStateElements, depth) {
|
|
|
15772
15773
|
// --- 収集フェーズ ---
|
|
15773
15774
|
const hits = [];
|
|
15774
15775
|
for (const absAddress of batch) {
|
|
15775
|
-
// stateElement 参照で引く。
|
|
15776
|
+
// stateElement 参照で引く。TreePath は
|
|
15776
15777
|
// stateElement 単位でキャッシュされるので、同名 state が複数の rootNode に
|
|
15777
|
-
// 居ても取り違えない(address/
|
|
15778
|
+
// 居ても取り違えない(address/TreePath.ts)。他 state のアドレスは
|
|
15778
15779
|
// ここで自然に落ちる = 越境しない(設計 D8)。
|
|
15779
15780
|
const stateElement = absAddress.absolutePathInfo.stateElement;
|
|
15780
15781
|
if (!activeStateElements.has(stateElement)) {
|
|
@@ -17418,8 +17419,7 @@ function _getByAddress(target, address, receiver, handler, stateElement) {
|
|
|
17418
17419
|
}
|
|
17419
17420
|
}
|
|
17420
17421
|
function _getByAddressWithCache(target, address, receiver, handler, stateElement) {
|
|
17421
|
-
const
|
|
17422
|
-
const absAddress = createAbsoluteStateAddress(absPathInfo, address.listIndex);
|
|
17422
|
+
const absAddress = liftAddress(stateElement, address);
|
|
17423
17423
|
const cacheEntry = getCacheEntryByAbsoluteStateAddress(absAddress);
|
|
17424
17424
|
// 世代印(issue #258 の X10)。絶対アドレスは再セットを跨いで同一なので、dirty だけでは
|
|
17425
17425
|
// 旧世代の値と新世代の値を見分けられない。世代の違う項目は単に miss として再評価し、
|
|
@@ -17495,7 +17495,7 @@ function collectWildcardIndexes(target, receiver, handler, pathInfo, indexes, op
|
|
|
17495
17495
|
return;
|
|
17496
17496
|
}
|
|
17497
17497
|
const wildcardAddress = createStateAddress(wildcardParentPathInfo, listIndex);
|
|
17498
|
-
const wildcardAbsAddress =
|
|
17498
|
+
const wildcardAbsAddress = liftAddress(handler.stateElement, wildcardAddress);
|
|
17499
17499
|
const oldValue = getStateListBaseline(wildcardAbsAddress);
|
|
17500
17500
|
const newValue = getByAddress(target, wildcardAddress, receiver, handler);
|
|
17501
17501
|
const listDiff = createListDiff(listIndex, oldValue, newValue);
|
|
@@ -17902,9 +17902,8 @@ function getIndexes(listDiff, searchType) {
|
|
|
17902
17902
|
function _walkExpandWildcard(context, currentWildcardIndex, parentListIndex) {
|
|
17903
17903
|
const parentPath = context.wildcardParentPaths[currentWildcardIndex];
|
|
17904
17904
|
const parentPathInfo = getPathInfo(parentPath);
|
|
17905
|
-
const parentAbsPathInfo = getAbsolutePathInfo(context.stateElement, parentPathInfo);
|
|
17906
17905
|
const parentAddress = createStateAddress(parentPathInfo, parentListIndex);
|
|
17907
|
-
const parentAbsAddress =
|
|
17906
|
+
const parentAbsAddress = liftAddress(context.stateElement, parentAddress);
|
|
17908
17907
|
const lastValue = getStateListBaseline(parentAbsAddress);
|
|
17909
17908
|
const newValue = context.stateProxy[getByAddressSymbol](parentAddress);
|
|
17910
17909
|
const listDiff = createListDiff(parentAddress.listIndex, lastValue, newValue);
|
|
@@ -18048,8 +18047,7 @@ function _collectDependencies(context, address, nextEntries) {
|
|
|
18048
18047
|
if (context.listPathSet.has(sourcePath) && depPathInfo.lastSegment === WILDCARD) {
|
|
18049
18048
|
//expand indexes
|
|
18050
18049
|
const newValue = context.stateProxy[getByAddressSymbol](address);
|
|
18051
|
-
const
|
|
18052
|
-
const absAddress = createAbsoluteStateAddress(absPathInfo, address.listIndex);
|
|
18050
|
+
const absAddress = liftAddress(context.stateElement, address);
|
|
18053
18051
|
const lastValue = getStateListBaseline(absAddress);
|
|
18054
18052
|
const listDiff = createListDiff(address.listIndex, lastValue, newValue);
|
|
18055
18053
|
context.observedListValueByAbsAddress.set(absAddress, Array.isArray(newValue) ? newValue : []);
|
|
@@ -18264,8 +18262,7 @@ function notifyWrite(address, absAddress, receiver, handler, keyedMergePath, cac
|
|
|
18264
18262
|
// キャッシュを無効化(ダーティ)
|
|
18265
18263
|
if (depAddress === address)
|
|
18266
18264
|
return;
|
|
18267
|
-
const
|
|
18268
|
-
const absDepAddress = createAbsoluteStateAddress(absDepPathInfo, depAddress.listIndex);
|
|
18265
|
+
const absDepAddress = liftAddress(handler.stateElement, depAddress);
|
|
18269
18266
|
dirtyCacheEntryByAbsoluteStateAddress(absDepAddress);
|
|
18270
18267
|
// 更新対象として登録
|
|
18271
18268
|
updater.enqueueAbsoluteAddress(absDepAddress, propagationContext);
|
|
@@ -18415,7 +18412,7 @@ function _setByAddressWithSwap(target, address, absAddress, value, receiver, han
|
|
|
18415
18412
|
function notifySwappedList(parentAddress, swapInfo, currentParentValue, currentListIndexes, receiver, handler) {
|
|
18416
18413
|
const stateElement = handler.stateElement;
|
|
18417
18414
|
const updater = getUpdater();
|
|
18418
|
-
const listAbsAddress =
|
|
18415
|
+
const listAbsAddress = liftAddress(stateElement, parentAddress);
|
|
18419
18416
|
if (getLastListValueByAbsoluteStateAddress(listAbsAddress) === currentParentValue) {
|
|
18420
18417
|
setListIndexesByList(swapInfo.value, swapInfo.listIndexes);
|
|
18421
18418
|
setLastListValueByAbsoluteStateAddress(listAbsAddress, swapInfo.value);
|
|
@@ -18425,7 +18422,6 @@ function notifySwappedList(parentAddress, swapInfo, currentParentValue, currentL
|
|
|
18425
18422
|
const positionBefore = new Map();
|
|
18426
18423
|
swapInfo.listIndexes.forEach((listIndex, position) => positionBefore.set(listIndex, position));
|
|
18427
18424
|
const elementPathInfo = getPathInfo(parentAddress.pathInfo.path + DELIMITER + WILDCARD);
|
|
18428
|
-
const elementAbsPathInfo = getAbsolutePathInfo(stateElement, elementPathInfo);
|
|
18429
18425
|
for (let position = 0; position < currentListIndexes.length; position++) {
|
|
18430
18426
|
const listIndex = currentListIndexes[position];
|
|
18431
18427
|
const before = positionBefore.get(listIndex);
|
|
@@ -18433,9 +18429,9 @@ function notifySwappedList(parentAddress, swapInfo, currentParentValue, currentL
|
|
|
18433
18429
|
continue;
|
|
18434
18430
|
}
|
|
18435
18431
|
const elementAddress = createStateAddress(elementPathInfo, listIndex);
|
|
18436
|
-
const elementAbsAddress =
|
|
18432
|
+
const elementAbsAddress = liftAddress(stateElement, elementAddress);
|
|
18437
18433
|
if (typeof before === "undefined") {
|
|
18438
|
-
const displacedAbsAddress =
|
|
18434
|
+
const displacedAbsAddress = absoluteAddressOf(stateElement, elementPathInfo, swapInfo.listIndexes[position] ?? null);
|
|
18439
18435
|
if (hasPrevValue(displacedAbsAddress)) {
|
|
18440
18436
|
recordPrevValue(elementAbsAddress, getPrevValue(displacedAbsAddress));
|
|
18441
18437
|
}
|
|
@@ -18445,7 +18441,7 @@ function notifySwappedList(parentAddress, swapInfo, currentParentValue, currentL
|
|
|
18445
18441
|
continue;
|
|
18446
18442
|
}
|
|
18447
18443
|
walkDependency(stateElement, elementAddress, stateElement.staticDependency, stateElement.dynamicDependency, stateElement.listPaths, receiver, "new", (depAddress) => {
|
|
18448
|
-
const depAbsAddress =
|
|
18444
|
+
const depAbsAddress = liftAddress(stateElement, depAddress);
|
|
18449
18445
|
dirtyCacheEntryByAbsoluteStateAddress(depAbsAddress);
|
|
18450
18446
|
updater.enqueueRenderOnlyAddress(depAbsAddress);
|
|
18451
18447
|
}, { listExpansion: "diff" });
|
|
@@ -18585,8 +18581,7 @@ function setByAddressCore(target, address, value, receiver, handler, keyedMergeP
|
|
|
18585
18581
|
devHasOldValue = true;
|
|
18586
18582
|
}
|
|
18587
18583
|
const cacheable = isCacheable(stateElement, address);
|
|
18588
|
-
const
|
|
18589
|
-
const absAddress = createAbsoluteStateAddress(absPathInfo, address.listIndex);
|
|
18584
|
+
const absAddress = liftAddress(stateElement, address);
|
|
18590
18585
|
if (devtoolsSink !== null) {
|
|
18591
18586
|
devtoolsSink({
|
|
18592
18587
|
type: "state:write",
|
|
@@ -18651,8 +18646,7 @@ function setByAddressCore(target, address, value, receiver, handler, keyedMergeP
|
|
|
18651
18646
|
// --- end same-value guard ---
|
|
18652
18647
|
const isSwappable = stateElement.elementPaths.has(address.pathInfo.path);
|
|
18653
18648
|
const cacheable = isCacheable(stateElement, address);
|
|
18654
|
-
const
|
|
18655
|
-
const absAddress = createAbsoluteStateAddress(absPathInfo, address.listIndex);
|
|
18649
|
+
const absAddress = liftAddress(stateElement, address);
|
|
18656
18650
|
if (devtoolsSink !== null) {
|
|
18657
18651
|
devtoolsSink({
|
|
18658
18652
|
type: "state:write",
|
|
@@ -18930,7 +18924,7 @@ function collectRecursiveAddresses(target, receiver, handler, registry, suffix)
|
|
|
18930
18924
|
*/
|
|
18931
18925
|
function readRows(listPathInfo, parentListIndex, seen) {
|
|
18932
18926
|
const listAddress = createStateAddress(listPathInfo, parentListIndex);
|
|
18933
|
-
const absAddress =
|
|
18927
|
+
const absAddress = liftAddress(handler.stateElement, listAddress);
|
|
18934
18928
|
const value = getByAddress(target, listAddress, receiver, handler);
|
|
18935
18929
|
const tracked = seen === null ? null : guardShape(listPathInfo.path, value, seen);
|
|
18936
18930
|
const listDiff = createListDiff(parentListIndex, getStateListBaseline(absAddress), value);
|
|
@@ -19171,15 +19165,13 @@ function postUpdate(target, _prop, receiver, handler) {
|
|
|
19171
19165
|
const resolvedAddress = getResolvedAddress(path);
|
|
19172
19166
|
const listIndex = getListIndex(target, resolvedAddress, receiver, handler);
|
|
19173
19167
|
const address = createStateAddress(resolvedAddress.pathInfo, listIndex);
|
|
19174
|
-
const
|
|
19175
|
-
const absAddress = createAbsoluteStateAddress(absPathInfo, address.listIndex);
|
|
19168
|
+
const absAddress = liftAddress(stateElement, address);
|
|
19176
19169
|
const updater = getUpdater();
|
|
19177
19170
|
updater.enqueueAbsoluteAddress(absAddress);
|
|
19178
19171
|
// 依存関係のあるキャッシュを無効化(ダーティ)、更新対象として登録
|
|
19179
19172
|
walkDependency(handler.stateElement, address, handler.stateElement.staticDependency, handler.stateElement.dynamicDependency, handler.stateElement.listPaths, receiver, "new", (depAddress) => {
|
|
19180
19173
|
// キャッシュを無効化(ダーティ)
|
|
19181
|
-
const
|
|
19182
|
-
const absDepAddress = createAbsoluteStateAddress(absDepPathInfo, depAddress.listIndex);
|
|
19174
|
+
const absDepAddress = liftAddress(stateElement, depAddress);
|
|
19183
19175
|
dirtyCacheEntryByAbsoluteStateAddress(absDepAddress);
|
|
19184
19176
|
// 更新対象として登録
|
|
19185
19177
|
updater.enqueueAbsoluteAddress(absDepAddress);
|
|
@@ -20661,7 +20653,7 @@ function reapplyStateBindings(stateElement, paths, registeredPaths) {
|
|
|
20661
20653
|
const bindings = [];
|
|
20662
20654
|
const visited = new Set();
|
|
20663
20655
|
const collect = (address) => {
|
|
20664
|
-
const absAddress =
|
|
20656
|
+
const absAddress = liftAddress(stateElement, address);
|
|
20665
20657
|
if (visited.has(absAddress)) {
|
|
20666
20658
|
return;
|
|
20667
20659
|
}
|