Implement Board and Feature Rewrites #88
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: profectus/Profectus#88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "thepaperpilot/Profectus:feature/feat-and-board-rewrite"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The feature rewrite and board rewrite had to be merged together, and both had a lot of bug fixes done during the process of updating the demo project. So I merged them into this one PR, which now has a very long changelog.
jsx()andJSXFunction. You can now useJSX.Elementlike any otherComputablevaluejoinJSXnow always requires a joiner. Just pass the array of elements or wrap them in<>and</>if there's no joinercoerceComponent,computeComponent, andcomputeOptionalComponent; just use therenderfunction now<MyComponent />instead of<component :is="myComponent" />forceHideGoBacknot being respecteddeepUnrefas now things don't get unreffed before being passed into vue components by defaultmarkpropertiesmergeAdjacentnow works with rows and cols inside each other (perhaps should've used scss to reduce the amount of css this took)CoercableComponentrenamed toRenderablesince it should be used withrenderisCoercableComponentwithisJSXElementComputableandProcessedComputablewith the vue built-insMaybeRefOrGetterandMaybeRefconvertComputablerenamed toprocessGetterGetComputableTypeWithDefaultandGetComputableType, which can similarly be replaceddontMergeis now a property on rows and columns rather than an undocumented css class you'd have to include on every feature within the row or columnvueFeatureMixinfor simplifying the vue specific parts of a feature. Passes the component's properties in explicitly and directly from the feature itselfrenderfunctions now returnJSX.Element. TheJSXvariants (e.g.renderJSX) (exceptjoinJSX) have been removedsmallproperty from clickable, since its a single css rule (min-height: unset) (you could add a small css class and pass small to any vue feature's classes property, though)??=MaybeGetterutility type for something that may be a getter function or a static value (but not a ref)createAchievementcreateChallengeFixes #1, #2, #48, #45, #44, #15, #62.
Associated docs PR: profectus/profectus-docs#13
feature/feat-and-board-rewriteto Implement Board and Feature RewritesTons of changes here, so many files completely rewritten, insane amount of work done in here. Most of the changes were at least similar - reworking boards, removing JSX, bringing display computations out of the Vue components and into their typescript counterparts, and of course simplifying the feature structure to not need so much processing and type coercion. After cutting out all the "duplicate" changes, I'm only seeing a couple little issues, all outside the main bulk of this PR.
@ -66,0 +42,4 @@nodes: Layer["nodes"];forceHideGoBack: Layer["forceHideGoBack"];index: number;}>();Since we're just grabbing the types from the Layer here rather than writing in their types directly, is there a reason we don't just do
defineProps<Layer & { index: number }>();instead?Same logic would apply to other similarly-defined Vue files - Achievement, Bar, Challenge, etc.
Unfortunately, whenever I tried doing that, the props wouldn't get properly recognized and the build would fail with this error:
[plugin:vite:vue] [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility typeI know there's limitations on the types you can use directly, but honestly I'd expect these to work - they're just interfaces and the only utility type they tend to use is MaybeRef, a vue builtin. As you can see, connecting the properties directly works fine so I don't think its an issue with the MaybeRefs.
Ah, yeah, I'm getting weird errors when I try to do the same - some files I can make that change, others refuse to function.
@ -35,3 +31,4 @@// Note: Casting as generic tree to avoid recursive type definitionsconst tree = createTree(() => ({nodes: [[prestige.treeNode]],Not sure if it's a result of this PR or not, but this causes the node's tooltip's
pinnedto be saved in two different locations.Ah, actually I was missing a noPersist around the nodes array. I did that in the demo and mention it in the docs, but didn't do it in the base project itself 💀.
@ -13,36 +13,7 @@ exports[`Additive Modifiers > applies description correctly > with description 1"anchor": null,"appContext": null,"children": [{I'm not sure this file should exist, seems like temporary internal test data?
It should. Several of the tests just check that
displaycomponents match the existing snapshots, since it can't really test that they render the same. The docs clarify the snapshots belong in version control here: https://vitest.dev/guide/snapshot#use-snapshotsGoing through this quickly one more time, have noticed a couple more things that should be quick to fix - then this'll all be good to go!
@ -82,3 +80,1 @@const infoComponent = computed(() => {return coerceComponent(jsx(() => (<>{infoComponents.map(render)}</>)));});const Info = () => infoComponents.map(f => render(f));This field name is overlapping with the component name, so while it seems to build fine, VSCode is expecting the template to contain a
changelogprop, and I don't see any way to guarantee Vue will handle it properly either.@ -35,0 +19,4 @@import { isJSXElement, render } from "util/vue";import { Component, isRef, unref } from "vue";import { Achievement } from "./achievement";import { displayRequirements } from "game/requirements";One and only file with unused imports, just needs a quick little cleanup
Thanks, cleaned up those files