2021-06-11 23:38:16 -05:00
|
|
|
<template>
|
2022-01-13 22:25:47 -06:00
|
|
|
<div v-if="visibility !== Visibility.None" v-show="visibility === Visibility.Visible">
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<button
|
|
|
|
:style="style"
|
2022-01-13 22:25:47 -06:00
|
|
|
@click="onClick"
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
@mousedown="start"
|
|
|
|
@mouseleave="stop"
|
|
|
|
@mouseup="stop"
|
|
|
|
@touchstart="start"
|
|
|
|
@touchend="stop"
|
|
|
|
@touchcancel="stop"
|
2022-01-13 22:25:47 -06:00
|
|
|
:disabled="!canClick"
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
:class="{
|
|
|
|
feature: true,
|
|
|
|
clickable: true,
|
2022-01-13 22:25:47 -06:00
|
|
|
can: props.canClick,
|
|
|
|
locked: !canClick,
|
|
|
|
small,
|
|
|
|
...classes
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
}"
|
|
|
|
>
|
2022-01-13 22:25:47 -06:00
|
|
|
<component v-if="component" :is="component" />
|
|
|
|
<MarkNode :mark="mark" />
|
|
|
|
<LinkNode :id="id" />
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
</button>
|
|
|
|
</div>
|
2021-06-11 23:38:16 -05:00
|
|
|
</template>
|
|
|
|
|
2022-01-13 22:25:47 -06:00
|
|
|
<script setup lang="tsx">
|
|
|
|
import { GenericClickable } from "@/features/clickable";
|
|
|
|
import { FeatureComponent, Visibility } from "@/features/feature";
|
|
|
|
import { coerceComponent, isCoercableComponent, setupHoldToClick } from "@/util/vue";
|
|
|
|
import { computed, toRefs, unref } from "vue";
|
|
|
|
import LinkNode from "../system/LinkNode.vue";
|
|
|
|
import MarkNode from "./MarkNode.vue";
|
|
|
|
|
|
|
|
const props = toRefs(defineProps<FeatureComponent<GenericClickable>>());
|
2021-06-11 23:38:16 -05:00
|
|
|
|
2022-01-13 22:25:47 -06:00
|
|
|
const component = computed(() => {
|
|
|
|
const display = unref(props.display);
|
|
|
|
if (display == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if (isCoercableComponent(display)) {
|
|
|
|
return coerceComponent(display);
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
}
|
2022-01-13 22:25:47 -06:00
|
|
|
return (
|
|
|
|
<span>
|
|
|
|
<div v-if={display.title}>
|
|
|
|
{/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */}
|
|
|
|
<component v-is={coerceComponent(display.title!, "h2")} />
|
|
|
|
</div>
|
|
|
|
<component v-is={coerceComponent(display.description, "div")} />
|
|
|
|
</span>
|
|
|
|
);
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
});
|
2022-01-13 22:25:47 -06:00
|
|
|
|
|
|
|
const { start, stop } = setupHoldToClick(props.onClick, props.onHold);
|
2021-06-11 23:38:16 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2021-06-24 22:15:10 -05:00
|
|
|
.clickable {
|
|
|
|
min-height: 120px;
|
|
|
|
width: 120px;
|
|
|
|
font-size: 10px;
|
|
|
|
}
|
2021-06-11 23:38:16 -05:00
|
|
|
</style>
|