2023-01-17 18:25:56 +00:00
|
|
|
<template>
|
2023-09-22 19:02:51 +00:00
|
|
|
<foreignObject
|
2023-11-04 04:33:54 +00:00
|
|
|
ref="foreign_object"
|
2023-11-05 22:36:58 +00:00
|
|
|
:x="Math.round(store.calendar_aspect_ratio * rectangle.left)"
|
2023-09-22 19:02:51 +00:00
|
|
|
:y="rectangle.top"
|
2023-11-05 22:36:58 +00:00
|
|
|
:width="Math.round(store.calendar_aspect_ratio * rectangle.width)"
|
2023-09-22 19:02:51 +00:00
|
|
|
:height="rectangle.height"
|
2023-11-05 22:36:58 +00:00
|
|
|
:style="`transform: scaleX(${1 / store.calendar_aspect_ratio})`"
|
2023-09-22 19:02:51 +00:00
|
|
|
>
|
2023-11-04 04:33:54 +00:00
|
|
|
<!-- v-if="variant !== undefined" -->
|
2023-09-22 19:02:51 +00:00
|
|
|
<div
|
|
|
|
xmlns="http://www.w3.org/1999/xhtml"
|
2023-11-04 04:33:54 +00:00
|
|
|
class="px-4 is-flex is-align-items-center is-justify-content-center is-size-1 has-text-weight-bold has-background-primary"
|
2023-10-27 15:09:44 +00:00
|
|
|
style="height: inherit"
|
2023-09-22 19:02:51 +00:00
|
|
|
>
|
|
|
|
<slot name="default" />
|
|
|
|
</div>
|
|
|
|
</foreignObject>
|
2023-11-04 04:33:54 +00:00
|
|
|
<!-- <rect
|
2023-09-22 19:02:51 +00:00
|
|
|
v-bind="$attrs"
|
2023-09-20 22:04:47 +00:00
|
|
|
:class="variant !== undefined ? variant : ''"
|
2023-09-07 01:17:14 +00:00
|
|
|
:x="rectangle.left"
|
|
|
|
:y="rectangle.top"
|
|
|
|
:width="rectangle.width"
|
|
|
|
:height="rectangle.height"
|
2023-11-04 04:33:54 +00:00
|
|
|
/> -->
|
2023-01-17 18:25:56 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-07 02:08:56 +00:00
|
|
|
import { Rectangle } from "@/lib/rectangle";
|
2023-11-05 22:36:58 +00:00
|
|
|
import { advent22Store } from "@/plugins/store";
|
2023-09-06 16:25:35 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
2023-01-17 18:25:56 +00:00
|
|
|
|
2023-09-22 19:02:51 +00:00
|
|
|
type BulmaVariant =
|
|
|
|
| "primary"
|
|
|
|
| "link"
|
|
|
|
| "info"
|
|
|
|
| "success"
|
|
|
|
| "warning"
|
|
|
|
| "danger";
|
2023-09-20 16:16:45 +00:00
|
|
|
|
2023-01-17 18:25:56 +00:00
|
|
|
@Options({
|
|
|
|
props: {
|
2023-09-20 22:04:47 +00:00
|
|
|
variant: {
|
2023-09-20 16:16:45 +00:00
|
|
|
type: String,
|
|
|
|
required: false,
|
2023-01-17 18:25:56 +00:00
|
|
|
},
|
|
|
|
rectangle: Rectangle,
|
|
|
|
},
|
|
|
|
})
|
2023-01-24 23:19:25 +00:00
|
|
|
export default class extends Vue {
|
2023-09-22 19:02:51 +00:00
|
|
|
public variant?: BulmaVariant;
|
2023-09-06 16:25:35 +00:00
|
|
|
public rectangle!: Rectangle;
|
2023-09-22 19:02:51 +00:00
|
|
|
|
2023-11-05 22:36:58 +00:00
|
|
|
public readonly store = advent22Store();
|
2023-01-17 18:25:56 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2023-09-20 22:04:47 +00:00
|
|
|
@import "@/bulma-vars";
|
|
|
|
|
2023-01-17 18:25:56 +00:00
|
|
|
rect {
|
2023-09-20 16:16:45 +00:00
|
|
|
fill: transparent;
|
2023-09-20 22:04:47 +00:00
|
|
|
fill-opacity: 0.3;
|
|
|
|
stroke-opacity: 0.9;
|
|
|
|
stroke-width: 1;
|
2023-09-20 16:16:45 +00:00
|
|
|
|
2023-09-20 22:04:47 +00:00
|
|
|
&.primary {
|
|
|
|
fill: $primary;
|
|
|
|
stroke: $primary;
|
|
|
|
}
|
2023-09-20 16:16:45 +00:00
|
|
|
|
2023-09-20 22:04:47 +00:00
|
|
|
&.link {
|
|
|
|
fill: $link;
|
|
|
|
stroke: $link;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.info {
|
|
|
|
fill: $info;
|
|
|
|
stroke: $info;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.success {
|
|
|
|
fill: $success;
|
|
|
|
stroke: $success;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.warning {
|
|
|
|
fill: $warning;
|
|
|
|
stroke: $warning;
|
|
|
|
}
|
2023-01-17 18:25:56 +00:00
|
|
|
|
2023-09-20 22:04:47 +00:00
|
|
|
&.danger {
|
|
|
|
fill: $danger;
|
|
|
|
stroke: $danger;
|
2023-01-17 18:25:56 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-07 01:17:14 +00:00
|
|
|
</style>
|