mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-25 17:59:59 +00:00
Make every component use GenericComponent
some projects seem to require this and others not?
This commit is contained in:
parent
804d48ae80
commit
f717fe8db2
14 changed files with 84 additions and 41 deletions
|
@ -3,6 +3,7 @@ import {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
Component,
|
Component,
|
||||||
GatherProps,
|
GatherProps,
|
||||||
|
GenericComponent,
|
||||||
getUniqueID,
|
getUniqueID,
|
||||||
isVisible,
|
isVisible,
|
||||||
OptionsFunc,
|
OptionsFunc,
|
||||||
|
@ -48,7 +49,7 @@ export interface BaseAchievement {
|
||||||
earned: Persistent<boolean>;
|
earned: Persistent<boolean>;
|
||||||
complete: VoidFunction;
|
complete: VoidFunction;
|
||||||
type: typeof AchievementType;
|
type: typeof AchievementType;
|
||||||
[Component]: typeof AchievementComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ export function createAchievement<T extends AchievementOptions>(
|
||||||
const achievement = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
const achievement = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
||||||
achievement.id = getUniqueID("achievement-");
|
achievement.id = getUniqueID("achievement-");
|
||||||
achievement.type = AchievementType;
|
achievement.type = AchievementType;
|
||||||
achievement[Component] = AchievementComponent;
|
achievement[Component] = AchievementComponent as GenericComponent;
|
||||||
|
|
||||||
achievement.earned = earned;
|
achievement.earned = earned;
|
||||||
achievement.complete = function () {
|
achievement.complete = function () {
|
||||||
|
|
|
@ -40,7 +40,7 @@ export interface BarOptions {
|
||||||
export interface BaseBar {
|
export interface BaseBar {
|
||||||
id: string;
|
id: string;
|
||||||
type: typeof BarType;
|
type: typeof BarType;
|
||||||
[Component]: typeof BarComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ export function createBar<T extends BarOptions>(
|
||||||
const bar = optionsFunc();
|
const bar = optionsFunc();
|
||||||
bar.id = getUniqueID("bar-");
|
bar.id = getUniqueID("bar-");
|
||||||
bar.type = BarType;
|
bar.type = BarType;
|
||||||
bar[Component] = BarComponent;
|
bar[Component] = BarComponent as GenericComponent;
|
||||||
|
|
||||||
processComputable(bar as T, "visibility");
|
processComputable(bar as T, "visibility");
|
||||||
setDefault(bar, "visibility", Visibility.Visible);
|
setDefault(bar, "visibility", Visibility.Visible);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import BoardComponent from "features/boards/Board.vue";
|
import BoardComponent from "features/boards/Board.vue";
|
||||||
import type { OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type { GenericComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
findFeatures,
|
findFeatures,
|
||||||
|
@ -178,7 +178,7 @@ export interface BaseBoard {
|
||||||
selectedAction: Ref<GenericBoardNodeAction | null>;
|
selectedAction: Ref<GenericBoardNodeAction | null>;
|
||||||
mousePosition: Ref<{ x: number; y: number } | null>;
|
mousePosition: Ref<{ x: number; y: number } | null>;
|
||||||
type: typeof BoardType;
|
type: typeof BoardType;
|
||||||
[Component]: typeof BoardComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ export function createBoard<T extends BoardOptions>(
|
||||||
const board = optionsFunc();
|
const board = optionsFunc();
|
||||||
board.id = getUniqueID("board-");
|
board.id = getUniqueID("board-");
|
||||||
board.type = BoardType;
|
board.type = BoardType;
|
||||||
board[Component] = BoardComponent;
|
board[Component] = BoardComponent as GenericComponent;
|
||||||
|
|
||||||
if (board.state) {
|
if (board.state) {
|
||||||
deletePersistent(state);
|
deletePersistent(state);
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
import { isArray } from "@vue/shared";
|
import { isArray } from "@vue/shared";
|
||||||
import Toggle from "components/fields/Toggle.vue";
|
import Toggle from "components/fields/Toggle.vue";
|
||||||
import ChallengeComponent from "features/challenges/Challenge.vue";
|
import ChallengeComponent from "features/challenges/Challenge.vue";
|
||||||
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type {
|
||||||
|
CoercableComponent,
|
||||||
|
GenericComponent,
|
||||||
|
OptionsFunc,
|
||||||
|
Replace,
|
||||||
|
StyleValue
|
||||||
|
} from "features/feature";
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
GatherProps,
|
GatherProps,
|
||||||
|
@ -67,7 +73,7 @@ export interface BaseChallenge {
|
||||||
toggle: VoidFunction;
|
toggle: VoidFunction;
|
||||||
complete: (remainInChallenge?: boolean) => void;
|
complete: (remainInChallenge?: boolean) => void;
|
||||||
type: typeof ChallengeType;
|
type: typeof ChallengeType;
|
||||||
[Component]: typeof ChallengeComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +112,7 @@ export function createChallenge<T extends ChallengeOptions>(
|
||||||
|
|
||||||
challenge.id = getUniqueID("challenge-");
|
challenge.id = getUniqueID("challenge-");
|
||||||
challenge.type = ChallengeType;
|
challenge.type = ChallengeType;
|
||||||
challenge[Component] = ChallengeComponent;
|
challenge[Component] = ChallengeComponent as GenericComponent;
|
||||||
|
|
||||||
challenge.completions = completions;
|
challenge.completions = completions;
|
||||||
challenge.active = active;
|
challenge.active = active;
|
||||||
|
|
|
@ -42,7 +42,7 @@ export interface ClickableOptions {
|
||||||
export interface BaseClickable {
|
export interface BaseClickable {
|
||||||
id: string;
|
id: string;
|
||||||
type: typeof ClickableType;
|
type: typeof ClickableType;
|
||||||
[Component]: typeof ClickableComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ export function createClickable<T extends ClickableOptions>(
|
||||||
const clickable = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
const clickable = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
||||||
clickable.id = getUniqueID("clickable-");
|
clickable.id = getUniqueID("clickable-");
|
||||||
clickable.type = ClickableType;
|
clickable.type = ClickableType;
|
||||||
clickable[Component] = ClickableComponent;
|
clickable[Component] = ClickableComponent as GenericComponent;
|
||||||
|
|
||||||
processComputable(clickable as T, "visibility");
|
processComputable(clickable as T, "visibility");
|
||||||
setDefault(clickable, "visibility", Visibility.Visible);
|
setDefault(clickable, "visibility", Visibility.Visible);
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type {
|
||||||
|
CoercableComponent,
|
||||||
|
GenericComponent,
|
||||||
|
OptionsFunc,
|
||||||
|
Replace,
|
||||||
|
StyleValue
|
||||||
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
||||||
import GridComponent from "features/grids/Grid.vue";
|
import GridComponent from "features/grids/Grid.vue";
|
||||||
import type { Persistent, State } from "game/persistence";
|
import type { Persistent, State } from "game/persistence";
|
||||||
|
@ -206,7 +212,7 @@ export interface BaseGrid {
|
||||||
cells: Record<string | number, GridCell>;
|
cells: Record<string | number, GridCell>;
|
||||||
cellState: Persistent<Record<string | number, State>>;
|
cellState: Persistent<Record<string | number, State>>;
|
||||||
type: typeof GridType;
|
type: typeof GridType;
|
||||||
[Component]: typeof GridComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +248,7 @@ export function createGrid<T extends GridOptions>(
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const grid = optionsFunc();
|
const grid = optionsFunc();
|
||||||
grid.id = getUniqueID("grid-");
|
grid.id = getUniqueID("grid-");
|
||||||
grid[Component] = GridComponent;
|
grid[Component] = GridComponent as GenericComponent;
|
||||||
|
|
||||||
grid.cellState = cellState;
|
grid.cellState = cellState;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type {
|
||||||
|
CoercableComponent,
|
||||||
|
GenericComponent,
|
||||||
|
OptionsFunc,
|
||||||
|
Replace,
|
||||||
|
StyleValue
|
||||||
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
||||||
import InfoboxComponent from "features/infoboxes/Infobox.vue";
|
import InfoboxComponent from "features/infoboxes/Infobox.vue";
|
||||||
import type { Persistent } from "game/persistence";
|
import type { Persistent } from "game/persistence";
|
||||||
|
@ -30,7 +36,7 @@ export interface BaseInfobox {
|
||||||
id: string;
|
id: string;
|
||||||
collapsed: Persistent<boolean>;
|
collapsed: Persistent<boolean>;
|
||||||
type: typeof InfoboxType;
|
type: typeof InfoboxType;
|
||||||
[Component]: typeof InfoboxComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +69,7 @@ export function createInfobox<T extends InfoboxOptions>(
|
||||||
const infobox = optionsFunc();
|
const infobox = optionsFunc();
|
||||||
infobox.id = getUniqueID("infobox-");
|
infobox.id = getUniqueID("infobox-");
|
||||||
infobox.type = InfoboxType;
|
infobox.type = InfoboxType;
|
||||||
infobox[Component] = InfoboxComponent;
|
infobox[Component] = InfoboxComponent as GenericComponent;
|
||||||
|
|
||||||
infobox.collapsed = collapsed;
|
infobox.collapsed = collapsed;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { OptionsFunc, Replace } from "features/feature";
|
import type { GenericComponent, OptionsFunc, Replace } from "features/feature";
|
||||||
import { GatherProps, Component } from "features/feature";
|
import { GatherProps, Component } from "features/feature";
|
||||||
import type { Position } from "game/layers";
|
import type { Position } from "game/layers";
|
||||||
import type { Computable, GetComputableType, ProcessedComputable } from "util/computed";
|
import type { Computable, GetComputableType, ProcessedComputable } from "util/computed";
|
||||||
|
@ -22,7 +22,7 @@ export interface LinksOptions {
|
||||||
|
|
||||||
export interface BaseLinks {
|
export interface BaseLinks {
|
||||||
type: typeof LinksType;
|
type: typeof LinksType;
|
||||||
[Component]: typeof LinksComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ export function createLinks<T extends LinksOptions>(
|
||||||
return createLazyProxy(() => {
|
return createLazyProxy(() => {
|
||||||
const links = optionsFunc();
|
const links = optionsFunc();
|
||||||
links.type = LinksType;
|
links.type = LinksType;
|
||||||
links[Component] = LinksComponent;
|
links[Component] = LinksComponent as GenericComponent;
|
||||||
|
|
||||||
processComputable(links as T, "links");
|
processComputable(links as T, "links");
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ export interface BaseMilestone {
|
||||||
earned: Persistent<boolean>;
|
earned: Persistent<boolean>;
|
||||||
complete: VoidFunction;
|
complete: VoidFunction;
|
||||||
type: typeof MilestoneType;
|
type: typeof MilestoneType;
|
||||||
[Component]: typeof MilestoneComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ export function createMilestone<T extends MilestoneOptions>(
|
||||||
const milestone = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
const milestone = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
||||||
milestone.id = getUniqueID("milestone-");
|
milestone.id = getUniqueID("milestone-");
|
||||||
milestone.type = MilestoneType;
|
milestone.type = MilestoneType;
|
||||||
milestone[Component] = MilestoneComponent;
|
milestone[Component] = MilestoneComponent as GenericComponent;
|
||||||
|
|
||||||
milestone.earned = earned;
|
milestone.earned = earned;
|
||||||
milestone.complete = function () {
|
milestone.complete = function () {
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
import { isArray } from "@vue/shared";
|
import { isArray } from "@vue/shared";
|
||||||
import ClickableComponent from "features/clickables/Clickable.vue";
|
import ClickableComponent from "features/clickables/Clickable.vue";
|
||||||
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type {
|
||||||
|
CoercableComponent,
|
||||||
|
GenericComponent,
|
||||||
|
OptionsFunc,
|
||||||
|
Replace,
|
||||||
|
StyleValue
|
||||||
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID, jsx, setDefault, Visibility } from "features/feature";
|
import { Component, GatherProps, getUniqueID, jsx, setDefault, Visibility } from "features/feature";
|
||||||
import { DefaultValue, Persistent, persistent } from "game/persistence";
|
import { DefaultValue, Persistent, persistent } from "game/persistence";
|
||||||
import {
|
import {
|
||||||
|
@ -88,7 +94,7 @@ export interface BaseRepeatable {
|
||||||
/** A symbol that helps identify features of the same type. */
|
/** A symbol that helps identify features of the same type. */
|
||||||
type: typeof RepeatableType;
|
type: typeof RepeatableType;
|
||||||
/** The Vue component used to render this feature. */
|
/** The Vue component used to render this feature. */
|
||||||
[Component]: typeof ClickableComponent;
|
[Component]: GenericComponent;
|
||||||
/** A function to gather the props the vue component requires for this feature. */
|
/** A function to gather the props the vue component requires for this feature. */
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +137,7 @@ export function createRepeatable<T extends RepeatableOptions>(
|
||||||
|
|
||||||
repeatable.id = getUniqueID("repeatable-");
|
repeatable.id = getUniqueID("repeatable-");
|
||||||
repeatable.type = RepeatableType;
|
repeatable.type = RepeatableType;
|
||||||
repeatable[Component] = ClickableComponent;
|
repeatable[Component] = ClickableComponent as GenericComponent;
|
||||||
|
|
||||||
repeatable.amount = amount;
|
repeatable.amount = amount;
|
||||||
repeatable.amount[DefaultValue] = repeatable.initialAmount ?? 0;
|
repeatable.amount[DefaultValue] = repeatable.initialAmount ?? 0;
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type {
|
||||||
|
CoercableComponent,
|
||||||
|
GenericComponent,
|
||||||
|
OptionsFunc,
|
||||||
|
Replace,
|
||||||
|
StyleValue
|
||||||
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID } from "features/feature";
|
import { Component, GatherProps, getUniqueID } from "features/feature";
|
||||||
import TabComponent from "features/tabs/Tab.vue";
|
import TabComponent from "features/tabs/Tab.vue";
|
||||||
import type { Computable, GetComputableType } from "util/computed";
|
import type { Computable, GetComputableType } from "util/computed";
|
||||||
|
@ -15,7 +21,7 @@ export interface TabOptions {
|
||||||
export interface BaseTab {
|
export interface BaseTab {
|
||||||
id: string;
|
id: string;
|
||||||
type: typeof TabType;
|
type: typeof TabType;
|
||||||
[Component]: typeof TabComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +43,7 @@ export function createTab<T extends TabOptions>(
|
||||||
const tab = optionsFunc();
|
const tab = optionsFunc();
|
||||||
tab.id = getUniqueID("tab-");
|
tab.id = getUniqueID("tab-");
|
||||||
tab.type = TabType;
|
tab.type = TabType;
|
||||||
tab[Component] = TabComponent;
|
tab[Component] = TabComponent as GenericComponent;
|
||||||
|
|
||||||
tab[GatherProps] = function (this: GenericTab) {
|
tab[GatherProps] = function (this: GenericTab) {
|
||||||
const { display } = this;
|
const { display } = this;
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type {
|
||||||
|
CoercableComponent,
|
||||||
|
GenericComponent,
|
||||||
|
OptionsFunc,
|
||||||
|
Replace,
|
||||||
|
StyleValue
|
||||||
|
} from "features/feature";
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
GatherProps,
|
GatherProps,
|
||||||
|
@ -37,7 +43,7 @@ export interface TabButtonOptions {
|
||||||
|
|
||||||
export interface BaseTabButton {
|
export interface BaseTabButton {
|
||||||
type: typeof TabButtonType;
|
type: typeof TabButtonType;
|
||||||
[Component]: typeof TabButtonComponent;
|
[Component]: GenericComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TabButton<T extends TabButtonOptions> = Replace<
|
export type TabButton<T extends TabButtonOptions> = Replace<
|
||||||
|
@ -73,7 +79,7 @@ export interface BaseTabFamily {
|
||||||
activeTab: Ref<GenericTab | CoercableComponent | null>;
|
activeTab: Ref<GenericTab | CoercableComponent | null>;
|
||||||
selected: Persistent<string>;
|
selected: Persistent<string>;
|
||||||
type: typeof TabFamilyType;
|
type: typeof TabFamilyType;
|
||||||
[Component]: typeof TabFamilyComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,13 +113,13 @@ export function createTabFamily<T extends TabFamilyOptions>(
|
||||||
|
|
||||||
tabFamily.id = getUniqueID("tabFamily-");
|
tabFamily.id = getUniqueID("tabFamily-");
|
||||||
tabFamily.type = TabFamilyType;
|
tabFamily.type = TabFamilyType;
|
||||||
tabFamily[Component] = TabFamilyComponent;
|
tabFamily[Component] = TabFamilyComponent as GenericComponent;
|
||||||
|
|
||||||
tabFamily.tabs = Object.keys(tabs).reduce<Record<string, GenericTabButton>>(
|
tabFamily.tabs = Object.keys(tabs).reduce<Record<string, GenericTabButton>>(
|
||||||
(parsedTabs, tab) => {
|
(parsedTabs, tab) => {
|
||||||
const tabButton: TabButtonOptions & Partial<BaseTabButton> = tabs[tab]();
|
const tabButton: TabButtonOptions & Partial<BaseTabButton> = tabs[tab]();
|
||||||
tabButton.type = TabButtonType;
|
tabButton.type = TabButtonType;
|
||||||
tabButton[Component] = TabButtonComponent;
|
tabButton[Component] = TabButtonComponent as GenericComponent;
|
||||||
|
|
||||||
processComputable(tabButton as TabButtonOptions, "visibility");
|
processComputable(tabButton as TabButtonOptions, "visibility");
|
||||||
setDefault(tabButton, "visibility", Visibility.Visible);
|
setDefault(tabButton, "visibility", Visibility.Visible);
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import type { CoercableComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
|
import type {
|
||||||
|
CoercableComponent,
|
||||||
|
GenericComponent,
|
||||||
|
OptionsFunc,
|
||||||
|
Replace,
|
||||||
|
StyleValue
|
||||||
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
||||||
import type { Link } from "features/links/links";
|
import type { Link } from "features/links/links";
|
||||||
import type { GenericReset } from "features/reset";
|
import type { GenericReset } from "features/reset";
|
||||||
|
@ -39,7 +45,7 @@ export interface TreeNodeOptions {
|
||||||
export interface BaseTreeNode {
|
export interface BaseTreeNode {
|
||||||
id: string;
|
id: string;
|
||||||
type: typeof TreeNodeType;
|
type: typeof TreeNodeType;
|
||||||
[Component]: typeof TreeNodeComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +78,7 @@ export function createTreeNode<T extends TreeNodeOptions>(
|
||||||
const treeNode = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
const treeNode = optionsFunc?.() ?? ({} as ReturnType<NonNullable<typeof optionsFunc>>);
|
||||||
treeNode.id = getUniqueID("treeNode-");
|
treeNode.id = getUniqueID("treeNode-");
|
||||||
treeNode.type = TreeNodeType;
|
treeNode.type = TreeNodeType;
|
||||||
treeNode[Component] = TreeNodeComponent;
|
treeNode[Component] = TreeNodeComponent as GenericComponent;
|
||||||
|
|
||||||
processComputable(treeNode as T, "visibility");
|
processComputable(treeNode as T, "visibility");
|
||||||
setDefault(treeNode, "visibility", Visibility.Visible);
|
setDefault(treeNode, "visibility", Visibility.Visible);
|
||||||
|
@ -157,7 +163,7 @@ export interface BaseTree {
|
||||||
isResetting: Ref<boolean>;
|
isResetting: Ref<boolean>;
|
||||||
resettingNode: Ref<GenericTreeNode | null>;
|
resettingNode: Ref<GenericTreeNode | null>;
|
||||||
type: typeof TreeType;
|
type: typeof TreeType;
|
||||||
[Component]: typeof TreeComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +192,7 @@ export function createTree<T extends TreeOptions>(
|
||||||
const tree = optionsFunc();
|
const tree = optionsFunc();
|
||||||
tree.id = getUniqueID("tree-");
|
tree.id = getUniqueID("tree-");
|
||||||
tree.type = TreeType;
|
tree.type = TreeType;
|
||||||
tree[Component] = TreeComponent;
|
tree[Component] = TreeComponent as GenericComponent;
|
||||||
|
|
||||||
tree.isResetting = ref(false);
|
tree.isResetting = ref(false);
|
||||||
tree.resettingNode = shallowRef(null);
|
tree.resettingNode = shallowRef(null);
|
||||||
|
|
|
@ -61,7 +61,7 @@ export interface BaseUpgrade {
|
||||||
canPurchase: Ref<boolean>;
|
canPurchase: Ref<boolean>;
|
||||||
purchase: VoidFunction;
|
purchase: VoidFunction;
|
||||||
type: typeof UpgradeType;
|
type: typeof UpgradeType;
|
||||||
[Component]: typeof UpgradeComponent;
|
[Component]: GenericComponent;
|
||||||
[GatherProps]: () => Record<string, unknown>;
|
[GatherProps]: () => Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ export function createUpgrade<T extends UpgradeOptions>(
|
||||||
const upgrade = optionsFunc();
|
const upgrade = optionsFunc();
|
||||||
upgrade.id = getUniqueID("upgrade-");
|
upgrade.id = getUniqueID("upgrade-");
|
||||||
upgrade.type = UpgradeType;
|
upgrade.type = UpgradeType;
|
||||||
upgrade[Component] = UpgradeComponent;
|
upgrade[Component] = UpgradeComponent as GenericComponent;
|
||||||
|
|
||||||
upgrade.bought = bought;
|
upgrade.bought = bought;
|
||||||
upgrade.canPurchase = computed(() => requirementsMet(upgrade.requirements));
|
upgrade.canPurchase = computed(() => requirementsMet(upgrade.requirements));
|
||||||
|
|
Loading…
Reference in a new issue