完成世界书、骰子、apiconfig页面处理

This commit is contained in:
2026-04-30 01:35:10 +08:00
parent a3e3711b2b
commit ba9b925c32
4602 changed files with 785225 additions and 23 deletions

View File

@@ -0,0 +1,26 @@
/** Default values for dimensions */
const defaultIconDimensions = Object.freeze({
left: 0,
top: 0,
width: 16,
height: 16
});
/** Default values for transformations */
const defaultIconTransformations = Object.freeze({
rotate: 0,
vFlip: false,
hFlip: false
});
/** Default values for all optional IconifyIcon properties */
const defaultIconProps = Object.freeze({
...defaultIconDimensions,
...defaultIconTransformations
});
/** Default values for all properties used in ExtendedIconifyIcon */
const defaultExtendedIconProps = Object.freeze({
...defaultIconProps,
body: "",
hidden: false
});
export { defaultExtendedIconProps, defaultIconDimensions, defaultIconProps, defaultIconTransformations };

18
frontend/node_modules/@iconify/utils/lib/icon/merge.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import { defaultExtendedIconProps, defaultIconTransformations } from "./defaults.js";
import { mergeIconTransformations } from "./transformations.js";
/**
* Merge icon and alias
*
* Can also be used to merge default values and icon
*/
function mergeIconData(parent, child) {
const result = mergeIconTransformations(parent, child);
for (const key in defaultExtendedIconProps) if (key in defaultIconTransformations) {
if (key in parent && !(key in result)) result[key] = defaultIconTransformations[key];
} else if (key in child) result[key] = child[key];
else if (key in parent) result[key] = parent[key];
return result;
}
export { mergeIconData };

View File

@@ -0,0 +1,11 @@
import { SVGViewBox } from "../svg/viewbox.js";
import { IconifyIcon } from "@iconify/types";
/**
* Make icon square
*/
declare function makeIconSquare(icon: Required<IconifyIcon>): Required<IconifyIcon>;
/**
* Make icon viewBox square
*/
declare function makeViewBoxSquare(viewBox: SVGViewBox): SVGViewBox;
export { makeIconSquare, makeViewBoxSquare };

View File

@@ -0,0 +1,34 @@
/**
* Make icon square
*/
function makeIconSquare(icon) {
if (icon.width !== icon.height) {
const max = Math.max(icon.width, icon.height);
return {
...icon,
width: max,
height: max,
left: icon.left - (max - icon.width) / 2,
top: icon.top - (max - icon.height) / 2
};
}
return icon;
}
/**
* Make icon viewBox square
*/
function makeViewBoxSquare(viewBox) {
const [left, top, width, height] = viewBox;
if (width !== height) {
const max = Math.max(width, height);
return [
left - (max - width) / 2,
top - (max - height) / 2,
max,
max
];
}
return viewBox;
}
export { makeIconSquare, makeViewBoxSquare };