From 46702582415d10dd3d9addeccb6e1e6739c53a22 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 15 Jul 2022 17:27:51 -0500 Subject: [PATCH 1/6] Moved section into its own interface --- src/data/common.tsx | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/data/common.tsx b/src/data/common.tsx index 27cf420..d44b91d 100644 --- a/src/data/common.tsx +++ b/src/data/common.tsx @@ -232,28 +232,30 @@ export function createLayerTreeNode( }) as unknown as LayerTreeNode; } +/** An option object for a modifier display as a single section. **/ +export interface Section { + /** The header for this modifier. **/ + title: string; + /** A subtitle for this modifier, e.g. to explain the context for the modifier. **/ + subtitle?: string; + /** The modifier to be displaying in this section. **/ + modifier: WithRequired; + /** The base value being modified. **/ + base?: Computable; + /** The unit of measurement for the base. **/ + unit?: string; + /** The label to call the base amount. Defaults to "Base". **/ + baseText?: Computable; + /** Whether or not this section should be currently visible to the player. **/ + visible?: Computable; +} + /** * Takes an array of modifier "sections", and creates a JSXFunction that can render all those sections, and allow each section to be collapsed. * Also returns a list of persistent refs that are used to control which sections are currently collapsed. - * @param sections An array of options objects for each section to display. - * @param sections.title The header for this modifier. - * @param sections.subtitle A subtitle for this modifier, e.g. to explain the context for the modifier. - * @param sections.modifier The modifier to be displaying in this section. - * @param sections.base The base value being modified. - * @param sections.unit The unit of measurement for the base. - * @param sections.baseText The label to call the base amount. - * @param sections.visible Whether or not this section should be currently visible to the player. */ export function createCollapsibleModifierSections( - sections: { - title: string; - subtitle?: string; - modifier: WithRequired; - base?: Computable; - unit?: string; - baseText?: Computable; - visible?: Computable; - }[] + sections: Section[] ): [JSXFunction, Persistent[]] { const processedBase = sections.map(s => convertComputable(s.base)); const processedBaseText = sections.map(s => convertComputable(s.baseText)); From 9202fa174a62d8c84ed1c529813d88d51ff9d471 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 15 Jul 2022 01:58:23 -0500 Subject: [PATCH 2/6] Enable runtime compilation --- vite.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index 5d1c6a8..67a030d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -19,6 +19,11 @@ export default defineConfig({ } } }, + resolve: { + alias: { + vue: 'vue/dist/vue.esm-bundler.js' + } + }, plugins: [ vue(), vueJsx({ From 7d1346746fd245042d6de8a94bceb39e6a977d4c Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 17 Jul 2022 19:27:53 -0500 Subject: [PATCH 3/6] Fix trackResetTime not working after the layer is removed and re-added --- src/features/reset.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/features/reset.ts b/src/features/reset.ts index d3b373b..3a724e3 100644 --- a/src/features/reset.ts +++ b/src/features/reset.ts @@ -69,8 +69,13 @@ export function createReset( const listeners: Record = {}; export function trackResetTime(layer: BaseLayer, reset: GenericReset): Persistent { const resetTime = persistent(new Decimal(0)); - listeners[layer.id] = layer.on("preUpdate", diff => { - resetTime.value = Decimal.add(resetTime.value, diff); + globalBus.on("addLayer", layerBeingAdded => { + if (layer === layerBeingAdded) { + listeners[layer.id]?.(); + listeners[layer.id] = layer.on("preUpdate", diff => { + resetTime.value = Decimal.add(resetTime.value, diff); + }); + } }); globalBus.on("reset", currentReset => { if (currentReset === reset) { From ba47847e39d19bb2e7175563721f0be7ccd6bb60 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 17 Jul 2022 20:21:03 -0500 Subject: [PATCH 4/6] Fix LayerData typing for handling arrays --- src/game/player.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/player.ts b/src/game/player.ts index aa4e789..6271629 100644 --- a/src/game/player.ts +++ b/src/game/player.ts @@ -42,7 +42,7 @@ export type Player = ProxiedWithState; /** A layer's save data. Automatically unwraps refs. */ export type LayerData = { [P in keyof T]?: T[P] extends (infer U)[] - ? LayerData[] + ? Record> : T[P] extends Record ? never : T[P] extends Ref From 134520946112c791b006f5ab175330f0e6238b79 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 17 Jul 2022 21:32:32 -0500 Subject: [PATCH 5/6] Made colorText return JSX Element --- src/data/common.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/common.tsx b/src/data/common.tsx index d44b91d..f392741 100644 --- a/src/data/common.tsx +++ b/src/data/common.tsx @@ -316,6 +316,6 @@ export function createCollapsibleModifierSections( * @param textToColor The content to change the color of * @param color The color to change the content to look like. Defaults to the current theme's accent 2 variable. */ -export function colorText(textToColor: string, color = "var(--accent2)"): string { - return `${textToColor}`; +export function colorText(textToColor: string, color = "var(--accent2)"): JSX.Element { + return ${textToColor}; } From 013092fff37e79b2f14d7b4f8f064584270af2e3 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 17 Jul 2022 21:35:23 -0500 Subject: [PATCH 6/6] Bump version --- CHANGELOG.md | 41 +++++++++++++++++++++++++++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26e00f5..849ed9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.1] - 2022-07-17 +### Added +- Notif component that displays a jumping exclamation point +- showAmount boolean to buyable displays +- Tab families now take option to style the tab buttons container +- Utility for creating text of a certain color +### Changed +- Improved typing of player.layers +- Improved typing of createCollapsibleModifierSections's parameters +- Made Particles vue component typed as GenericComponent due to issues generating documentation +- Minimized how much of pixi.js is included in the built site +- Split bundles into smaller bundles for faster loading +- Updated TypeScript +- Descriptions on buyables are now optional +- Improved tooltips performance +- Improved how MainDisplay displays effect strings +- MainDisplays are now sticky +- processComputable now binds uncached functions as well +### Fixed +- trackResetTime stopped working once its layer was removed and re-added +- Runtime compilation was disabled in vite config +- Websites had to be hosted on root directory to have assets load correctly +- Tooltips' persistent ref was lazily created +- In some situations Links would not update its bounding rect +- Achievements' and milestones' onComplete callbacks were firing on load +- Processed JSXFunctions were not considered coercable components by isCoercableComponent +- Error from passing in overlay text to bar component +### Removed +- lodash.cloneDeep dependency, which hasn't been used in awhile +- Some unused configs from vue-cli-service +### Documented +- Update vitepress, and updated the content of many pages +- Rest of /game +- Rest of /data +- layers.tsx +- Any type augmentations to Window object +- Various cleanup of docs comments +- Fixed doc generation being broken from switch to vite +### Tests +- Switched from jest to vitest + ## [0.5.0] - 2022-06-27 ### Added - Projects now cache for offline play, and show notification when an update is available diff --git a/package-lock.json b/package-lock.json index 0820549..a12d4ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "profectus", - "version": "0.5.0", + "version": "0.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "profectus", - "version": "0.5.0", + "version": "0.5.1", "dependencies": { "@pixi/app": "^6.4.2", "@pixi/core": "^6.4.2", diff --git a/package.json b/package.json index 103de9b..4d327dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "profectus", - "version": "0.5.0", + "version": "0.5.1", "private": true, "scripts": { "start": "vite",