refactor: front end code to unified manager api

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-20 18:56:35 -04:00
parent 053c272fe4
commit c4cb1512d2
21 changed files with 1484 additions and 927 deletions
+27
View File
@@ -0,0 +1,27 @@
import { isProxy, toRaw } from 'vue';
function normalizeCloneable<T>(value: T): T {
if (value === null || value === undefined) {
return value;
}
if (typeof value !== 'object') {
return value;
}
const rawValue = isProxy(value) ? toRaw(value) : value;
if (Array.isArray(rawValue)) {
return rawValue.map(item => normalizeCloneable(item)) as T;
}
const plainObject = Object.fromEntries(
Object.entries(rawValue).map(([key, nestedValue]) => [key, normalizeCloneable(nestedValue)])
);
return plainObject as T;
}
export function clonePlain<T>(value: T): T {
return structuredClone(normalizeCloneable(value));
}