90 lines
2.8 KiB
JavaScript
90 lines
2.8 KiB
JavaScript
import {
|
|
debugWarn
|
|
} from "./chunk-UFIWN4M6.js";
|
|
import {
|
|
Comment,
|
|
Fragment,
|
|
isVNode
|
|
} from "./chunk-AAHVYXXY.js";
|
|
import {
|
|
camelize,
|
|
hasOwn,
|
|
init_shared_esm_bundler,
|
|
isArray
|
|
} from "./chunk-OWZYVOTZ.js";
|
|
|
|
// ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/utils/vue/vnode.mjs
|
|
init_shared_esm_bundler();
|
|
var SCOPE = "utils/vue/vnode";
|
|
var PatchFlags = ((PatchFlags2) => {
|
|
PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
|
|
PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
|
|
PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
|
|
PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
|
|
PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
|
|
PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
|
|
PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
|
|
PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
|
|
PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
|
|
PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
|
|
PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
|
|
PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
|
|
PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
|
|
return PatchFlags2;
|
|
})(PatchFlags || {});
|
|
function isFragment(node) {
|
|
return isVNode(node) && node.type === Fragment;
|
|
}
|
|
function isComment(node) {
|
|
return isVNode(node) && node.type === Comment;
|
|
}
|
|
function isValidElementNode(node) {
|
|
return isVNode(node) && !isFragment(node) && !isComment(node);
|
|
}
|
|
var getNormalizedProps = (node) => {
|
|
if (!isVNode(node)) {
|
|
debugWarn(SCOPE, "[getNormalizedProps] must be a VNode");
|
|
return {};
|
|
}
|
|
const raw = node.props || {};
|
|
const type = (isVNode(node.type) ? node.type.props : void 0) || {};
|
|
const props = {};
|
|
Object.keys(type).forEach((key) => {
|
|
if (hasOwn(type[key], "default")) {
|
|
props[key] = type[key].default;
|
|
}
|
|
});
|
|
Object.keys(raw).forEach((key) => {
|
|
props[camelize(key)] = raw[key];
|
|
});
|
|
return props;
|
|
};
|
|
var flattedChildren = (children) => {
|
|
const vNodes = isArray(children) ? children : [children];
|
|
const result = [];
|
|
vNodes.forEach((child) => {
|
|
var _a;
|
|
if (isArray(child)) {
|
|
result.push(...flattedChildren(child));
|
|
} else if (isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
|
|
result.push(child, ...flattedChildren(child.component.subTree));
|
|
} else if (isVNode(child) && isArray(child.children)) {
|
|
result.push(...flattedChildren(child.children));
|
|
} else if (isVNode(child) && child.shapeFlag === 2) {
|
|
result.push(...flattedChildren(child.type()));
|
|
} else {
|
|
result.push(child);
|
|
}
|
|
});
|
|
return result;
|
|
};
|
|
|
|
export {
|
|
PatchFlags,
|
|
isFragment,
|
|
isValidElementNode,
|
|
getNormalizedProps,
|
|
flattedChildren
|
|
};
|
|
//# sourceMappingURL=chunk-57H52JND.js.map
|