Switched from vue-cli-service to vite
Should be thoroughly tested still Also involved removing operator overloads, which weren't good anyways
This commit is contained in:
parent
cd3841e7e0
commit
7fe57798bb
36 changed files with 990 additions and 16153 deletions
|
@ -1,12 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
presets: ["@vue/cli-plugin-babel/preset", "@babel/preset-typescript"],
|
|
||||||
plugins: [
|
|
||||||
[
|
|
||||||
"module:@jetblack/operator-overloading",
|
|
||||||
{
|
|
||||||
enabled: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@vue/babel-plugin-jsx"
|
|
||||||
]
|
|
||||||
};
|
|
|
@ -16,14 +16,14 @@
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||||
<link rel="manifest" href="/site.webmanifest">
|
<link rel="manifest" href="/site.webmanifest">
|
||||||
|
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title>Profectus</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
<strong>We're sorry but Profectus doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- built files will be auto injected -->
|
<script type="module" src="./src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
16920
package-lock.json
generated
16920
package-lock.json
generated
File diff suppressed because it is too large
Load diff
42
package.json
42
package.json
|
@ -3,21 +3,24 @@
|
||||||
"version": "0.4.2",
|
"version": "0.4.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vue-cli-service serve",
|
"start": "vite",
|
||||||
"serve": "vue-cli-service serve",
|
"dev": "vite",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"lint": "vue-cli-service lint",
|
"preview": "vite preview",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pixi/particle-emitter": "^5.0.4",
|
"@pixi/particle-emitter": "^5.0.4",
|
||||||
|
"@vitejs/plugin-vue": "^2.3.3",
|
||||||
|
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"is-plain-object": "^5.0.0",
|
"is-plain-object": "^5.0.0",
|
||||||
"jest-environment-jsdom": "^28.1.1",
|
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"lz-string": "^1.4.4",
|
"lz-string": "^1.4.4",
|
||||||
"nanoevents": "^6.0.2",
|
"nanoevents": "^6.0.2",
|
||||||
"pixi.js": "^6.3.0",
|
"pixi.js": "^6.3.0",
|
||||||
|
"vite": "^2.9.12",
|
||||||
|
"vite-tsconfig-paths": "^3.5.0",
|
||||||
"vue": "^3.2.26",
|
"vue": "^3.2.26",
|
||||||
"vue-next-select": "^2.10.2",
|
"vue-next-select": "^2.10.2",
|
||||||
"vue-panzoom": "^1.1.6",
|
"vue-panzoom": "^1.1.6",
|
||||||
|
@ -27,49 +30,26 @@
|
||||||
"vuedraggable": "^4.1.0"
|
"vuedraggable": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.18.5",
|
|
||||||
"@babel/preset-env": "^7.18.2",
|
|
||||||
"@babel/preset-typescript": "^7.17.12",
|
|
||||||
"@ivanv/vue-collapse-transition": "^1.0.2",
|
"@ivanv/vue-collapse-transition": "^1.0.2",
|
||||||
"@jetblack/operator-overloading": "^0.2.0",
|
|
||||||
"@rushstack/eslint-patch": "^1.1.0",
|
"@rushstack/eslint-patch": "^1.1.0",
|
||||||
"@types/jest": "^28.1.3",
|
"@types/jest": "^28.1.3",
|
||||||
"@types/lodash.clonedeep": "^4.5.6",
|
"@types/lodash.clonedeep": "^4.5.6",
|
||||||
"@types/lz-string": "^1.3.34",
|
"@types/lz-string": "^1.3.34",
|
||||||
"@vue/babel-plugin-jsx": "^1.1.1",
|
|
||||||
"@vue/cli-plugin-babel": "^5.0.3",
|
|
||||||
"@vue/cli-plugin-eslint": "^5.0.3",
|
|
||||||
"@vue/cli-plugin-typescript": "^5.0.3",
|
|
||||||
"@vue/cli-service": "^5.0.3",
|
|
||||||
"@vue/compiler-sfc": "^3.2.26",
|
|
||||||
"@vue/eslint-config-prettier": "^7.0.0",
|
"@vue/eslint-config-prettier": "^7.0.0",
|
||||||
"@vue/eslint-config-typescript": "^10.0.0",
|
"@vue/eslint-config-typescript": "^10.0.0",
|
||||||
"babel-eslint": "^10.1.0",
|
|
||||||
"babel-jest": "^28.1.1",
|
"babel-jest": "^28.1.1",
|
||||||
"eslint": "^8.6.0",
|
"eslint": "^8.6.0",
|
||||||
"jest": "^28.1.1",
|
"jest": "^28.1.1",
|
||||||
"lint-staged": "^12.3.4",
|
"jest-environment-jsdom": "^28.1.1",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"raw-loader": "^4.0.2",
|
"typescript": "~4.5.5",
|
||||||
"sass": "^1.48.0",
|
"vue-tsc": "^0.38.1"
|
||||||
"sass-loader": "^10.2.0",
|
|
||||||
"tsconfig-paths-webpack-plugin": "^3.5.1",
|
|
||||||
"typescript": "~4.5.5"
|
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"> 1%",
|
"> 1%",
|
||||||
"last 2 versions",
|
"last 2 versions",
|
||||||
"not dead"
|
"not dead"
|
||||||
],
|
],
|
||||||
"gitHooks": {
|
|
||||||
"pre-commit": "lint-staged"
|
|
||||||
},
|
|
||||||
"lint-staged": {
|
|
||||||
"*.{js,jsx,ts,tsx,vue}": [
|
|
||||||
"vue-cli-service lint",
|
|
||||||
"git add"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x"
|
"node": "16.x"
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,10 @@ import projInfo from "./data/projInfo.json";
|
||||||
import themes from "./data/themes";
|
import themes from "./data/themes";
|
||||||
import settings, { gameComponents } from "./game/settings";
|
import settings, { gameComponents } from "./game/settings";
|
||||||
import "./main.css";
|
import "./main.css";
|
||||||
|
import type { CSSProperties } from "vue";
|
||||||
|
|
||||||
const useHeader = projInfo.useHeader;
|
const useHeader = projInfo.useHeader;
|
||||||
const theme = computed(() => themes[settings.theme].variables);
|
const theme = computed(() => themes[settings.theme].variables as CSSProperties);
|
||||||
const showTPS = toRef(settings, "showTPS");
|
const showTPS = toRef(settings, "showTPS");
|
||||||
|
|
||||||
const gameComponent = computed(() => {
|
const gameComponent = computed(() => {
|
||||||
|
|
|
@ -124,13 +124,15 @@ watch(saveToImport, importedSave => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let bankContext = require.context("raw-loader!../../saves", true, /\.txt$/);
|
let bankContext = import.meta.globEager("./../../saves/*.txt", { as: "raw" });
|
||||||
let bank = ref(
|
let bank = ref(
|
||||||
bankContext.keys().reduce((acc: Array<{ label: string; value: string }>, curr) => {
|
Object.keys(bankContext).reduce((acc: Array<{ label: string; value: string }>, curr) => {
|
||||||
// .slice(2, -4) strips the leading ./ and the trailing .txt
|
|
||||||
acc.push({
|
acc.push({
|
||||||
label: curr.slice(2, -4),
|
// .slice(2, -4) strips the leading ./ and the trailing .txt
|
||||||
value: bankContext(curr).default
|
label: curr.split("/").slice(-1)[0].slice(0, -4),
|
||||||
|
// Have to perform this unholy cast because globEager's typing doesn't appear to know
|
||||||
|
// adding { as: "raw" } will make the object contain strings rather than modules
|
||||||
|
value: bankContext[curr] as unknown as string
|
||||||
});
|
});
|
||||||
return acc;
|
return acc;
|
||||||
}, [])
|
}, [])
|
||||||
|
|
|
@ -15,7 +15,7 @@ const emit = defineEmits<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const activated = ref(false);
|
const activated = ref(false);
|
||||||
const activatedTimeout = ref<number | null>(null);
|
const activatedTimeout = ref<NodeJS.Timer | null>(null);
|
||||||
|
|
||||||
function click() {
|
function click() {
|
||||||
emit("click");
|
emit("click");
|
||||||
|
|
|
@ -29,6 +29,10 @@ export interface Theme {
|
||||||
declare module "@vue/runtime-dom" {
|
declare module "@vue/runtime-dom" {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
interface CSSProperties extends Partial<ThemeVars> {}
|
interface CSSProperties extends Partial<ThemeVars> {}
|
||||||
|
|
||||||
|
interface HTMLAttributes {
|
||||||
|
style?: StyleValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultTheme: Theme = {
|
const defaultTheme: Theme = {
|
||||||
|
|
|
@ -68,7 +68,7 @@ export type GenericAchievement = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createAchievement<T extends AchievementOptions>(
|
export function createAchievement<T extends AchievementOptions>(
|
||||||
optionsFunc?: OptionsFunc<T, BaseAchievement>
|
optionsFunc?: OptionsFunc<T, BaseAchievement, GenericAchievement>
|
||||||
): Achievement<T> {
|
): Achievement<T> {
|
||||||
const earned = persistent<boolean>(false);
|
const earned = persistent<boolean>(false);
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
|
|
|
@ -73,7 +73,9 @@ export type GenericBar = Replace<
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createBar<T extends BarOptions>(optionsFunc: OptionsFunc<T, BaseBar>): Bar<T> {
|
export function createBar<T extends BarOptions>(
|
||||||
|
optionsFunc: OptionsFunc<T, BaseBar, GenericBar>
|
||||||
|
): Bar<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const bar = optionsFunc();
|
const bar = optionsFunc();
|
||||||
bar.id = getUniqueID("bar-");
|
bar.id = getUniqueID("bar-");
|
||||||
|
|
|
@ -198,7 +198,7 @@ export type GenericBoard = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createBoard<T extends BoardOptions>(
|
export function createBoard<T extends BoardOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseBoard>
|
optionsFunc: OptionsFunc<T, BaseBoard, GenericBoard>
|
||||||
): Board<T> {
|
): Board<T> {
|
||||||
return createLazyProxy(
|
return createLazyProxy(
|
||||||
persistent => {
|
persistent => {
|
||||||
|
|
|
@ -88,7 +88,7 @@ export type GenericBuyable = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createBuyable<T extends BuyableOptions>(
|
export function createBuyable<T extends BuyableOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseBuyable>
|
optionsFunc: OptionsFunc<T, BaseBuyable, GenericBuyable>
|
||||||
): Buyable<T> {
|
): Buyable<T> {
|
||||||
const amount = persistent<DecimalSource>(0);
|
const amount = persistent<DecimalSource>(0);
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
|
|
|
@ -97,7 +97,7 @@ export type GenericChallenge = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createChallenge<T extends ChallengeOptions>(
|
export function createChallenge<T extends ChallengeOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseChallenge>
|
optionsFunc: OptionsFunc<T, BaseChallenge, GenericChallenge>
|
||||||
): Challenge<T> {
|
): Challenge<T> {
|
||||||
const completions = persistent(0);
|
const completions = persistent(0);
|
||||||
const active = persistent(false);
|
const active = persistent(false);
|
||||||
|
|
|
@ -70,7 +70,7 @@ export type GenericClickable = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createClickable<T extends ClickableOptions>(
|
export function createClickable<T extends ClickableOptions>(
|
||||||
optionsFunc?: OptionsFunc<T, BaseClickable>
|
optionsFunc?: OptionsFunc<T, BaseClickable, GenericClickable>
|
||||||
): Clickable<T> {
|
): Clickable<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const clickable = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
const clickable = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
||||||
|
|
|
@ -135,7 +135,7 @@ export type GenericConversion = Replace<
|
||||||
* @see {@link createIndependentConversion}.
|
* @see {@link createIndependentConversion}.
|
||||||
*/
|
*/
|
||||||
export function createConversion<T extends ConversionOptions>(
|
export function createConversion<T extends ConversionOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseConversion>
|
optionsFunc: OptionsFunc<T, BaseConversion, GenericConversion>
|
||||||
): Conversion<T> {
|
): Conversion<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const conversion = optionsFunc();
|
const conversion = optionsFunc();
|
||||||
|
@ -370,7 +370,7 @@ export function createPolynomialScaling(
|
||||||
* @param optionsFunc Conversion options.
|
* @param optionsFunc Conversion options.
|
||||||
*/
|
*/
|
||||||
export function createCumulativeConversion<S extends ConversionOptions>(
|
export function createCumulativeConversion<S extends ConversionOptions>(
|
||||||
optionsFunc: OptionsFunc<S, BaseConversion>
|
optionsFunc: OptionsFunc<S, BaseConversion, GenericConversion>
|
||||||
): Conversion<S> {
|
): Conversion<S> {
|
||||||
return createConversion(optionsFunc);
|
return createConversion(optionsFunc);
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ export function createCumulativeConversion<S extends ConversionOptions>(
|
||||||
* @param optionsFunc Converison options.
|
* @param optionsFunc Converison options.
|
||||||
*/
|
*/
|
||||||
export function createIndependentConversion<S extends ConversionOptions>(
|
export function createIndependentConversion<S extends ConversionOptions>(
|
||||||
optionsFunc: OptionsFunc<S, BaseConversion>
|
optionsFunc: OptionsFunc<S, BaseConversion, GenericConversion>
|
||||||
): Conversion<S> {
|
): Conversion<S> {
|
||||||
return createConversion(() => {
|
return createConversion(() => {
|
||||||
const conversion: S = optionsFunc();
|
const conversion: S = optionsFunc();
|
||||||
|
|
|
@ -41,7 +41,7 @@ export type Replace<T, S> = S & Omit<T, keyof S>;
|
||||||
* with "this" bound to what the type will eventually be processed into.
|
* with "this" bound to what the type will eventually be processed into.
|
||||||
* Intended for making lazily evaluated objects.
|
* Intended for making lazily evaluated objects.
|
||||||
*/
|
*/
|
||||||
export type OptionsFunc<T, R = Record<string, unknown>> = () => T & Partial<R>;
|
export type OptionsFunc<T, R = Record<string, unknown>, S = R> = () => T & Partial<R> & ThisType<S>;
|
||||||
|
|
||||||
let id = 0;
|
let id = 0;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -242,7 +242,9 @@ export type GenericGrid = Replace<
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createGrid<T extends GridOptions>(optionsFunc: OptionsFunc<T, BaseGrid>): Grid<T> {
|
export function createGrid<T extends GridOptions>(
|
||||||
|
optionsFunc: OptionsFunc<T, BaseGrid, GenericGrid>
|
||||||
|
): Grid<T> {
|
||||||
const cellState = persistent<Record<string | number, State>>({});
|
const cellState = persistent<Record<string | number, State>>({});
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const grid = optionsFunc();
|
const grid = optionsFunc();
|
||||||
|
|
|
@ -43,7 +43,7 @@ export type GenericHotkey = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createHotkey<T extends HotkeyOptions>(
|
export function createHotkey<T extends HotkeyOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseHotkey>
|
optionsFunc: OptionsFunc<T, BaseHotkey, GenericHotkey>
|
||||||
): Hotkey<T> {
|
): Hotkey<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const hotkey = optionsFunc();
|
const hotkey = optionsFunc();
|
||||||
|
|
|
@ -64,7 +64,7 @@ export type GenericInfobox = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createInfobox<T extends InfoboxOptions>(
|
export function createInfobox<T extends InfoboxOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseInfobox>
|
optionsFunc: OptionsFunc<T, BaseInfobox, GenericInfobox>
|
||||||
): Infobox<T> {
|
): Infobox<T> {
|
||||||
const collapsed = persistent<boolean>(false);
|
const collapsed = persistent<boolean>(false);
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
|
|
|
@ -44,7 +44,7 @@ export type GenericLinks = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createLinks<T extends LinksOptions>(
|
export function createLinks<T extends LinksOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseLinks>
|
optionsFunc: OptionsFunc<T, BaseLinks, GenericLinks>
|
||||||
): Links<T> {
|
): Links<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const links = optionsFunc();
|
const links = optionsFunc();
|
||||||
|
|
|
@ -84,7 +84,7 @@ export type GenericMilestone = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createMilestone<T extends MilestoneOptions>(
|
export function createMilestone<T extends MilestoneOptions>(
|
||||||
optionsFunc?: OptionsFunc<T, BaseMilestone>
|
optionsFunc?: OptionsFunc<T, BaseMilestone, GenericMilestone>
|
||||||
): Milestone<T> {
|
): Milestone<T> {
|
||||||
const earned = persistent<boolean>(false);
|
const earned = persistent<boolean>(false);
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
|
|
|
@ -42,7 +42,7 @@ export type Particles<T extends ParticlesOptions> = Replace<
|
||||||
export type GenericParticles = Particles<ParticlesOptions>;
|
export type GenericParticles = Particles<ParticlesOptions>;
|
||||||
|
|
||||||
export function createParticles<T extends ParticlesOptions>(
|
export function createParticles<T extends ParticlesOptions>(
|
||||||
optionsFunc?: OptionsFunc<T, BaseParticles>
|
optionsFunc?: OptionsFunc<T, BaseParticles, GenericParticles>
|
||||||
): Particles<T> {
|
): Particles<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const particles = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
const particles = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
||||||
|
|
|
@ -31,7 +31,7 @@ export type Reset<T extends ResetOptions> = Replace<
|
||||||
export type GenericReset = Reset<ResetOptions>;
|
export type GenericReset = Reset<ResetOptions>;
|
||||||
|
|
||||||
export function createReset<T extends ResetOptions>(
|
export function createReset<T extends ResetOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseReset>
|
optionsFunc: OptionsFunc<T, BaseReset, GenericReset>
|
||||||
): Reset<T> {
|
): Reset<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const reset = optionsFunc();
|
const reset = optionsFunc();
|
||||||
|
|
|
@ -37,7 +37,9 @@ export type Tab<T extends TabOptions> = Replace<
|
||||||
|
|
||||||
export type GenericTab = Tab<TabOptions>;
|
export type GenericTab = Tab<TabOptions>;
|
||||||
|
|
||||||
export function createTab<T extends TabOptions>(optionsFunc: OptionsFunc<T, BaseTab>): Tab<T> {
|
export function createTab<T extends TabOptions>(
|
||||||
|
optionsFunc: OptionsFunc<T, BaseTab, GenericTab>
|
||||||
|
): Tab<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const tab = optionsFunc();
|
const tab = optionsFunc();
|
||||||
tab.id = getUniqueID("tab-");
|
tab.id = getUniqueID("tab-");
|
||||||
|
|
|
@ -92,7 +92,7 @@ export type GenericTabFamily = Replace<
|
||||||
|
|
||||||
export function createTabFamily<T extends TabFamilyOptions>(
|
export function createTabFamily<T extends TabFamilyOptions>(
|
||||||
tabs: Record<string, () => TabButtonOptions>,
|
tabs: Record<string, () => TabButtonOptions>,
|
||||||
optionsFunc?: OptionsFunc<T, BaseTabFamily>
|
optionsFunc?: OptionsFunc<T, BaseTabFamily, GenericTabFamily>
|
||||||
): TabFamily<T> {
|
): TabFamily<T> {
|
||||||
if (Object.keys(tabs).length === 0) {
|
if (Object.keys(tabs).length === 0) {
|
||||||
console.warn("Cannot create tab family with 0 tabs");
|
console.warn("Cannot create tab family with 0 tabs");
|
||||||
|
|
|
@ -73,7 +73,7 @@ export type GenericTreeNode = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createTreeNode<T extends TreeNodeOptions>(
|
export function createTreeNode<T extends TreeNodeOptions>(
|
||||||
optionsFunc?: OptionsFunc<T, BaseTreeNode>
|
optionsFunc?: OptionsFunc<T, BaseTreeNode, GenericTreeNode>
|
||||||
): TreeNode<T> {
|
): TreeNode<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const treeNode = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
const treeNode = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
||||||
|
@ -186,7 +186,9 @@ export type GenericTree = Replace<
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createTree<T extends TreeOptions>(optionsFunc: OptionsFunc<T, BaseTree>): Tree<T> {
|
export function createTree<T extends TreeOptions>(
|
||||||
|
optionsFunc: OptionsFunc<T, BaseTree, GenericTree>
|
||||||
|
): Tree<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const tree = optionsFunc();
|
const tree = optionsFunc();
|
||||||
tree.id = getUniqueID("tree-");
|
tree.id = getUniqueID("tree-");
|
||||||
|
|
|
@ -79,7 +79,7 @@ export type GenericUpgrade = Replace<
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export function createUpgrade<T extends UpgradeOptions>(
|
export function createUpgrade<T extends UpgradeOptions>(
|
||||||
optionsFunc: OptionsFunc<T, BaseUpgrade>
|
optionsFunc: OptionsFunc<T, BaseUpgrade, GenericUpgrade>
|
||||||
): Upgrade<T> {
|
): Upgrade<T> {
|
||||||
const bought = persistent<boolean>(false);
|
const bought = persistent<boolean>(false);
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
|
|
|
@ -18,7 +18,7 @@ export interface GlobalEvents {
|
||||||
|
|
||||||
export const globalBus = createNanoEvents<GlobalEvents>();
|
export const globalBus = createNanoEvents<GlobalEvents>();
|
||||||
|
|
||||||
let intervalID: number | null = null;
|
let intervalID: NodeJS.Timer | null = null;
|
||||||
|
|
||||||
// Not imported immediately due to dependency cycles
|
// Not imported immediately due to dependency cycles
|
||||||
// This gets set during startGameLoop(), and will only be used in the update function
|
// This gets set during startGameLoop(), and will only be used in the update function
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
jsx,
|
jsx,
|
||||||
JSXFunction,
|
JSXFunction,
|
||||||
|
OptionsFunc,
|
||||||
Replace,
|
Replace,
|
||||||
setDefault,
|
setDefault,
|
||||||
StyleValue
|
StyleValue
|
||||||
|
@ -105,7 +106,7 @@ export const persistentRefs: Record<string, Set<Persistent>> = {};
|
||||||
export const addingLayers: string[] = [];
|
export const addingLayers: string[] = [];
|
||||||
export function createLayer<T extends LayerOptions>(
|
export function createLayer<T extends LayerOptions>(
|
||||||
id: string,
|
id: string,
|
||||||
optionsFunc: (this: BaseLayer) => T & Partial<BaseLayer>
|
optionsFunc: OptionsFunc<T, BaseLayer>
|
||||||
): Layer<T> {
|
): Layer<T> {
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const layer = {} as T & Partial<BaseLayer>;
|
const layer = {} as T & Partial<BaseLayer>;
|
||||||
|
|
|
@ -1190,50 +1190,6 @@ export default class Decimal {
|
||||||
return cost.div(currentRpS).add(cost.div(deltaRpS));
|
return cost.div(currentRpS).add(cost.div(deltaRpS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public [Symbol.for("+")](other: DecimalSource): DecimalSource {
|
|
||||||
return this.add(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("-")](other: DecimalSource): DecimalSource {
|
|
||||||
return this.sub(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("*")](other: DecimalSource): DecimalSource {
|
|
||||||
return this.times(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("/")](other: DecimalSource): DecimalSource {
|
|
||||||
return this.div(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("minus")](): DecimalSource {
|
|
||||||
return this.neg();
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("==")](other: DecimalSource): boolean {
|
|
||||||
return this.eq(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for(">")](other: DecimalSource): boolean {
|
|
||||||
return this.gt(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("<")](other: DecimalSource): boolean {
|
|
||||||
return this.lt(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for(">=")](other: DecimalSource): boolean {
|
|
||||||
return this.gte(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("<=")](other: DecimalSource): boolean {
|
|
||||||
return this.lte(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public [Symbol.for("!=")](other: DecimalSource): boolean {
|
|
||||||
return this.neq(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
public normalize(): this {
|
public normalize(): this {
|
||||||
/*
|
/*
|
||||||
PSEUDOCODE:
|
PSEUDOCODE:
|
||||||
|
|
1
src/lib/collapseTransition.d.ts
vendored
Normal file
1
src/lib/collapseTransition.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
declare module '@ivanv/vue-collapse-transition/src/CollapseTransition.vue';
|
|
@ -44,7 +44,7 @@ requestAnimationFrame(async () => {
|
||||||
"padding: 4px;"
|
"padding: 4px;"
|
||||||
);
|
);
|
||||||
await load();
|
await load();
|
||||||
const { globalBus, startGameLoop } = await require("./game/events");
|
const { globalBus, startGameLoop } = await import("./game/events");
|
||||||
|
|
||||||
// Create Vue
|
// Create Vue
|
||||||
const vue = (window.vue = createApp(App));
|
const vue = (window.vue = createApp(App));
|
||||||
|
|
|
@ -119,7 +119,7 @@ export function setupHoldToClick(
|
||||||
stop: VoidFunction;
|
stop: VoidFunction;
|
||||||
handleHolding: VoidFunction;
|
handleHolding: VoidFunction;
|
||||||
} {
|
} {
|
||||||
const interval = ref<null | number>(null);
|
const interval = ref<NodeJS.Timer | null>(null);
|
||||||
const event = ref<MouseEvent | TouchEvent | undefined>(undefined);
|
const event = ref<MouseEvent | TouchEvent | undefined>(undefined);
|
||||||
|
|
||||||
function start(e: MouseEvent | TouchEvent) {
|
function start(e: MouseEvent | TouchEvent) {
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"types": [
|
"types": [
|
||||||
"webpack-env",
|
"jest",
|
||||||
"jest"
|
"vite/client"
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"esnext",
|
"esnext",
|
||||||
|
|
15
vite.config.ts
Normal file
15
vite.config.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
|
import { defineConfig } from "vite";
|
||||||
|
import tsconfigPaths from "vite-tsconfig-paths";
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
vueJsx({
|
||||||
|
// options are passed on to @vue/babel-plugin-jsx
|
||||||
|
}),
|
||||||
|
tsconfigPaths()
|
||||||
|
]
|
||||||
|
});
|
|
@ -1,17 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
|
|
||||||
runtimeCompiler: true,
|
|
||||||
chainWebpack(config) {
|
|
||||||
config.resolve.alias.delete("@");
|
|
||||||
config.resolve
|
|
||||||
.plugin("tsconfig-paths")
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
||||||
.use(require("tsconfig-paths-webpack-plugin"));
|
|
||||||
// Remove this if/when all "core" code has no non-ignored more type errors
|
|
||||||
// https://github.com/vuejs/vue-cli/issues/3157#issuecomment-657090338
|
|
||||||
config.plugins.delete("fork-ts-checker");
|
|
||||||
},
|
|
||||||
devServer: {
|
|
||||||
allowedHosts: "all"
|
|
||||||
}
|
|
||||||
};
|
|
Loading…
Reference in a new issue