Files
NapCatQQ/.pnpm-store/v3/files/8f/63df3cff866dcbae860477689f2bb7c62bd46110ef2de7f68e51ee2b2734c8a81825127d136cd300defa60d6e3ead02149dd249d8e7b7129fcb576f0a9f6b8
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

92 lines
3.0 KiB
Plaintext

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/utils.ts
var utils_exports = {};
__export(utils_exports, {
forwardRef: () => forwardRef,
isHeroUIEl: () => isHeroUIEl,
mapPropsVariants: () => mapPropsVariants,
mapPropsVariantsWithCommon: () => mapPropsVariantsWithCommon,
toIterator: () => toIterator
});
module.exports = __toCommonJS(utils_exports);
var import_react = require("react");
function forwardRef(component) {
return (0, import_react.forwardRef)(component);
}
var toIterator = (obj) => {
return {
...obj,
[Symbol.iterator]: function() {
const keys = Object.keys(this);
let index = 0;
return {
next: () => {
if (index >= keys.length) {
return { done: true };
}
const key = keys[index];
const value = this[key];
index++;
return { value: { key, value }, done: false };
}
};
}
};
};
var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
if (!variantKeys) {
return [props, {}];
}
const picked = variantKeys.reduce((acc, key) => {
if (key in props) {
return { ...acc, [key]: props[key] };
} else {
return acc;
}
}, {});
if (removeVariantProps) {
const omitted = Object.keys(props).filter((key) => !variantKeys.includes(key)).reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
return [omitted, picked];
} else {
return [props, picked];
}
};
var mapPropsVariantsWithCommon = (originalProps, variantKeys, commonKeys) => {
const props = Object.keys(originalProps).filter((key) => !variantKeys.includes(key) || (commonKeys == null ? void 0 : commonKeys.includes(key))).reduce((acc, key) => ({ ...acc, [key]: originalProps[key] }), {});
const variants = variantKeys.reduce(
(acc, key) => ({ ...acc, [key]: originalProps[key] }),
{}
);
return [props, variants];
};
var isHeroUIEl = (component) => {
var _a, _b, _c;
return !!((_c = (_b = (_a = component.type) == null ? void 0 : _a.render) == null ? void 0 : _b.displayName) == null ? void 0 : _c.includes("HeroUI"));
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
forwardRef,
isHeroUIEl,
mapPropsVariants,
mapPropsVariantsWithCommon,
toIterator
});