refactor: new timeline component

- Create new timeline component (extracted from asset-gird) without removing old code
- Add timeline/, timeline/actions/, timeline/base-components/, and timeline/internal-components/ directories
- Copy needed components (delete-asset-dialog, scrubber, skeleton) to new locations
- Add new timeline components (base-timeline, base-timeline-viewer, timeline-month, etc.)
- Update timeline-util.ts with new functions (findMonthAtScrollPosition, formatGroupTitleFull)
- Add asset-viewer-actions and asset-viewer-and-actions components

This allows the timeline to exist alongside the current AssetGrid component.
This commit is contained in:
midzelis
2025-09-15 13:37:41 +00:00
parent e42886b767
commit 3e9f713d81
20 changed files with 1940 additions and 1001 deletions

View File

@@ -1,36 +1,18 @@
<script lang="ts">
import { onDestroy, onMount } from 'svelte';
import { onMount } from 'svelte';
import type { UpdatePayload } from 'vite';
type Props = {
onBeforeUpdate?: (payload: UpdatePayload) => void;
onAfterUpdate?: (payload: UpdatePayload) => void;
};
interface Props {
onAfterUpdate: (payload: UpdatePayload) => void;
}
let { onBeforeUpdate, onAfterUpdate }: Props = $props();
const unsubscribes: (() => void)[] = [];
let { onAfterUpdate }: Props = $props();
onMount(() => {
const hot = import.meta.hot;
if (!hot) {
return;
}
if (onBeforeUpdate) {
hot.on('vite:beforeUpdate', onBeforeUpdate);
unsubscribes.push(() => hot.off('vite:beforeUpdate', onBeforeUpdate));
}
if (onAfterUpdate) {
if (hot) {
hot.on('vite:afterUpdate', onAfterUpdate);
unsubscribes.push(() => hot.off('vite:afterUpdate', onAfterUpdate));
}
});
onDestroy(() => {
for (const unsubscribe of unsubscribes) {
unsubscribe();
return () => hot.off('vite:afterUpdate', onAfterUpdate);
}
});
</script>