Fix features not handling refs passed to style props correctly

This commit is contained in:
thepaperpilot 2022-03-13 17:09:09 -05:00
parent de4bb44e02
commit acc9622d49
10 changed files with 22 additions and 11 deletions

View file

@ -91,7 +91,7 @@ export function createAchievement<T extends AchievementOptions>(
achievement[GatherProps] = function (this: GenericAchievement) { achievement[GatherProps] = function (this: GenericAchievement) {
const { visibility, display, earned, image, style, classes, mark, id } = this; const { visibility, display, earned, image, style, classes, mark, id } = this;
return { visibility, display, earned, image, style, classes, mark, id }; return { visibility, display, earned, image, style: unref(style), classes, mark, id };
}; };
if (achievement.shouldEarn) { if (achievement.shouldEarn) {

View file

@ -18,6 +18,7 @@ import {
ProcessedComputable ProcessedComputable
} from "util/computed"; } from "util/computed";
import { createLazyProxy } from "util/proxies"; import { createLazyProxy } from "util/proxies";
import { unref } from "vue";
export const BarType = Symbol("Bar"); export const BarType = Symbol("Bar");
@ -124,7 +125,7 @@ export function createBar<T extends BarOptions>(optionsFunc: () => T & ThisType<
direction, direction,
display, display,
visibility, visibility,
style, style: unref(style),
classes, classes,
borderStyle, borderStyle,
textStyle, textStyle,

View file

@ -316,7 +316,7 @@ export function createBoard<T extends BoardOptions>(
visibility, visibility,
width, width,
height, height,
style, style: unref(style),
classes, classes,
links, links,
selectedAction, selectedAction,

View file

@ -226,7 +226,17 @@ export function createBuyable<T extends BuyableOptions>(
buyable[GatherProps] = function (this: GenericBuyable) { buyable[GatherProps] = function (this: GenericBuyable) {
const { display, visibility, style, classes, onClick, canClick, small, mark, id } = const { display, visibility, style, classes, onClick, canClick, small, mark, id } =
this; this;
return { display, visibility, style, classes, onClick, canClick, small, mark, id }; return {
display,
visibility,
style: unref(style),
classes,
onClick,
canClick,
small,
mark,
id
};
}; };
return buyable as unknown as Buyable<T>; return buyable as unknown as Buyable<T>;

View file

@ -247,7 +247,7 @@ export function createChallenge<T extends ChallengeOptions>(
canComplete, canComplete,
display, display,
visibility, visibility,
style, style: unref(style),
classes, classes,
completed, completed,
canStart, canStart,

View file

@ -119,7 +119,7 @@ export function createClickable<T extends ClickableOptions>(
return { return {
display, display,
visibility, visibility,
style, style: unref(style),
classes, classes,
onClick, onClick,
onHold, onHold,

View file

@ -17,7 +17,7 @@ import {
ProcessedComputable ProcessedComputable
} from "util/computed"; } from "util/computed";
import { createLazyProxy } from "util/proxies"; import { createLazyProxy } from "util/proxies";
import { Ref } from "vue"; import { Ref, unref } from "vue";
import { Persistent, makePersistent, PersistentState } from "game/persistence"; import { Persistent, makePersistent, PersistentState } from "game/persistence";
export const InfoboxType = Symbol("Infobox"); export const InfoboxType = Symbol("Infobox");
@ -103,7 +103,7 @@ export function createInfobox<T extends InfoboxOptions>(
title, title,
color, color,
collapsed, collapsed,
style, style: unref(style),
titleStyle, titleStyle,
bodyStyle, bodyStyle,
classes, classes,

View file

@ -134,7 +134,7 @@ export function createMilestone<T extends MilestoneOptions>(
milestone[GatherProps] = function (this: GenericMilestone) { milestone[GatherProps] = function (this: GenericMilestone) {
const { visibility, display, style, classes, earned, id } = this; const { visibility, display, style, classes, earned, id } = this;
return { visibility, display, style, classes, earned, id }; return { visibility, display, style: unref(style), classes, earned, id };
}; };
if (milestone.shouldEarn) { if (milestone.shouldEarn) {

View file

@ -145,7 +145,7 @@ export function createTabFamily<T extends TabFamilyOptions>(
tabFamily[GatherProps] = function (this: GenericTabFamily) { tabFamily[GatherProps] = function (this: GenericTabFamily) {
const { visibility, activeTab, selected, tabs, style, classes } = this; const { visibility, activeTab, selected, tabs, style, classes } = this;
return { visibility, activeTab, selected, tabs, style, classes }; return { visibility, activeTab, selected, tabs, style: unref(style), classes };
}; };
// This is necessary because board.types is different from T and TabFamily // This is necessary because board.types is different from T and TabFamily

View file

@ -154,7 +154,7 @@ export function createUpgrade<T extends UpgradeOptions>(
return { return {
display, display,
visibility, visibility,
style, style: unref(style),
classes, classes,
resource, resource,
cost, cost,