Initial commit: GamePortrait 竖屏版 - 深色豪华主题

This commit is contained in:
li
2026-01-16 17:47:53 +08:00
commit 40976e4b45
26611 changed files with 2843638 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
import { type ExtractPropTypes } from 'vue';
export declare const textEllipsisProps: {
rows: {
type: (NumberConstructor | StringConstructor)[];
default: number;
};
content: {
type: import("vue").PropType<string>;
default: string;
};
expandText: {
type: import("vue").PropType<string>;
default: string;
};
collapseText: {
type: import("vue").PropType<string>;
default: string;
};
};
export type TextEllipsisProps = ExtractPropTypes<typeof textEllipsisProps>;
declare const _default: import("vue").DefineComponent<{
rows: {
type: (NumberConstructor | StringConstructor)[];
default: number;
};
content: {
type: import("vue").PropType<string>;
default: string;
};
expandText: {
type: import("vue").PropType<string>;
default: string;
};
collapseText: {
type: import("vue").PropType<string>;
default: string;
};
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
rows: {
type: (NumberConstructor | StringConstructor)[];
default: number;
};
content: {
type: import("vue").PropType<string>;
default: string;
};
expandText: {
type: import("vue").PropType<string>;
default: string;
};
collapseText: {
type: import("vue").PropType<string>;
default: string;
};
}>> & {
onClickAction?: ((...args: any[]) => any) | undefined;
}, {
content: string;
rows: string | number;
expandText: string;
collapseText: string;
}>;
export default _default;
+127
View File
@@ -0,0 +1,127 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name2 in all)
__defProp(target, name2, { get: all[name2], 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);
var stdin_exports = {};
__export(stdin_exports, {
default: () => stdin_default,
textEllipsisProps: () => textEllipsisProps
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_vue2 = require("vue");
var import_use = require("@vant/use");
var import_utils = require("../utils");
const [name, bem] = (0, import_utils.createNamespace)("text-ellipsis");
const textEllipsisProps = {
rows: (0, import_utils.makeNumericProp)(1),
content: (0, import_utils.makeStringProp)(""),
expandText: (0, import_utils.makeStringProp)(""),
collapseText: (0, import_utils.makeStringProp)("")
};
var stdin_default = (0, import_vue2.defineComponent)({
name,
props: textEllipsisProps,
emits: ["clickAction"],
setup(props, {
emit
}) {
const text = (0, import_vue2.ref)("");
const expanded = (0, import_vue2.ref)(false);
const hasAction = (0, import_vue2.ref)(false);
const root = (0, import_vue2.ref)();
const pxToNum = (value) => {
if (!value)
return 0;
const match = value.match(/^\d*(\.\d*)?/);
return match ? Number(match[0]) : 0;
};
const calcEllipsised = () => {
const cloneContainer = () => {
if (!root.value)
return;
const originStyle = window.getComputedStyle(root.value);
const container2 = document.createElement("div");
const styleNames = Array.prototype.slice.apply(originStyle);
styleNames.forEach((name2) => {
container2.style.setProperty(name2, originStyle.getPropertyValue(name2));
});
container2.style.position = "fixed";
container2.style.zIndex = "-9999";
container2.style.top = "-9999px";
container2.style.height = "auto";
container2.style.minHeight = "auto";
container2.style.maxHeight = "auto";
container2.innerText = props.content;
document.body.appendChild(container2);
return container2;
};
const calcEllipsisText = (container2, maxHeight2) => {
const {
content,
expandText
} = props;
const dot = "...";
let left = 0;
let right = content.length;
let res = -1;
while (left <= right) {
const mid = Math.floor((left + right) / 2);
container2.innerText = content.slice(0, mid) + dot + expandText;
if (container2.offsetHeight <= maxHeight2) {
left = mid + 1;
res = mid;
} else {
right = mid - 1;
}
}
return content.slice(0, res) + dot;
};
const container = cloneContainer();
if (!container)
return;
const {
paddingBottom,
paddingTop,
lineHeight
} = container.style;
const maxHeight = (Number(props.rows) + 0.5) * pxToNum(lineHeight) + pxToNum(paddingTop) + pxToNum(paddingBottom);
if (maxHeight < container.offsetHeight) {
hasAction.value = true;
text.value = calcEllipsisText(container, maxHeight);
} else {
hasAction.value = false;
text.value = props.content;
}
document.body.removeChild(container);
};
const onClickAction = (event) => {
expanded.value = !expanded.value;
emit("clickAction", event);
};
const renderAction = () => (0, import_vue.createVNode)("span", {
"class": bem("action"),
"onClick": onClickAction
}, [expanded.value ? props.collapseText : props.expandText]);
(0, import_vue2.onMounted)(calcEllipsised);
(0, import_vue2.watch)(() => [props.content, props.rows], calcEllipsised);
(0, import_use.useEventListener)("resize", calcEllipsised);
return () => (0, import_vue.createVNode)("div", {
"ref": root,
"class": bem()
}, [expanded.value ? props.content : text.value, hasAction.value ? renderAction() : null]);
}
});
+1
View File
@@ -0,0 +1 @@
:root{--van-text-ellipsis-line-height: 1.6;--van-text-ellipsis-action-color: var(--van-blue)}.van-text-ellipsis{line-height:var(--van-text-ellipsis-line-height);white-space:pre-wrap;word-break:break-word}.van-text-ellipsis__action{cursor:pointer;color:var(--van-text-ellipsis-action-color)}.van-text-ellipsis__action:active{opacity:var(--van-active-opacity)}
+51
View File
@@ -0,0 +1,51 @@
export declare const TextEllipsis: import("../utils").WithInstall<import("vue").DefineComponent<{
rows: {
type: (NumberConstructor | StringConstructor)[];
default: number;
};
content: {
type: import("vue").PropType<string>;
default: string;
};
expandText: {
type: import("vue").PropType<string>;
default: string;
};
collapseText: {
type: import("vue").PropType<string>;
default: string;
};
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "clickAction"[], "clickAction", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
rows: {
type: (NumberConstructor | StringConstructor)[];
default: number;
};
content: {
type: import("vue").PropType<string>;
default: string;
};
expandText: {
type: import("vue").PropType<string>;
default: string;
};
collapseText: {
type: import("vue").PropType<string>;
default: string;
};
}>> & {
onClickAction?: ((...args: any[]) => any) | undefined;
}, {
content: string;
rows: string | number;
expandText: string;
collapseText: string;
}>>;
export default TextEllipsis;
export { textEllipsisProps } from './TextEllipsis';
export type { TextEllipsisProps } from './TextEllipsis';
export type { TextEllipsisThemeVars } from './types';
declare module 'vue' {
interface GlobalComponents {
VanTextEllipsis: typeof TextEllipsis;
}
}
+39
View File
@@ -0,0 +1,39 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
TextEllipsis: () => TextEllipsis,
default: () => stdin_default,
textEllipsisProps: () => import_TextEllipsis2.textEllipsisProps
});
module.exports = __toCommonJS(stdin_exports);
var import_utils = require("../utils");
var import_TextEllipsis = __toESM(require("./TextEllipsis"));
var import_TextEllipsis2 = require("./TextEllipsis");
const TextEllipsis = (0, import_utils.withInstall)(import_TextEllipsis.default);
var stdin_default = TextEllipsis;
+1
View File
@@ -0,0 +1 @@
export {};
+2
View File
@@ -0,0 +1,2 @@
require("../../style/base.css");
require("../index.css");
+3
View File
@@ -0,0 +1,3 @@
export type TextEllipsisThemeVars = {
textEllipsisActionColor?: string;
};
+15
View File
@@ -0,0 +1,15 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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);
var stdin_exports = {};
module.exports = __toCommonJS(stdin_exports);