mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-10-13 01:59:02 +00:00
chore: modman inital setup
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
|||||||
local/
|
local/
|
||||||
build/
|
/build/
|
||||||
.vscode
|
.vscode
|
||||||
.idea
|
.idea
|
||||||
user*.*
|
user*.*
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -19,3 +19,6 @@
|
|||||||
[submodule "thirdparty/lz4"]
|
[submodule "thirdparty/lz4"]
|
||||||
path = thirdparty/lz4
|
path = thirdparty/lz4
|
||||||
url = https://github.com/lz4/lz4.git
|
url = https://github.com/lz4/lz4.git
|
||||||
|
[submodule "thirdparty/webview"]
|
||||||
|
path = thirdparty/webview
|
||||||
|
url = https://github.com/webview/webview.git
|
||||||
|
10
premake5.lua
10
premake5.lua
@@ -95,27 +95,29 @@ include "thirdparty/catch2.lua"
|
|||||||
include "thirdparty/eigen.lua"
|
include "thirdparty/eigen.lua"
|
||||||
include "thirdparty/libtomcrypt.lua"
|
include "thirdparty/libtomcrypt.lua"
|
||||||
include "thirdparty/libtommath.lua"
|
include "thirdparty/libtommath.lua"
|
||||||
|
include "thirdparty/lz4.lua"
|
||||||
include "thirdparty/lzx.lua"
|
include "thirdparty/lzx.lua"
|
||||||
include "thirdparty/json.lua"
|
include "thirdparty/json.lua"
|
||||||
include "thirdparty/minilzo.lua"
|
include "thirdparty/minilzo.lua"
|
||||||
include "thirdparty/minizip.lua"
|
include "thirdparty/minizip.lua"
|
||||||
include "thirdparty/salsa20.lua"
|
include "thirdparty/salsa20.lua"
|
||||||
|
include "thirdparty/webview.lua"
|
||||||
include "thirdparty/zlib.lua"
|
include "thirdparty/zlib.lua"
|
||||||
include "thirdparty/lz4.lua"
|
|
||||||
|
|
||||||
-- ThirdParty group: All projects that are external dependencies
|
-- ThirdParty group: All projects that are external dependencies
|
||||||
group "ThirdParty"
|
group "ThirdParty"
|
||||||
catch2:project()
|
catch2:project()
|
||||||
eigen:project()
|
eigen:project()
|
||||||
libtommath:project()
|
|
||||||
libtomcrypt:project()
|
libtomcrypt:project()
|
||||||
|
libtommath:project()
|
||||||
|
lz4:project()
|
||||||
lzx:project()
|
lzx:project()
|
||||||
json:project()
|
json:project()
|
||||||
minilzo:project()
|
minilzo:project()
|
||||||
minizip:project()
|
minizip:project()
|
||||||
salsa20:project()
|
salsa20:project()
|
||||||
|
webview:project()
|
||||||
zlib:project()
|
zlib:project()
|
||||||
lz4:project()
|
|
||||||
group ""
|
group ""
|
||||||
|
|
||||||
-- ========================
|
-- ========================
|
||||||
@@ -125,6 +127,7 @@ include "src/Common.lua"
|
|||||||
include "src/Cryptography.lua"
|
include "src/Cryptography.lua"
|
||||||
include "src/ImageConverter.lua"
|
include "src/ImageConverter.lua"
|
||||||
include "src/Linker.lua"
|
include "src/Linker.lua"
|
||||||
|
include "src/ModMan.lua"
|
||||||
include "src/Parser.lua"
|
include "src/Parser.lua"
|
||||||
include "src/RawTemplater.lua"
|
include "src/RawTemplater.lua"
|
||||||
include "src/Unlinker.lua"
|
include "src/Unlinker.lua"
|
||||||
@@ -170,6 +173,7 @@ group ""
|
|||||||
-- Tools group: All projects that compile into the final tools
|
-- Tools group: All projects that compile into the final tools
|
||||||
group "Tools"
|
group "Tools"
|
||||||
Linker:project()
|
Linker:project()
|
||||||
|
ModMan:project()
|
||||||
Unlinker:project()
|
Unlinker:project()
|
||||||
ImageConverter:project()
|
ImageConverter:project()
|
||||||
group ""
|
group ""
|
||||||
|
48
src/ModMan.lua
Normal file
48
src/ModMan.lua
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
ModMan = {}
|
||||||
|
|
||||||
|
function ModMan:include(includes)
|
||||||
|
if includes:handle(self:name()) then
|
||||||
|
includedirs {
|
||||||
|
path.join(ProjectFolder(), "ModMan")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ModMan:link(links)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function ModMan:use()
|
||||||
|
dependson(self:name())
|
||||||
|
end
|
||||||
|
|
||||||
|
function ModMan:name()
|
||||||
|
return "ModMan"
|
||||||
|
end
|
||||||
|
|
||||||
|
function ModMan:project()
|
||||||
|
local folder = ProjectFolder()
|
||||||
|
local includes = Includes:create()
|
||||||
|
local links = Links:create()
|
||||||
|
|
||||||
|
project(self:name())
|
||||||
|
targetdir(TargetDirectoryBin)
|
||||||
|
location "%{wks.location}/src/%{prj.name}"
|
||||||
|
kind "WindowedApp"
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
files {
|
||||||
|
path.join(folder, "ModMan/**.h"),
|
||||||
|
path.join(folder, "ModMan/**.cpp")
|
||||||
|
}
|
||||||
|
|
||||||
|
includedirs {
|
||||||
|
"%{prj.location}"
|
||||||
|
}
|
||||||
|
|
||||||
|
self:include(includes)
|
||||||
|
webview:include(includes)
|
||||||
|
|
||||||
|
links:linkto(webview)
|
||||||
|
links:linkall()
|
||||||
|
end
|
64
src/ModMan/main.cpp
Normal file
64
src/ModMan/main.cpp
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#include "ui/modmanui.h"
|
||||||
|
|
||||||
|
#pragma warning(push, 0)
|
||||||
|
#include "webview/webview.h"
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
int WINAPI WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
long count = 0;
|
||||||
|
webview::webview w(true, nullptr);
|
||||||
|
w.set_title("Basic Example");
|
||||||
|
w.set_size(480, 320, WEBVIEW_HINT_NONE);
|
||||||
|
|
||||||
|
// A binding that counts up or down and immediately returns the new value.
|
||||||
|
w.bind("count",
|
||||||
|
[&](const std::string& req) -> std::string
|
||||||
|
{
|
||||||
|
// Imagine that req is properly parsed or use your own JSON parser.
|
||||||
|
auto direction = std::stol(req.substr(1, req.size() - 1));
|
||||||
|
return std::to_string(count += direction);
|
||||||
|
});
|
||||||
|
|
||||||
|
// A binding that creates a new thread and returns the result at a later time.
|
||||||
|
w.bind(
|
||||||
|
"compute",
|
||||||
|
[&](const std::string& id, const std::string& req, void* /*arg*/)
|
||||||
|
{
|
||||||
|
// Create a thread and forget about it for the sake of simplicity.
|
||||||
|
std::thread(
|
||||||
|
[&, id, req]
|
||||||
|
{
|
||||||
|
// Simulate load.
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
// Imagine that req is properly parsed or use your own JSON parser.
|
||||||
|
const auto* result = "42";
|
||||||
|
w.resolve(id, 0, result);
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
},
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
w.set_html(std::string(reinterpret_cast<const char*>(INDEX_HTML), std::extent_v<decltype(INDEX_HTML)>));
|
||||||
|
w.run();
|
||||||
|
}
|
||||||
|
catch (const webview::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << e.what() << '\n';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
24
src/ModManUi/.gitignore
vendored
Normal file
24
src/ModManUi/.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
1
src/ModManUi/.prettierignore
Normal file
1
src/ModManUi/.prettierignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
src-tauri
|
4
src/ModManUi/.prettierrc.json
Normal file
4
src/ModManUi/.prettierrc.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/prettierrc",
|
||||||
|
"printWidth": 100
|
||||||
|
}
|
151
src/ModManUi/build/HeaderTransformationPlugin.ts
Normal file
151
src/ModManUi/build/HeaderTransformationPlugin.ts
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
import type { Plugin, ViteDevServer } from "vite";
|
||||||
|
import type { OutputOptions, OutputBundle, OutputAsset, OutputChunk } from "rollup";
|
||||||
|
import { createHmac } from "node:crypto";
|
||||||
|
import path from "node:path";
|
||||||
|
import fs from "node:fs";
|
||||||
|
|
||||||
|
function createTransformedTextSource2(varName: string, previousSource: string) {
|
||||||
|
const hash = createHmac("sha256", previousSource);
|
||||||
|
const digest = hash.digest("hex").substring(0, 16);
|
||||||
|
|
||||||
|
return `#pragma once
|
||||||
|
|
||||||
|
static inline const char* ${varName} = R"${digest}(${previousSource})${digest}";
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createTransformedTextSource(varName: string, previousSource: string) {
|
||||||
|
const str = [...previousSource].map((v) => `0x${v.charCodeAt(0).toString(16).padStart(2, "0")}`).join(", ");
|
||||||
|
return `#pragma once
|
||||||
|
|
||||||
|
static inline const unsigned char ${varName}[] {
|
||||||
|
${str}
|
||||||
|
};
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createVarName(fileName: string) {
|
||||||
|
return fileName.replaceAll(".", "_").toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformAsset(asset: OutputAsset) {
|
||||||
|
const varName = createVarName(asset.names[0]);
|
||||||
|
|
||||||
|
if (typeof asset.source === "string") {
|
||||||
|
asset.source = createTransformedTextSource(varName, asset.source);
|
||||||
|
return `${varName}, std::extent_v<decltype(${varName})>`;
|
||||||
|
// return `${varName}, std::char_traits<char>::length(${varName})`;
|
||||||
|
} else {
|
||||||
|
const str = [...asset.source].map((v) => `0x${v.toString(16).padStart(2, "0")}`).join(", ");
|
||||||
|
asset.source = `#pragma once
|
||||||
|
|
||||||
|
static inline const unsigned char ${varName}[] {
|
||||||
|
${str}
|
||||||
|
};
|
||||||
|
`;
|
||||||
|
return `${varName}, std::extent_v<decltype(${varName})>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformChunk(chunk: OutputChunk) {
|
||||||
|
const varName = createVarName(chunk.fileName);
|
||||||
|
chunk.code = createTransformedTextSource(varName, chunk.code);
|
||||||
|
return `${varName}, std::extent_v<decltype(${varName})>`;
|
||||||
|
// return `${varName}, std::char_traits<char>::length(${varName})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function headerTransformationPlugin(): Plugin {
|
||||||
|
return {
|
||||||
|
name: "header-transformation",
|
||||||
|
apply: "build",
|
||||||
|
config(config) {
|
||||||
|
config.base = "http://modman-resource/";
|
||||||
|
},
|
||||||
|
generateBundle(options: OutputOptions, bundle: OutputBundle, isWrite: boolean) {
|
||||||
|
const includesStr: string[] = [];
|
||||||
|
const uiFilesStr: string[] = [];
|
||||||
|
for (const curBundle of Object.values(bundle)) {
|
||||||
|
let varStr: string;
|
||||||
|
if (curBundle.type === "asset") {
|
||||||
|
varStr = transformAsset(curBundle);
|
||||||
|
} else {
|
||||||
|
varStr = transformChunk(curBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
includesStr.push(`#include "${curBundle.fileName}.h"`);
|
||||||
|
uiFilesStr.push(`{ "${curBundle.fileName}", { "${curBundle.fileName}", ${varStr} } }`);
|
||||||
|
|
||||||
|
curBundle.fileName = `${curBundle.fileName}.h`;
|
||||||
|
}
|
||||||
|
this.emitFile({
|
||||||
|
type: "asset",
|
||||||
|
fileName: "modmanui.h",
|
||||||
|
source: `#pragma once
|
||||||
|
|
||||||
|
#include "index.html.h"
|
||||||
|
${includesStr.join("\n")}
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
struct UiFile
|
||||||
|
{
|
||||||
|
const char* filename;
|
||||||
|
const void* data;
|
||||||
|
const size_t dataSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline const std::unordered_map<std::string, UiFile> MOD_MAN_UI_FILES({
|
||||||
|
${uiFilesStr.join(",\n")}
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
transformIndexHtml(
|
||||||
|
html: string,
|
||||||
|
ctx: {
|
||||||
|
path: string;
|
||||||
|
filename: string;
|
||||||
|
server?: ViteDevServer;
|
||||||
|
bundle?: OutputBundle;
|
||||||
|
chunk?: OutputChunk;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
html = html
|
||||||
|
.replaceAll("index.js.h", "index.js")
|
||||||
|
.replaceAll("http://modman-resource/", "modman-resource://");
|
||||||
|
|
||||||
|
html = createTransformedTextSource(createVarName("index.html"), html);
|
||||||
|
ctx.filename = `${ctx.filename}.h`;
|
||||||
|
|
||||||
|
return html;
|
||||||
|
},
|
||||||
|
writeBundle(options, bundle) {
|
||||||
|
for (const curBundle of Object.values(bundle)) {
|
||||||
|
if (curBundle.fileName === "index.html" && curBundle.type === "asset") {
|
||||||
|
const outputFilePath = path.join(options.dir!, curBundle.fileName);
|
||||||
|
fs.renameSync(outputFilePath, outputFilePath + ".h");
|
||||||
|
curBundle.fileName += ".h";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.emitFile({
|
||||||
|
type: "asset",
|
||||||
|
fileName: "index.h",
|
||||||
|
source: `
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script src="" type="module"></script>
|
||||||
|
<script src="" type="module"></script>
|
||||||
|
<script src="" type="module"></script>
|
||||||
|
</body>
|
||||||
|
</html>`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
1
src/ModManUi/env.d.ts
vendored
Normal file
1
src/ModManUi/env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
28
src/ModManUi/eslint.config.ts
Normal file
28
src/ModManUi/eslint.config.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { globalIgnores } from "eslint/config";
|
||||||
|
import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript";
|
||||||
|
import pluginVue from "eslint-plugin-vue";
|
||||||
|
import pluginVitest from "@vitest/eslint-plugin";
|
||||||
|
import skipFormatting from "@vue/eslint-config-prettier/skip-formatting";
|
||||||
|
|
||||||
|
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
||||||
|
// import { configureVueProject } from '@vue/eslint-config-typescript'
|
||||||
|
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
|
||||||
|
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
|
||||||
|
|
||||||
|
export default defineConfigWithVueTs(
|
||||||
|
{
|
||||||
|
name: "app/files-to-lint",
|
||||||
|
files: ["**/*.{ts,mts,tsx,vue}"],
|
||||||
|
},
|
||||||
|
|
||||||
|
globalIgnores(["**/dist/**", "**/dist-ssr/**", "**/coverage/**"]),
|
||||||
|
|
||||||
|
pluginVue.configs["flat/essential"],
|
||||||
|
vueTsConfigs.recommended,
|
||||||
|
|
||||||
|
{
|
||||||
|
...pluginVitest.configs.recommended,
|
||||||
|
files: ["src/**/__tests__/*"],
|
||||||
|
},
|
||||||
|
skipFormatting,
|
||||||
|
);
|
13
src/ModManUi/index.html
Normal file
13
src/ModManUi/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" href="/favicon.ico" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Tauri + Vue + Typescript App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
7083
src/ModManUi/package-lock.json
generated
Normal file
7083
src/ModManUi/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
42
src/ModManUi/package.json
Normal file
42
src/ModManUi/package.json
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"name": "openassettools",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.1.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "run-p type-check \"build-only {@}\" --",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"build-only": "vite build",
|
||||||
|
"type-check": "vue-tsc --build",
|
||||||
|
"lint": "eslint . --fix",
|
||||||
|
"format": "prettier --write **/*.{js,ts,vue,html,json,yml,yaml,md}"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"pinia": "3.0.3",
|
||||||
|
"vue": "3.5.22"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tsconfig/node22": "^22.0.2",
|
||||||
|
"@types/jsdom": "^21.1.7",
|
||||||
|
"@types/node": "^22.18.6",
|
||||||
|
"@vitejs/plugin-vue": "6.0.1",
|
||||||
|
"@vitest/eslint-plugin": "^1.3.13",
|
||||||
|
"@vue/eslint-config-prettier": "^10.2.0",
|
||||||
|
"@vue/eslint-config-typescript": "^14.6.0",
|
||||||
|
"@vue/test-utils": "^2.4.6",
|
||||||
|
"@vue/tsconfig": "^0.8.1",
|
||||||
|
"eslint": "^9.33.0",
|
||||||
|
"eslint-plugin-vue": "~10.4.0",
|
||||||
|
"jiti": "^2.5.1",
|
||||||
|
"jsdom": "^27.0.0",
|
||||||
|
"npm-run-all2": "^8.0.4",
|
||||||
|
"prettier": "3.6.2",
|
||||||
|
"sass": "1.93.2",
|
||||||
|
"typescript": "~5.9.3",
|
||||||
|
"vite": "7.1.7",
|
||||||
|
"vite-plugin-vue-devtools": "^8.0.2",
|
||||||
|
"vitest": "^3.2.4",
|
||||||
|
"vue-tsc": "3.1.0"
|
||||||
|
}
|
||||||
|
}
|
BIN
src/ModManUi/public/favicon.ico
Normal file
BIN
src/ModManUi/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
33
src/ModManUi/src/App.vue
Normal file
33
src/ModManUi/src/App.vue
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
const greetMsg = ref("");
|
||||||
|
const name = ref("");
|
||||||
|
|
||||||
|
async function greet() {
|
||||||
|
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||||
|
// greetMsg.value = await invoke("greet", { name: name.value });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<main class="container">
|
||||||
|
<h1>Welcome to Tauri + Vue</h1>
|
||||||
|
|
||||||
|
<form class="row" @submit.prevent="greet">
|
||||||
|
<input id="greet-input" v-model="name" placeholder="Enter a name..." autocomplete="off" />
|
||||||
|
<button type="submit">Greet</button>
|
||||||
|
</form>
|
||||||
|
<p>{{ greetMsg }}</p>
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.logo.vite:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #747bff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo.vue:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #249b73);
|
||||||
|
}
|
||||||
|
</style>
|
109
src/ModManUi/src/main.scss
Normal file
109
src/ModManUi/src/main.scss
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
:root {
|
||||||
|
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 24px;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color: #0f0f0f;
|
||||||
|
background-color: #f6f6f6;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
margin: 0;
|
||||||
|
padding-top: 10vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 6em;
|
||||||
|
padding: 1.5em;
|
||||||
|
will-change: filter;
|
||||||
|
transition: 0.75s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo.tauri:hover {
|
||||||
|
filter: drop-shadow(0 0 2em #24c8db);
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #646cff;
|
||||||
|
text-decoration: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #535bf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
color: #0f0f0f;
|
||||||
|
background-color: #ffffff;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
border-color: #396cd8;
|
||||||
|
}
|
||||||
|
button:active {
|
||||||
|
border-color: #396cd8;
|
||||||
|
background-color: #e8e8e8;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#greet-input {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
color: #f6f6f6;
|
||||||
|
background-color: #2f2f2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #24c8db;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
button {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #0f0f0f98;
|
||||||
|
}
|
||||||
|
button:active {
|
||||||
|
background-color: #0f0f0f69;
|
||||||
|
}
|
||||||
|
}
|
13
src/ModManUi/src/main.ts
Normal file
13
src/ModManUi/src/main.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import "../public/favicon.ico";
|
||||||
|
import "./main.scss";
|
||||||
|
|
||||||
|
import { createApp } from "vue";
|
||||||
|
import { createPinia } from "pinia";
|
||||||
|
|
||||||
|
import App from "./App.vue";
|
||||||
|
|
||||||
|
const app = createApp(App);
|
||||||
|
|
||||||
|
app.use(createPinia());
|
||||||
|
|
||||||
|
app.mount("#app");
|
12
src/ModManUi/src/stores/counter.ts
Normal file
12
src/ModManUi/src/stores/counter.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { ref, computed } from "vue";
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
export const useCounterStore = defineStore("counter", () => {
|
||||||
|
const count = ref(0);
|
||||||
|
const doubleCount = computed(() => count.value * 2);
|
||||||
|
function increment() {
|
||||||
|
count.value++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { count, doubleCount, increment };
|
||||||
|
});
|
12
src/ModManUi/tsconfig.app.json
Normal file
12
src/ModManUi/tsconfig.app.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||||
|
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
||||||
|
"exclude": ["src/**/__tests__/*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
src/ModManUi/tsconfig.json
Normal file
14
src/ModManUi/tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.node.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.vitest.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
20
src/ModManUi/tsconfig.node.json
Normal file
20
src/ModManUi/tsconfig.node.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"extends": "@tsconfig/node22/tsconfig.json",
|
||||||
|
"include": [
|
||||||
|
"vite.config.*",
|
||||||
|
"vitest.config.*",
|
||||||
|
"cypress.config.*",
|
||||||
|
"nightwatch.conf.*",
|
||||||
|
"playwright.config.*",
|
||||||
|
"eslint.config.*",
|
||||||
|
"build/**/*"
|
||||||
|
],
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmit": true,
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
11
src/ModManUi/tsconfig.vitest.json
Normal file
11
src/ModManUi/tsconfig.vitest.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.app.json",
|
||||||
|
"include": ["src/**/__tests__/*", "env.d.ts"],
|
||||||
|
"exclude": [],
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo",
|
||||||
|
|
||||||
|
"lib": [],
|
||||||
|
"types": ["node", "jsdom"]
|
||||||
|
}
|
||||||
|
}
|
32
src/ModManUi/vite.config.ts
Normal file
32
src/ModManUi/vite.config.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { fileURLToPath, URL } from "node:url";
|
||||||
|
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import vueDevTools from "vite-plugin-vue-devtools";
|
||||||
|
import { headerTransformationPlugin } from "./build/HeaderTransformationPlugin";
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
outDir: "../../build/src/ModMan/ui",
|
||||||
|
copyPublicDir: false,
|
||||||
|
emptyOutDir: true,
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
assetFileNames: "[name][extname]",
|
||||||
|
entryFileNames: "[name].js",
|
||||||
|
chunkFileNames: "[name].js",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [vue(), vueDevTools(), headerTransformationPlugin()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 1420,
|
||||||
|
strictPort: true,
|
||||||
|
},
|
||||||
|
});
|
13
src/ModManUi/vitest.config.ts
Normal file
13
src/ModManUi/vitest.config.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { mergeConfig, defineConfig } from "vitest/config";
|
||||||
|
import viteConfig from "./vite.config";
|
||||||
|
|
||||||
|
export default mergeConfig(
|
||||||
|
viteConfig,
|
||||||
|
defineConfig({
|
||||||
|
test: {
|
||||||
|
environment: "jsdom",
|
||||||
|
root: fileURLToPath(new URL("./", import.meta.url)),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
1
thirdparty/webview
vendored
Submodule
1
thirdparty/webview
vendored
Submodule
Submodule thirdparty/webview added at 55b438dc11
116
thirdparty/webview.lua
vendored
Normal file
116
thirdparty/webview.lua
vendored
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
webview = {}
|
||||||
|
|
||||||
|
function webview:include(includes)
|
||||||
|
if includes:handle(self:name()) then
|
||||||
|
includedirs {
|
||||||
|
path.join(ThirdPartyFolder(), "webview/core/include"),
|
||||||
|
path.join(self:msWebviewDir(), "build/native/include")
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function webview:link(links)
|
||||||
|
|
||||||
|
links:add("WebView2LoaderStatic")
|
||||||
|
|
||||||
|
filter "platforms:x86"
|
||||||
|
libdirs {
|
||||||
|
path.join(self:msWebviewDir(), "build/native/x86")
|
||||||
|
}
|
||||||
|
filter {}
|
||||||
|
filter "platforms:x64"
|
||||||
|
libdirs {
|
||||||
|
path.join(self:msWebviewDir(), "build/native/x64")
|
||||||
|
}
|
||||||
|
filter {}
|
||||||
|
|
||||||
|
links:add(self:name())
|
||||||
|
end
|
||||||
|
|
||||||
|
function webview:use()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function webview:name()
|
||||||
|
return "webview"
|
||||||
|
end
|
||||||
|
|
||||||
|
function webview:project()
|
||||||
|
local folder = ThirdPartyFolder()
|
||||||
|
local includes = Includes:create()
|
||||||
|
|
||||||
|
project(self:name())
|
||||||
|
targetdir(TargetDirectoryLib)
|
||||||
|
location "%{wks.location}/thirdparty/%{prj.name}"
|
||||||
|
kind "StaticLib"
|
||||||
|
language "C++"
|
||||||
|
|
||||||
|
files {
|
||||||
|
path.join(folder, "webview/core/include/**.h"),
|
||||||
|
path.join(folder, "webview/core/include/**.hh"),
|
||||||
|
path.join(folder, "webview/core/src/**.cc")
|
||||||
|
}
|
||||||
|
|
||||||
|
defines {
|
||||||
|
"WEBVIEW_STATIC"
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.host() == "windows" then
|
||||||
|
self:installWebview2()
|
||||||
|
end
|
||||||
|
|
||||||
|
self:include(includes)
|
||||||
|
|
||||||
|
-- Disable warnings. They do not have any value to us since it is not our code.
|
||||||
|
warnings "off"
|
||||||
|
end
|
||||||
|
|
||||||
|
function webview:msWebviewDir()
|
||||||
|
return path.join(BuildFolder(), "thirdparty/ms-webview2")
|
||||||
|
end
|
||||||
|
|
||||||
|
function webview:installWebview2()
|
||||||
|
local version = "1.0.3485.44"
|
||||||
|
local webviewDir = self:msWebviewDir()
|
||||||
|
local versionFile = path.join(webviewDir, "ms-webview2.txt")
|
||||||
|
local nuspecFile = path.join(webviewDir, "Microsoft.Web.WebView2.nuspec")
|
||||||
|
local nupkgFile = path.join(webviewDir, "microsoft.web.webview2.nupkg.zip")
|
||||||
|
local url = "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/" .. version
|
||||||
|
|
||||||
|
if not os.isdir(webviewDir) then
|
||||||
|
os.mkdir(webviewDir)
|
||||||
|
end
|
||||||
|
|
||||||
|
local installedVersion = io.readfile(versionFile)
|
||||||
|
if installedVersion == version and os.isfile(nuspecFile) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
function progress(total, current)
|
||||||
|
local ratio = current / total;
|
||||||
|
ratio = math.min(math.max(ratio, 0), 1);
|
||||||
|
local percent = math.floor(ratio * 100);
|
||||||
|
io.write("\rDownload progress (" .. percent .. "%/100%)")
|
||||||
|
end
|
||||||
|
|
||||||
|
print("Downloading Microsoft.Web.WebView2 " .. version .. "...")
|
||||||
|
local result_str, response_code = http.download(url, nupkgFile, {
|
||||||
|
progress = progress
|
||||||
|
})
|
||||||
|
|
||||||
|
io.write("\n")
|
||||||
|
|
||||||
|
if result_str ~= "OK" then
|
||||||
|
premake.error("Failed to download Microsoft.Web.WebView2")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- local hash = string.sha1(io.readfile(nupkgFile))
|
||||||
|
-- print(hash)
|
||||||
|
|
||||||
|
print("Extracting Microsoft.Web.WebView2 " .. version .. "...")
|
||||||
|
zip.extract(nupkgFile, webviewDir)
|
||||||
|
|
||||||
|
os.remove(nupkgFile)
|
||||||
|
|
||||||
|
io.writefile(versionFile, version)
|
||||||
|
end
|
Reference in New Issue
Block a user