Feat: effect used style

This commit is contained in:
2024-07-07 00:28:15 +02:00
parent 0facc4694f
commit 6112a7d6ba
112 changed files with 3505 additions and 3545 deletions
+59
View File
@@ -0,0 +1,59 @@
import type { App, Component, DefineComponent } from "vue";
import { getCurrentInstance } from "vue";
export const cards = {} as Record<string, Component>;
export async function compileCards(app: App<any>) {
const svgs = import.meta.glob("@/assets/images/cards/heron-svg/*.svg", {
eager: true,
});
// const components = await Promise.all(
// Object.entries(svgs).map(async ([k, v]) => {
// const regex = /([\d]+)(?=\.svg)/gm;
// const url = (v as any).default as string;
// let template = await (await fetch(url)).text();
// let arrayTemplate = template.split("\n");
// arrayTemplate.splice(0, 1);
// template = arrayTemplate.join("\n");
// return [
// k.match(regex)![0],
// defineComponent({
// props: ["currentTurn", "card"],
// setup(_props) {
// const count = ref(0);
// return { count };
// },
// template: template,
// }),
// ];
// })
// );
const components = await Promise.all(
Object.entries(svgs).map(async ([k, v]) => {
const regex = /([\d]+)(?=\.svg)/gm;
const url = (v as any).default as string;
let template = await (await fetch(url)).text();
let arrayTemplate = template.split("\n");
arrayTemplate.splice(0, 1);
template = arrayTemplate.join("\n");
return [
Number(k.match(regex)![0]).toString(),
markRaw(
defineAsyncComponent({
loader: async () => ({
props: ["used_effects_indexes", "card"],
template: template,
}),
})
),
];
})
);
Object.assign(cards, Object.fromEntries(components));
}