Create calendar.svelte

This commit is contained in:
2026-02-03 12:30:05 +13:00
parent 5862c77d71
commit 7278cc5b4d
3 changed files with 65 additions and 0 deletions

View File

@@ -32,6 +32,8 @@
"vite": "^7.3.1"
},
"dependencies": {
"@fullcalendar/core": "^6.1.20",
"@fullcalendar/multimonth": "^6.1.20",
"@tiptap/core": "^3.18.0",
"@tiptap/extension-bubble-menu": "^3.18.0",
"@tiptap/extensions": "^3.18.0",

37
pnpm-lock.yaml generated
View File

@@ -8,6 +8,12 @@ importers:
.:
dependencies:
'@fullcalendar/core':
specifier: ^6.1.20
version: 6.1.20
'@fullcalendar/multimonth':
specifier: ^6.1.20
version: 6.1.20(@fullcalendar/core@6.1.20)
'@tiptap/core':
specifier: ^3.18.0
version: 3.18.0(@tiptap/pm@3.18.0)
@@ -553,6 +559,19 @@ packages:
'@floating-ui/utils@0.2.10':
resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
'@fullcalendar/core@6.1.20':
resolution: {integrity: sha512-1cukXLlePFiJ8YKXn/4tMKsy0etxYLCkXk8nUCFi11nRONF2Ba2CD5b21/ovtOO2tL6afTJfwmc1ed3HG7eB1g==}
'@fullcalendar/daygrid@6.1.20':
resolution: {integrity: sha512-AO9vqhkLP77EesmJzuU+IGXgxNulsA8mgQHynclJ8U70vSwAVnbcLG9qftiTAFSlZjiY/NvhE7sflve6cJelyQ==}
peerDependencies:
'@fullcalendar/core': ~6.1.20
'@fullcalendar/multimonth@6.1.20':
resolution: {integrity: sha512-rMMiPBA71lUJ1DV/0ckPtN4/G4LozkkDKoG7/CbmTYqFJiMRskM/1WpilhtRn4iUdNe03V5K7ofFQRs0wo4ZtQ==}
peerDependencies:
'@fullcalendar/core': ~6.1.20
'@jridgewell/gen-mapping@0.3.13':
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
@@ -1416,6 +1435,9 @@ packages:
resolution: {integrity: sha512-d+JFcLM17njZaOLkv6SCev7uoLaBtfK86vMUXhW1Z4glPWh4jozno9APvW/XKFJ3CCxVoC7OL38BqRydtu5nGg==}
engines: {node: '>=12'}
preact@10.12.1:
resolution: {integrity: sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==}
prettier@2.8.8:
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
engines: {node: '>=10.13.0'}
@@ -1900,6 +1922,19 @@ snapshots:
'@floating-ui/utils@0.2.10': {}
'@fullcalendar/core@6.1.20':
dependencies:
preact: 10.12.1
'@fullcalendar/daygrid@6.1.20(@fullcalendar/core@6.1.20)':
dependencies:
'@fullcalendar/core': 6.1.20
'@fullcalendar/multimonth@6.1.20(@fullcalendar/core@6.1.20)':
dependencies:
'@fullcalendar/core': 6.1.20
'@fullcalendar/daygrid': 6.1.20(@fullcalendar/core@6.1.20)
'@jridgewell/gen-mapping@0.3.13':
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
@@ -2633,6 +2668,8 @@ snapshots:
postgres@3.4.8: {}
preact@10.12.1: {}
prettier@2.8.8:
optional: true

View File

@@ -0,0 +1,26 @@
<script lang="ts">
import { Calendar } from '@fullcalendar/core'
import multiMonthPlugin from '@fullcalendar/multimonth'
import { onMount } from 'svelte';
let calendarEl = $state()
onMount(() => {
const calendar = new Calendar(calendarEl, {
plugins: [multiMonthPlugin],
initialView: 'multiMonthYear',
multiMonthMaxColumns: 1, // force a single column
headerToolbar: {
left: 'prev,next',
center: 'title',
right: 'today'
},
});
calendar.render();
});
</script>
<div class="text-black bg-white/30 p-4 rounded-2xl" bind:this={calendarEl}>
</div>