fix(state): 修复 keyed nodes 重排时缺少 insertBefore,降级 structuredClone 为 JSON 序列化(by AI)
Co-Authored-By: deepseek-v4-pro[1m] <deepseek-ai@claude-code-best.win>
This commit is contained in:
parent
d416907774
commit
cc4e5226c0
3
dist/state.js
vendored
3
dist/state.js
vendored
@ -4,7 +4,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
const Util = {
|
const Util = {
|
||||||
clone: globalThis.structuredClone || ((obj) => JSON.parse(JSON.stringify(obj))),
|
clone: (obj) => JSON.parse(JSON.stringify(obj)),
|
||||||
base64: (str) => btoa(String.fromCharCode(...new TextEncoder().encode(str))),
|
base64: (str) => btoa(String.fromCharCode(...new TextEncoder().encode(str))),
|
||||||
unbase64: (str) => new TextDecoder().decode(Uint8Array.from(atob(str), (c) => c.charCodeAt(0))),
|
unbase64: (str) => new TextDecoder().decode(Uint8Array.from(atob(str), (c) => c.charCodeAt(0))),
|
||||||
urlbase64: (str) => Util.base64(str).replace(/[+/=]/g, (m) => ({ "+": "-", "/": "", "=": "" })[m]),
|
urlbase64: (str) => Util.base64(str).replace(/[+/=]/g, (m) => ({ "+": "-", "/": "", "=": "" })[m]),
|
||||||
@ -385,6 +385,7 @@
|
|||||||
if (existingNodes) {
|
if (existingNodes) {
|
||||||
node._keyedNodes.delete(keyVal);
|
node._keyedNodes.delete(keyVal);
|
||||||
existingNodes.forEach((child) => {
|
existingNodes.forEach((child) => {
|
||||||
|
node.parentNode.insertBefore(child, node);
|
||||||
child._ref[indexName] = k;
|
child._ref[indexName] = k;
|
||||||
child._ref[asName] = item;
|
child._ref[asName] = item;
|
||||||
_scanTree(child);
|
_scanTree(child);
|
||||||
|
|||||||
2
dist/state.min.js
vendored
2
dist/state.min.js
vendored
File diff suppressed because one or more lines are too long
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@apigo.cc/state",
|
"name": "@apigo.cc/state",
|
||||||
"version": "1.0.19",
|
"version": "1.0.20",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@apigo.cc/state",
|
"name": "@apigo.cc/state",
|
||||||
"version": "1.0.19",
|
"version": "1.0.20",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.40.0",
|
"@playwright/test": "^1.40.0",
|
||||||
"@rollup/plugin-terser": "^1.0.0",
|
"@rollup/plugin-terser": "^1.0.0",
|
||||||
|
|||||||
@ -213,6 +213,7 @@ export function _updateBinding(binding) {
|
|||||||
if (existingNodes) {
|
if (existingNodes) {
|
||||||
node._keyedNodes.delete(keyVal);
|
node._keyedNodes.delete(keyVal);
|
||||||
existingNodes.forEach(child => {
|
existingNodes.forEach(child => {
|
||||||
|
node.parentNode.insertBefore(child, node);
|
||||||
child._ref[indexName] = k;
|
child._ref[indexName] = k;
|
||||||
child._ref[asName] = item;
|
child._ref[asName] = item;
|
||||||
_scanTree(child);
|
_scanTree(child);
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const Util = {
|
export const Util = {
|
||||||
clone: globalThis.structuredClone || (obj => JSON.parse(JSON.stringify(obj))),
|
clone: obj => JSON.parse(JSON.stringify(obj)),
|
||||||
base64: str => btoa(String.fromCharCode(...new TextEncoder().encode(str))),
|
base64: str => btoa(String.fromCharCode(...new TextEncoder().encode(str))),
|
||||||
unbase64: str => new TextDecoder().decode(Uint8Array.from(atob(str), c => c.charCodeAt(0))),
|
unbase64: str => new TextDecoder().decode(Uint8Array.from(atob(str), c => c.charCodeAt(0))),
|
||||||
urlbase64: str => Util.base64(str).replace(/[+/=]/g, m => ({ '+': '-', '/': '', '=': '' }[m])),
|
urlbase64: str => Util.base64(str).replace(/[+/=]/g, m => ({ '+': '-', '/': '', '=': '' }[m])),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user