style: format files with prettier and fix eslint issues

This commit is contained in:
HorizonCode committed 2026-10-31 21:27:28 +01:00
1 parent 7648d1fd4c
commit a2b03d3014
42 files changed
+202 -229

No files matched your search

@@ -10,7 +10,6 @@
import { import {
DEFAULT_DISCORD_PRESENCE_CONFIG, DEFAULT_DISCORD_PRESENCE_CONFIG,
DISCORD_PRESENCE_PRESETS, DISCORD_PRESENCE_PRESETS,
discordPresenceCustomConfig,
interpolatePresenceString, interpolatePresenceString,
loadDiscordPresenceConfig, loadDiscordPresenceConfig,
pushIdlePresenceFromConfig, pushIdlePresenceFromConfig,
@@ -25,14 +24,11 @@
Check, Check,
Clock, Clock,
Code2, Code2,
Copy,
ExternalLink, ExternalLink,
Eye,
Gamepad2, Gamepad2,
Globe, Globe,
Home, Home,
Image as ImageIcon, Image as ImageIcon,
Info,
Link, Link,
LoaderCircle, LoaderCircle,
Maximize2, Maximize2,
@@ -41,10 +37,8 @@
Play, Play,
Plus, Plus,
RotateCcw, RotateCcw,
Save,
Sparkles, Sparkles,
Type, Type,
User,
X, X,
} from '@lucide/svelte'; } from '@lucide/svelte';
import { invoke } from '@tauri-apps/api/core'; import { invoke } from '@tauri-apps/api/core';
@@ -101,8 +95,10 @@
// Preset selector // Preset selector
let selectedPresetName = $state<string>('EZPPFarm Default'); let selectedPresetName = $state<string>('EZPPFarm Default');
const SIM_MODES = ['osu!', 'taiko', 'catch', 'mania'] as const;
// Simulation parameters for preview // Simulation parameters for preview
let simMode = $state<'osu!' | 'taiko' | 'catch' | 'mania'>('osu!'); let simMode = $state<(typeof SIM_MODES)[number]>('osu!');
let simAction = $state<string>('Playing...'); let simAction = $state<string>('Playing...');
let simBeatmapIndex = $state<number>(0); let simBeatmapIndex = $state<number>(0);
let simRank = $state<number>(1337); let simRank = $state<number>(1337);
@@ -206,7 +202,11 @@
if (standalone) { if (standalone) {
try { try {
unlistenSync = await listen<any>('sync-theme-editor-global-data', (event) => { unlistenSync = await listen<{
user?: Parameters<typeof currentUser.set>[0];
info?: Parameters<typeof currentUserInfo.set>[0];
launcherVersion?: string;
}>('sync-theme-editor-global-data', (event) => {
if (event.payload?.user) currentUser.set(event.payload.user); if (event.payload?.user) currentUser.set(event.payload.user);
if (event.payload?.info) currentUserInfo.set(event.payload.info); if (event.payload?.info) currentUserInfo.set(event.payload.info);
if (event.payload?.launcherVersion) launcherVersion.set(event.payload.launcherVersion); if (event.payload?.launcherVersion) launcherVersion.set(event.payload.launcherVersion);
@@ -844,7 +844,7 @@
Details (First Line) Details (First Line)
</Label> </Label>
<span class="text-[10px] text-muted-foreground" <span class="text-[10px] text-muted-foreground"
>[{'{'}mode{'}'}] {'{'}action{'}'}</span >[{'{'}mode}] {'{'}action}</span
> >
</div> </div>
<Input <Input
@@ -852,7 +852,7 @@
bind:value={workingConfig.playingDetails} bind:value={workingConfig.playingDetails}
onfocus={() => handleInputFocus('playingDetails')} onfocus={() => handleInputFocus('playingDetails')}
onblur={handleInputBlur} onblur={handleInputBlur}
placeholder="[{'{'}mode{'}'}] {'{'}action{'}'}" placeholder="[{'{'}mode}] {'{'}action}"
class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary" class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary"
/> />
</div> </div>
@@ -862,14 +862,14 @@
<Label class="text-[11px] font-medium text-theme-200" for="playing-state"> <Label class="text-[11px] font-medium text-theme-200" for="playing-state">
State (Second Line) State (Second Line)
</Label> </Label>
<span class="text-[10px] text-muted-foreground">{'{'}beatmap{'}'}</span> <span class="text-[10px] text-muted-foreground">{'{'}beatmap}</span>
</div> </div>
<Input <Input
id="playing-state" id="playing-state"
bind:value={workingConfig.playingState} bind:value={workingConfig.playingState}
onfocus={() => handleInputFocus('playingState')} onfocus={() => handleInputFocus('playingState')}
onblur={handleInputBlur} onblur={handleInputBlur}
placeholder="{'{'}beatmap{'}'}" placeholder="{'{'}beatmap}"
class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary" class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary"
/> />
</div> </div>
@@ -907,14 +907,14 @@
> >
Cover Art Hover Tooltip Cover Art Hover Tooltip
</Label> </Label>
<span class="text-[10px] text-muted-foreground">{'{'}beatmap{'}'}</span> <span class="text-[10px] text-muted-foreground">{'{'}beatmap}</span>
</div> </div>
<Input <Input
id="playing-large-text" id="playing-large-text"
bind:value={workingConfig.playingLargeImageText} bind:value={workingConfig.playingLargeImageText}
onfocus={() => handleInputFocus('playingLargeImageText')} onfocus={() => handleInputFocus('playingLargeImageText')}
onblur={handleInputBlur} onblur={handleInputBlur}
placeholder="{'{'}beatmap{'}'}" placeholder="{'{'}beatmap}"
class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary" class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary"
/> />
</div> </div>
@@ -945,7 +945,7 @@
Small Badge Hover Tooltip Small Badge Hover Tooltip
</Label> </Label>
<span class="text-[10px] text-muted-foreground" <span class="text-[10px] text-muted-foreground"
>{'{'}username{'}'} (#{'{'}rank{'}'})</span >{'{'}username} (#{'{'}rank})</span
> >
</div> </div>
<Input <Input
@@ -953,7 +953,7 @@
bind:value={workingConfig.playingSmallImageText} bind:value={workingConfig.playingSmallImageText}
onfocus={() => handleInputFocus('playingSmallImageText')} onfocus={() => handleInputFocus('playingSmallImageText')}
onblur={handleInputBlur} onblur={handleInputBlur}
placeholder="{'{'}username{'}'} (#{'{'}rank{'}'})" placeholder="{'{'}username} (#{'{'}rank})"
class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary" class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary"
/> />
</div> </div>
@@ -1031,7 +1031,7 @@
<ThemeSection <ThemeSection
title="Button 1 (Playing In-Game)" title="Button 1 (Playing In-Game)"
icon={Link} icon={Link}
description="Primary action button shown while playing osu! (supports {'{'}beatmapUrl{'}'})" description="Primary action button shown while playing osu! (supports {'{'}beatmapUrl})"
> >
<div class="space-y-3"> <div class="space-y-3">
<div <div
@@ -1067,7 +1067,7 @@
bind:value={workingConfig.playingButton1.url} bind:value={workingConfig.playingButton1.url}
onfocus={() => handleInputFocus('playingButton1Url')} onfocus={() => handleInputFocus('playingButton1Url')}
onblur={handleInputBlur} onblur={handleInputBlur}
placeholder="{'{'}beatmapUrl{'}'}" placeholder="{'{'}beatmapUrl}"
class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary" class="h-8 bg-black/40 text-xs border-theme-800 focus:border-primary"
/> />
</div> </div>
@@ -1128,7 +1128,7 @@
bordered={false} bordered={false}
> >
<div class="space-y-2"> <div class="space-y-2">
{#each DISCORD_PRESENCE_PRESETS as preset} {#each DISCORD_PRESENCE_PRESETS as preset (preset.name)}
<div <div
class="flex flex-col gap-1.5 rounded-xl border border-theme-800/80 bg-theme-900/40 p-3 transition-colors hover:border-theme-700 {selectedPresetName === class="flex flex-col gap-1.5 rounded-xl border border-theme-800/80 bg-theme-900/40 p-3 transition-colors hover:border-theme-700 {selectedPresetName ===
preset.name preset.name
@@ -1170,7 +1170,7 @@
description="Click any variable to copy or evaluate in the active field" description="Click any variable to copy or evaluate in the active field"
> >
<div class="space-y-1.5"> <div class="space-y-1.5">
{#each PLACEHOLDERS as p} {#each PLACEHOLDERS as p (p.token)}
<div <div
class="flex items-center justify-between rounded-lg border border-theme-800/40 bg-black/30 px-2.5 py-1.5 text-[11px]" class="flex items-center justify-between rounded-lg border border-theme-800/40 bg-black/30 px-2.5 py-1.5 text-[11px]"
> >
@@ -1215,7 +1215,7 @@
</span> </span>
</div> </div>
<div class="flex flex-wrap gap-1"> <div class="flex flex-wrap gap-1">
{#each PLACEHOLDERS as p} {#each PLACEHOLDERS as p (p.token)}
<button <button
type="button" type="button"
class="group flex items-center gap-1 rounded border border-theme-800 bg-theme-900/90 px-1.5 py-0.5 text-[10px] text-theme-200 transition-all hover:border-primary/60 hover:bg-primary/20 hover:text-white active:scale-95" class="group flex items-center gap-1 rounded border border-theme-800 bg-theme-900/90 px-1.5 py-0.5 text-[10px] text-theme-200 transition-all hover:border-primary/60 hover:bg-primary/20 hover:text-white active:scale-95"
@@ -1354,14 +1354,14 @@
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-muted-foreground">Mode:</span> <span class="text-muted-foreground">Mode:</span>
<div class="flex gap-0.5"> <div class="flex gap-0.5">
{#each ['osu!', 'taiko', 'catch', 'mania'] as mode} {#each SIM_MODES as mode (mode)}
<button <button
type="button" type="button"
class="rounded px-2 py-0.5 text-[10px] font-semibold transition-colors {simMode === class="rounded px-2 py-0.5 text-[10px] font-semibold transition-colors {simMode ===
mode mode
? 'bg-primary text-primary-foreground' ? 'bg-primary text-primary-foreground'
: 'bg-black/40 text-theme-300 hover:text-white'}" : 'bg-black/40 text-theme-300 hover:text-white'}"
onclick={() => (simMode = mode as any)} onclick={() => (simMode = mode)}
> >
{mode} {mode}
</button> </button>
@@ -1372,7 +1372,7 @@
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-muted-foreground">Action:</span> <span class="text-muted-foreground">Action:</span>
<div class="flex gap-0.5"> <div class="flex gap-0.5">
{#each ['Playing...', 'Editing...', 'AFK...'] as act} {#each ['Playing...', 'Editing...', 'AFK...'] as act (act)}
<button <button
type="button" type="button"
class="rounded px-2 py-0.5 text-[10px] transition-colors {simAction === act class="rounded px-2 py-0.5 text-[10px] transition-colors {simAction === act
@@ -1392,7 +1392,7 @@
bind:value={simBeatmapIndex} bind:value={simBeatmapIndex}
class="rounded border border-theme-800 bg-black/60 px-2 py-0.5 text-[10px] text-theme-200" class="rounded border border-theme-800 bg-black/60 px-2 py-0.5 text-[10px] text-theme-200"
> >
{#each SAMPLE_BEATMAPS as b, idx} {#each SAMPLE_BEATMAPS as b, idx (`${b.artist}-${b.title}-${idx}`)}
<option value={idx}>{b.artist} - {b.title}</option> <option value={idx}>{b.artist} - {b.title}</option>
{/each} {/each}
</select> </select>
@@ -18,8 +18,6 @@
import { getThemeDataSampleValue, resolveThemeDataValue, themeGlobalData } from '$lib/themeData'; import { getThemeDataSampleValue, resolveThemeDataValue, themeGlobalData } from '$lib/themeData';
import type { ThemeFontChoice } from '$lib/themeFonts'; import type { ThemeFontChoice } from '$lib/themeFonts';
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons'; import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons';
import { openURL } from '$lib/utils';
import { sileo } from 'sileo';
import { import {
THEME_DATA_FIELDS, THEME_DATA_FIELDS,
THEME_PARTICLE_PRESETS, THEME_PARTICLE_PRESETS,
@@ -32,6 +30,7 @@
type ThemeV2WidgetKind, type ThemeV2WidgetKind,
type ThemeV2WidgetVariant, type ThemeV2WidgetVariant,
} from '$lib/themeV2'; } from '$lib/themeV2';
import { openURL } from '$lib/utils';
import { import {
CircleUser, CircleUser,
Clock, Clock,
@@ -51,6 +50,7 @@
Timer, Timer,
Type, Type,
} from '@lucide/svelte'; } from '@lucide/svelte';
import { sileo } from 'sileo';
let { let {
element = $bindable(), element = $bindable(),
@@ -1643,7 +1643,8 @@
Test Button Action Test Button Action
</Button> </Button>
<p class="text-[9px] leading-relaxed text-muted-foreground"> <p class="text-[9px] leading-relaxed text-muted-foreground">
In editor mode, canvas clicks select layers for dragging. Test actions using this button, or Shift+click on canvas. In editor mode, canvas clicks select layers for dragging. Test actions using this button,
or Shift+click on canvas.
</p> </p>
</div> </div>
<div class="grid grid-cols-2 gap-2"> <div class="grid grid-cols-2 gap-2">
@@ -2502,7 +2503,8 @@
{:else if element.widget === 'telemetry'} {:else if element.widget === 'telemetry'}
Pill bar showing beatmap counts, skin counts, ping, and osu! build. Pill bar showing beatmap counts, skin counts, ping, and osu! build.
{:else if element.widget === 'header'} {:else if element.widget === 'header'}
Launcher title and dynamic greeting. Full shows title and subtitle, Compact shows an inline pill greeting, and Minimal displays title only. Launcher title and dynamic greeting. Full shows title and subtitle, Compact shows an
inline pill greeting, and Minimal displays title only.
{:else} {:else}
Launcher title and dynamic greeting. Launcher title and dynamic greeting.
{/if} {/if}
@@ -9,7 +9,7 @@
} from '$lib/themeIconCatalog'; } from '$lib/themeIconCatalog';
import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons'; import { DEFAULT_THEME_ICON_SET, type ThemeIconSet } from '$lib/themeIcons';
import ThemeIcon from './ThemeIcon.svelte'; import ThemeIcon from './ThemeIcon.svelte';
import { Check, ChevronDown, ChevronsUpDown, LayoutGrid, List, Search, X } from '@lucide/svelte'; import { Check, ChevronsUpDown, LayoutGrid, List, Search, X } from '@lucide/svelte';
let { let {
value = $bindable(undefined), value = $bindable(undefined),
@@ -4,11 +4,7 @@
import Input from '$lib/components/ui/input/input.svelte'; import Input from '$lib/components/ui/input/input.svelte';
import Label from '$lib/components/ui/label/label.svelte'; import Label from '$lib/components/ui/label/label.svelte';
import * as Select from '$lib/components/ui/select'; import * as Select from '$lib/components/ui/select';
import type { import type { ThemeV2TextDecoration, ThemeV2TextStyle, ThemeV2TextTransform } from '$lib/themeV2';
ThemeV2TextDecoration,
ThemeV2TextStyle,
ThemeV2TextTransform,
} from '$lib/themeV2';
import { Bold, Italic, RotateCcw, Strikethrough, Underline } from '@lucide/svelte'; import { Bold, Italic, RotateCcw, Strikethrough, Underline } from '@lucide/svelte';
let { let {
@@ -44,17 +44,7 @@
} from '$lib/themeV2'; } from '$lib/themeV2';
import { currentUser } from '$lib/userAuthentication'; import { currentUser } from '$lib/userAuthentication';
import { countryCodeToEmoji, formatRelativeTime, openURL } from '$lib/utils'; import { countryCodeToEmoji, formatRelativeTime, openURL } from '$lib/utils';
import { import { Boxes, ChevronRight, Clock, Move, RotateCw, Trophy } from '@lucide/svelte';
Boxes,
ChevronRight,
Clock,
Medal,
Move,
RotateCw,
TrendingDown,
TrendingUp,
Trophy,
} from '@lucide/svelte';
import { onDestroy } from 'svelte'; import { onDestroy } from 'svelte';
import { SvelteSet } from 'svelte/reactivity'; import { SvelteSet } from 'svelte/reactivity';
import { TextMorph } from 'torph/svelte'; import { TextMorph } from 'torph/svelte';
@@ -1,9 +1,9 @@
<script lang="ts"> <script lang="ts">
import type { ComponentProps } from "svelte"; import CalendarMonthSelect from './calendar-month-select.svelte';
import type Calendar from "./calendar.svelte"; import CalendarYearSelect from './calendar-year-select.svelte';
import CalendarMonthSelect from "./calendar-month-select.svelte"; import type Calendar from './calendar.svelte';
import CalendarYearSelect from "./calendar-year-select.svelte"; import { DateFormatter, getLocalTimeZone, type DateValue } from '@internationalized/date';
import { DateFormatter, getLocalTimeZone, type DateValue } from "@internationalized/date"; import type { ComponentProps } from 'svelte';
let { let {
captionLayout, captionLayout,
@@ -16,11 +16,11 @@
placeholder = $bindable(), placeholder = $bindable(),
monthIndex = 0, monthIndex = 0,
}: { }: {
captionLayout: ComponentProps<typeof Calendar>["captionLayout"]; captionLayout: ComponentProps<typeof Calendar>['captionLayout'];
months: ComponentProps<typeof CalendarMonthSelect>["months"]; months: ComponentProps<typeof CalendarMonthSelect>['months'];
monthFormat: ComponentProps<typeof CalendarMonthSelect>["monthFormat"]; monthFormat: ComponentProps<typeof CalendarMonthSelect>['monthFormat'];
years: ComponentProps<typeof CalendarYearSelect>["years"]; years: ComponentProps<typeof CalendarYearSelect>['years'];
yearFormat: ComponentProps<typeof CalendarYearSelect>["yearFormat"]; yearFormat: ComponentProps<typeof CalendarYearSelect>['yearFormat'];
month: DateValue; month: DateValue;
placeholder: DateValue | undefined; placeholder: DateValue | undefined;
locale: string; locale: string;
@@ -29,13 +29,13 @@
function formatYear(date: DateValue) { function formatYear(date: DateValue) {
const dateObj = date.toDate(getLocalTimeZone()); const dateObj = date.toDate(getLocalTimeZone());
if (typeof yearFormat === "function") return yearFormat(dateObj.getFullYear()); if (typeof yearFormat === 'function') return yearFormat(dateObj.getFullYear());
return new DateFormatter(locale, { year: yearFormat }).format(dateObj); return new DateFormatter(locale, { year: yearFormat }).format(dateObj);
} }
function formatMonth(date: DateValue) { function formatMonth(date: DateValue) {
const dateObj = date.toDate(getLocalTimeZone()); const dateObj = date.toDate(getLocalTimeZone());
if (typeof monthFormat === "function") return monthFormat(dateObj.getMonth() + 1); if (typeof monthFormat === 'function') return monthFormat(dateObj.getMonth() + 1);
return new DateFormatter(locale, { month: monthFormat }).format(dateObj); return new DateFormatter(locale, { month: monthFormat }).format(dateObj);
} }
</script> </script>
@@ -58,15 +58,15 @@
<CalendarYearSelect {years} {yearFormat} value={month.year} /> <CalendarYearSelect {years} {yearFormat} value={month.year} />
{/snippet} {/snippet}
{#if captionLayout === "dropdown"} {#if captionLayout === 'dropdown'}
{@render MonthSelect()} {@render MonthSelect()}
{@render YearSelect()} {@render YearSelect()}
{:else if captionLayout === "dropdown-months"} {:else if captionLayout === 'dropdown-months'}
{@render MonthSelect()} {@render MonthSelect()}
{#if placeholder} {#if placeholder}
{formatYear(placeholder)} {formatYear(placeholder)}
{/if} {/if}
{:else if captionLayout === "dropdown-years"} {:else if captionLayout === 'dropdown-years'}
{#if placeholder} {#if placeholder}
{formatMonth(placeholder)} {formatMonth(placeholder)}
{/if} {/if}
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -12,7 +12,7 @@
<CalendarPrimitive.Cell <CalendarPrimitive.Cell
bind:ref bind:ref
class={cn( class={cn(
"relative size-(--cell-size) p-0 text-center text-sm focus-within:z-20 [&:first-child[data-selected]_[data-bits-day]]:rounded-s-md [&:last-child[data-selected]_[data-bits-day]]:rounded-e-md", 'relative size-(--cell-size) p-0 text-center text-sm focus-within:z-20 [&:first-child[data-selected]_[data-bits-day]]:rounded-s-md [&:last-child[data-selected]_[data-bits-day]]:rounded-e-md',
className className
)} )}
{...restProps} {...restProps}
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { buttonVariants } from "$lib/components/ui/button/index.js"; import { buttonVariants } from '$lib/components/ui/button/index.js';
import { cn } from "$lib/utils.js"; import { cn } from '$lib/utils.js';
import { Calendar as CalendarPrimitive } from "bits-ui"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -13,22 +13,22 @@
<CalendarPrimitive.Day <CalendarPrimitive.Day
bind:ref bind:ref
class={cn( class={cn(
buttonVariants({ variant: "ghost" }), buttonVariants({ variant: 'ghost' }),
"flex size-(--cell-size) flex-col items-center justify-center gap-1 p-0 leading-none font-normal whitespace-nowrap select-none", 'flex size-(--cell-size) flex-col items-center justify-center gap-1 p-0 leading-none font-normal whitespace-nowrap select-none',
"[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground [&[data-today][data-disabled]]:text-muted-foreground", '[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground [&[data-today][data-disabled]]:text-muted-foreground',
"data-[selected]:bg-primary dark:data-[selected]:hover:bg-accent/50 data-[selected]:text-primary-foreground", 'data-[selected]:bg-primary dark:data-[selected]:hover:bg-accent/50 data-[selected]:text-primary-foreground',
// Outside months // Outside months
"[&[data-outside-month]:not([data-selected])]:text-muted-foreground [&[data-outside-month]:not([data-selected])]:hover:text-accent-foreground", '[&[data-outside-month]:not([data-selected])]:text-muted-foreground [&[data-outside-month]:not([data-selected])]:hover:text-accent-foreground',
// Disabled // Disabled
"data-[disabled]:text-muted-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", 'data-[disabled]:text-muted-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
// Unavailable // Unavailable
"data-[unavailable]:text-muted-foreground data-[unavailable]:line-through", 'data-[unavailable]:text-muted-foreground data-[unavailable]:line-through',
// hover // hover
"dark:hover:text-accent-foreground", 'dark:hover:text-accent-foreground',
// focus // focus
"focus:border-ring focus:ring-ring/50 focus:relative", 'focus:border-ring focus:ring-ring/50 focus:relative',
// inner spans // inner spans
"[&>span]:text-xs [&>span]:opacity-70", '[&>span]:text-xs [&>span]:opacity-70',
className className
)} )}
{...restProps} {...restProps}
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -9,4 +9,4 @@
}: CalendarPrimitive.GridRowProps = $props(); }: CalendarPrimitive.GridRowProps = $props();
</script> </script>
<CalendarPrimitive.GridRow bind:ref class={cn("flex", className)} {...restProps} /> <CalendarPrimitive.GridRow bind:ref class={cn('flex', className)} {...restProps} />
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -11,6 +11,6 @@
<CalendarPrimitive.Grid <CalendarPrimitive.Grid
bind:ref bind:ref
class={cn("mt-4 flex w-full border-collapse flex-col gap-1", className)} class={cn('mt-4 flex w-full border-collapse flex-col gap-1', className)}
{...restProps} {...restProps}
/> />
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -12,7 +12,7 @@
<CalendarPrimitive.HeadCell <CalendarPrimitive.HeadCell
bind:ref bind:ref
class={cn( class={cn(
"text-muted-foreground w-(--cell-size) rounded-md text-[0.8rem] font-normal", 'text-muted-foreground w-(--cell-size) rounded-md text-[0.8rem] font-normal',
className className
)} )}
{...restProps} {...restProps}
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -12,7 +12,7 @@
<CalendarPrimitive.Header <CalendarPrimitive.Header
bind:ref bind:ref
class={cn( class={cn(
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", 'flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium',
className className
)} )}
{...restProps} {...restProps}
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn } from '$lib/utils.js';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -11,6 +11,6 @@
<CalendarPrimitive.Heading <CalendarPrimitive.Heading
bind:ref bind:ref
class={cn("px-(--cell-size) text-sm font-medium", className)} class={cn('px-(--cell-size) text-sm font-medium', className)}
{...restProps} {...restProps}
/> />
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn, type WithoutChildrenOrChild } from '$lib/utils.js';
import { cn, type WithoutChildrenOrChild } from "$lib/utils.js"; import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -14,7 +14,7 @@
<span <span
class={cn( class={cn(
"has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]", 'has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]',
className className
)} )}
> >
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { type WithElementRef, cn } from "$lib/utils.js"; import { type WithElementRef, cn } from '$lib/utils.js';
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from 'svelte/elements';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -10,6 +10,6 @@
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props(); }: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
</script> </script>
<div {...restProps} bind:this={ref} class={cn("flex flex-col", className)}> <div {...restProps} bind:this={ref} class={cn('flex flex-col', className)}>
{@render children?.()} {@render children?.()}
</div> </div>
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { HTMLAttributes } from "svelte/elements"; import { cn, type WithElementRef } from '$lib/utils.js';
import { cn, type WithElementRef } from "$lib/utils.js"; import type { HTMLAttributes } from 'svelte/elements';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -12,7 +12,7 @@
<div <div
bind:this={ref} bind:this={ref}
class={cn("relative flex flex-col gap-4 md:flex-row", className)} class={cn('relative flex flex-col gap-4 md:flex-row', className)}
{...restProps} {...restProps}
> >
{@render children?.()} {@render children?.()}
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { cn, type WithElementRef } from "$lib/utils.js"; import { cn, type WithElementRef } from '$lib/utils.js';
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from 'svelte/elements';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -13,7 +13,7 @@
<nav <nav
{...restProps} {...restProps}
bind:this={ref} bind:this={ref}
class={cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", className)} class={cn('absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1', className)}
> >
{@render children?.()} {@render children?.()}
</nav> </nav>
@@ -1,14 +1,14 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { buttonVariants, type ButtonVariant } from '$lib/components/ui/button/index.js';
import ChevronRightIcon from "@lucide/svelte/icons/chevron-right"; import { cn } from '$lib/utils.js';
import { buttonVariants, type ButtonVariant } from "$lib/components/ui/button/index.js"; import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
class: className, class: className,
children, children,
variant = "ghost", variant = 'ghost',
...restProps ...restProps
}: CalendarPrimitive.NextButtonProps & { }: CalendarPrimitive.NextButtonProps & {
variant?: ButtonVariant; variant?: ButtonVariant;
@@ -23,7 +23,7 @@
bind:ref bind:ref
class={cn( class={cn(
buttonVariants({ variant }), buttonVariants({ variant }),
"size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180", 'size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180',
className className
)} )}
children={children || Fallback} children={children || Fallback}
@@ -1,14 +1,14 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { buttonVariants, type ButtonVariant } from '$lib/components/ui/button/index.js';
import ChevronLeftIcon from "@lucide/svelte/icons/chevron-left"; import { cn } from '$lib/utils.js';
import { buttonVariants, type ButtonVariant } from "$lib/components/ui/button/index.js"; import ChevronLeftIcon from '@lucide/svelte/icons/chevron-left';
import { cn } from "$lib/utils.js"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
class: className, class: className,
children, children,
variant = "ghost", variant = 'ghost',
...restProps ...restProps
}: CalendarPrimitive.PrevButtonProps & { }: CalendarPrimitive.PrevButtonProps & {
variant?: ButtonVariant; variant?: ButtonVariant;
@@ -23,7 +23,7 @@
bind:ref bind:ref
class={cn( class={cn(
buttonVariants({ variant }), buttonVariants({ variant }),
"size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180", 'size-(--cell-size) bg-transparent p-0 select-none disabled:opacity-50 rtl:rotate-180',
className className
)} )}
children={children || Fallback} children={children || Fallback}
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn, type WithoutChildrenOrChild } from '$lib/utils.js';
import { cn, type WithoutChildrenOrChild } from "$lib/utils.js"; import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
import ChevronDownIcon from "@lucide/svelte/icons/chevron-down"; import { Calendar as CalendarPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -13,7 +13,7 @@
<span <span
class={cn( class={cn(
"has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]", 'has-focus:border-ring border-input has-focus:ring-ring/50 relative flex rounded-md border shadow-xs has-focus:ring-[3px]',
className className
)} )}
> >
+19 -19
View File
@@ -1,41 +1,41 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { cn, type WithoutChildrenOrChild } from '$lib/utils.js';
import * as Calendar from "./index.js"; import type { ButtonVariant } from '../button/button.svelte';
import { cn, type WithoutChildrenOrChild } from "$lib/utils.js"; import * as Calendar from './index.js';
import type { ButtonVariant } from "../button/button.svelte"; import { isEqualMonth, type DateValue } from '@internationalized/date';
import { isEqualMonth, type DateValue } from "@internationalized/date"; import { Calendar as CalendarPrimitive } from 'bits-ui';
import type { Snippet } from "svelte"; import type { Snippet } from 'svelte';
let { let {
ref = $bindable(null), ref = $bindable(null),
value = $bindable(), value = $bindable(),
placeholder = $bindable(), placeholder = $bindable(),
class: className, class: className,
weekdayFormat = "short", weekdayFormat = 'short',
buttonVariant = "ghost", buttonVariant = 'ghost',
captionLayout = "label", captionLayout = 'label',
locale = "en-US", locale = 'en-US',
months: monthsProp, months: monthsProp,
years, years,
monthFormat: monthFormatProp, monthFormat: monthFormatProp,
yearFormat = "numeric", yearFormat = 'numeric',
day, day,
disableDaysOutsideMonth = false, disableDaysOutsideMonth = false,
...restProps ...restProps
}: WithoutChildrenOrChild<CalendarPrimitive.RootProps> & { }: WithoutChildrenOrChild<CalendarPrimitive.RootProps> & {
buttonVariant?: ButtonVariant; buttonVariant?: ButtonVariant;
captionLayout?: "dropdown" | "dropdown-months" | "dropdown-years" | "label"; captionLayout?: 'dropdown' | 'dropdown-months' | 'dropdown-years' | 'label';
months?: CalendarPrimitive.MonthSelectProps["months"]; months?: CalendarPrimitive.MonthSelectProps['months'];
years?: CalendarPrimitive.YearSelectProps["years"]; years?: CalendarPrimitive.YearSelectProps['years'];
monthFormat?: CalendarPrimitive.MonthSelectProps["monthFormat"]; monthFormat?: CalendarPrimitive.MonthSelectProps['monthFormat'];
yearFormat?: CalendarPrimitive.YearSelectProps["yearFormat"]; yearFormat?: CalendarPrimitive.YearSelectProps['yearFormat'];
day?: Snippet<[{ day: DateValue; outsideMonth: boolean }]>; day?: Snippet<[{ day: DateValue; outsideMonth: boolean }]>;
} = $props(); } = $props();
const monthFormat = $derived.by(() => { const monthFormat = $derived.by(() => {
if (monthFormatProp) return monthFormatProp; if (monthFormatProp) return monthFormatProp;
if (captionLayout.startsWith("dropdown")) return "short"; if (captionLayout.startsWith('dropdown')) return 'short';
return "long"; return 'long';
}); });
</script> </script>
@@ -50,7 +50,7 @@ get along, so we shut typescript up by casting `value` to `never`.
{weekdayFormat} {weekdayFormat}
{disableDaysOutsideMonth} {disableDaysOutsideMonth}
class={cn( class={cn(
"bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", 'bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent',
className className
)} )}
{locale} {locale}
+18 -18
View File
@@ -1,21 +1,21 @@
import Root from "./calendar.svelte"; import Caption from './calendar-caption.svelte';
import Cell from "./calendar-cell.svelte"; import Cell from './calendar-cell.svelte';
import Day from "./calendar-day.svelte"; import Day from './calendar-day.svelte';
import Grid from "./calendar-grid.svelte"; import GridBody from './calendar-grid-body.svelte';
import Header from "./calendar-header.svelte"; import GridHead from './calendar-grid-head.svelte';
import Months from "./calendar-months.svelte"; import GridRow from './calendar-grid-row.svelte';
import GridRow from "./calendar-grid-row.svelte"; import Grid from './calendar-grid.svelte';
import Heading from "./calendar-heading.svelte"; import HeadCell from './calendar-head-cell.svelte';
import GridBody from "./calendar-grid-body.svelte"; import Header from './calendar-header.svelte';
import GridHead from "./calendar-grid-head.svelte"; import Heading from './calendar-heading.svelte';
import HeadCell from "./calendar-head-cell.svelte"; import MonthSelect from './calendar-month-select.svelte';
import NextButton from "./calendar-next-button.svelte"; import Month from './calendar-month.svelte';
import PrevButton from "./calendar-prev-button.svelte"; import Months from './calendar-months.svelte';
import MonthSelect from "./calendar-month-select.svelte"; import Nav from './calendar-nav.svelte';
import YearSelect from "./calendar-year-select.svelte"; import NextButton from './calendar-next-button.svelte';
import Month from "./calendar-month.svelte"; import PrevButton from './calendar-prev-button.svelte';
import Nav from "./calendar-nav.svelte"; import YearSelect from './calendar-year-select.svelte';
import Caption from "./calendar-caption.svelte"; import Root from './calendar.svelte';
export { export {
Day, Day,
@@ -73,7 +73,7 @@
return; return;
} }
let next = ''; let next: string;
if (withTime) { if (withTime) {
const d = new Date( const d = new Date(
calendarValue.year, calendarValue.year,
+5 -5
View File
@@ -1,8 +1,8 @@
import Root from "./popover.svelte"; import Close from './popover-close.svelte';
import Close from "./popover-close.svelte"; import Content from './popover-content.svelte';
import Content from "./popover-content.svelte"; import Portal from './popover-portal.svelte';
import Trigger from "./popover-trigger.svelte"; import Trigger from './popover-trigger.svelte';
import Portal from "./popover-portal.svelte"; import Root from './popover.svelte';
export { export {
Root, Root,
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Popover as PopoverPrimitive } from "bits-ui"; import { Popover as PopoverPrimitive } from 'bits-ui';
let { ref = $bindable(null), ...restProps }: PopoverPrimitive.CloseProps = $props(); let { ref = $bindable(null), ...restProps }: PopoverPrimitive.CloseProps = $props();
</script> </script>
@@ -1,14 +1,14 @@
<script lang="ts"> <script lang="ts">
import { Popover as PopoverPrimitive } from "bits-ui"; import { cn, type WithoutChildrenOrChild } from '$lib/utils.js';
import PopoverPortal from "./popover-portal.svelte"; import PopoverPortal from './popover-portal.svelte';
import { cn, type WithoutChildrenOrChild } from "$lib/utils.js"; import { Popover as PopoverPrimitive } from 'bits-ui';
import type { ComponentProps } from "svelte"; import type { ComponentProps } from 'svelte';
let { let {
ref = $bindable(null), ref = $bindable(null),
class: className, class: className,
sideOffset = 4, sideOffset = 4,
align = "center", align = 'center',
portalProps, portalProps,
...restProps ...restProps
}: PopoverPrimitive.ContentProps & { }: PopoverPrimitive.ContentProps & {
@@ -23,7 +23,7 @@
{sideOffset} {sideOffset}
{align} {align}
class={cn( class={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--bits-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--bits-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
className className
)} )}
{...restProps} {...restProps}
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Popover as PopoverPrimitive } from "bits-ui"; import { Popover as PopoverPrimitive } from 'bits-ui';
let { ...restProps }: PopoverPrimitive.PortalProps = $props(); let { ...restProps }: PopoverPrimitive.PortalProps = $props();
</script> </script>
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js"; import { cn } from '$lib/utils.js';
import { Popover as PopoverPrimitive } from "bits-ui"; import { Popover as PopoverPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -12,6 +12,6 @@
<PopoverPrimitive.Trigger <PopoverPrimitive.Trigger
bind:ref bind:ref
data-slot="popover-trigger" data-slot="popover-trigger"
class={cn("", className)} class={cn('', className)}
{...restProps} {...restProps}
/> />
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Popover as PopoverPrimitive } from "bits-ui"; import { Popover as PopoverPrimitive } from 'bits-ui';
let { open = $bindable(false), ...restProps }: PopoverPrimitive.RootProps = $props(); let { open = $bindable(false), ...restProps }: PopoverPrimitive.RootProps = $props();
</script> </script>
+6 -6
View File
@@ -1,9 +1,9 @@
import Root from "./tooltip.svelte"; import Arrow from './tooltip-arrow.svelte';
import Content from "./tooltip-content.svelte"; import Content from './tooltip-content.svelte';
import Trigger from "./tooltip-trigger.svelte"; import Portal from './tooltip-portal.svelte';
import Provider from "./tooltip-provider.svelte"; import Provider from './tooltip-provider.svelte';
import Portal from "./tooltip-portal.svelte"; import Trigger from './tooltip-trigger.svelte';
import Arrow from "./tooltip-arrow.svelte"; import Root from './tooltip.svelte';
export { export {
Root, Root,
@@ -1,8 +1,8 @@
<script lang="ts"> <script lang="ts">
import { Tooltip as TooltipPrimitive } from "bits-ui"; import { cn, type WithoutChildrenOrChild } from '$lib/utils.js';
import TooltipPortal from "./tooltip-portal.svelte"; import TooltipPortal from './tooltip-portal.svelte';
import { cn, type WithoutChildrenOrChild } from "$lib/utils.js"; import { Tooltip as TooltipPrimitive } from 'bits-ui';
import type { ComponentProps } from "svelte"; import type { ComponentProps } from 'svelte';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -21,7 +21,7 @@
data-slot="tooltip-content" data-slot="tooltip-content"
{sideOffset} {sideOffset}
class={cn( class={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md border border-border px-3 py-1.5 text-xs shadow-md", 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-end-2 data-[side=right]:slide-in-from-start-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md border border-border px-3 py-1.5 text-xs shadow-md',
className className
)} )}
{...restProps} {...restProps}
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Tooltip as TooltipPrimitive } from "bits-ui"; import { Tooltip as TooltipPrimitive } from 'bits-ui';
let { ...restProps }: TooltipPrimitive.PortalProps = $props(); let { ...restProps }: TooltipPrimitive.PortalProps = $props();
</script> </script>
@@ -1,13 +1,7 @@
<script lang="ts"> <script lang="ts">
import { Tooltip as TooltipPrimitive } from "bits-ui"; import { Tooltip as TooltipPrimitive } from 'bits-ui';
let { let { delayDuration = 100, ...restProps }: TooltipPrimitive.ProviderProps = $props();
delayDuration = 100,
...restProps
}: TooltipPrimitive.ProviderProps = $props();
</script> </script>
<TooltipPrimitive.Provider <TooltipPrimitive.Provider {delayDuration} {...restProps} />
{delayDuration}
{...restProps}
/>
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js"; import { cn } from '$lib/utils.js';
import { Tooltip as TooltipPrimitive } from "bits-ui"; import { Tooltip as TooltipPrimitive } from 'bits-ui';
let { let {
ref = $bindable(null), ref = $bindable(null),
@@ -12,6 +12,6 @@
<TooltipPrimitive.Trigger <TooltipPrimitive.Trigger
bind:ref bind:ref
data-slot="tooltip-trigger" data-slot="tooltip-trigger"
class={cn("", className)} class={cn('', className)}
{...restProps} {...restProps}
/> />
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Tooltip as TooltipPrimitive } from "bits-ui"; import { Tooltip as TooltipPrimitive } from 'bits-ui';
let { open = $bindable(false), ...restProps }: TooltipPrimitive.RootProps = $props(); let { open = $bindable(false), ...restProps }: TooltipPrimitive.RootProps = $props();
</script> </script>
+1 -1
View File
@@ -177,7 +177,7 @@ export const resolveThemeDataValue = (
const { global, theme, screen, mode = 'osu', now = new Date() } = context; const { global, theme, screen, mode = 'osu', now = new Date() } = context;
const stats = global.user.stats[mode]; const stats = global.user.stats[mode];
let value = ''; let value: string;
switch (field) { switch (field) {
case 'user.name': case 'user.name':
value = global.user.name; value = global.user.name;
+1 -6
View File
@@ -1,10 +1,5 @@
import { THEME_ICON_BODIES, type ThemeIconBody } from './themeIconData'; import { THEME_ICON_BODIES, type ThemeIconBody } from './themeIconData';
import { import { DEFAULT_THEME_ICON_SET, THEME_ICON_NAMES, type ThemeIconSet } from './themeIcons';
DEFAULT_THEME_ICON_SET,
THEME_ICON_NAMES,
type ThemeIconName,
type ThemeIconSet,
} from './themeIcons';
import lucideCollection from '@iconify-json/lucide/icons.json'; import lucideCollection from '@iconify-json/lucide/icons.json';
import phCollection from '@iconify-json/ph/icons.json'; import phCollection from '@iconify-json/ph/icons.json';
import tablerCollection from '@iconify-json/tabler/icons.json'; import tablerCollection from '@iconify-json/tabler/icons.json';
-2
View File
@@ -78,8 +78,6 @@ export const THEME_ICON_NAMES = [
export type ThemeIconName = (typeof THEME_ICON_NAMES)[number] | (string & {}); export type ThemeIconName = (typeof THEME_ICON_NAMES)[number] | (string & {});
const ICON_NAME_SET = new Set<string>(THEME_ICON_NAMES);
export const isThemeIconName = (value: unknown): value is ThemeIconName => export const isThemeIconName = (value: unknown): value is ThemeIconName =>
typeof value === 'string' && value.trim().length > 0 && value.length <= 120; typeof value === 'string' && value.trim().length > 0 && value.length <= 120;
+11 -5
View File
@@ -5,7 +5,6 @@ import {
themeGlobalData, themeGlobalData,
} from './themeData'; } from './themeData';
import { getThemeIconBody } from './themeIconCatalog'; import { getThemeIconBody } from './themeIconCatalog';
import { THEME_ICON_BODIES } from './themeIconData';
import { import {
themeArcGeometry, themeArcGeometry,
themeClockDate, themeClockDate,
@@ -1215,7 +1214,7 @@ const drawFooter = (context: PreviewContext, chrome?: ThemeV2Chrome) => {
ctx.restore(); ctx.restore();
}; };
const getWidgetPlayerData = (context: PreviewContext) => { const getWidgetPlayerData = (_context: PreviewContext) => {
const globalData = get(themeGlobalData); const globalData = get(themeGlobalData);
const name = globalData?.user?.name || getThemeDataSampleValue('user.name') || 'Player'; const name = globalData?.user?.name || getThemeDataSampleValue('user.name') || 'Player';
const rank = globalData?.user?.stats?.osu?.rank const rank = globalData?.user?.stats?.osu?.rank
@@ -1318,8 +1317,7 @@ const drawWidgetElement = async (context: PreviewContext, element: ThemeV2Widget
} else if (element.widget === 'header') { } else if (element.widget === 'header') {
const { name } = getWidgetPlayerData(context); const { name } = getWidgetPlayerData(context);
const hour = new Date().getHours(); const hour = new Date().getHours();
const timeGreeting = const timeGreeting = hour < 12 ? 'Good morning' : hour < 18 ? 'Good afternoon' : 'Good evening';
hour < 12 ? 'Good morning' : hour < 18 ? 'Good afternoon' : 'Good evening';
const greeting = `${timeGreeting}, ${name}!`; const greeting = `${timeGreeting}, ${name}!`;
ctx.save(); ctx.save();
@@ -1822,7 +1820,15 @@ const drawWidgetElement = async (context: PreviewContext, element: ThemeV2Widget
const badgeW = 24; const badgeW = 24;
const badgeH = 20; const badgeH = 20;
const badgeX = element.x + element.width - badgeW - 10; const badgeX = element.x + element.width - badgeW - 10;
fillRoundedRect(ctx, badgeX, centerY - badgeH / 2, badgeW, badgeH, 4, 'rgba(251, 191, 36, 0.2)'); fillRoundedRect(
ctx,
badgeX,
centerY - badgeH / 2,
badgeW,
badgeH,
4,
'rgba(251, 191, 36, 0.2)'
);
strokeRoundedRect( strokeRoundedRect(
ctx, ctx,
badgeX, badgeX,
+2 -10
View File
@@ -156,7 +156,6 @@
Clock, Clock,
ExternalLink, ExternalLink,
Medal, Medal,
Sparkles,
TrendingDown, TrendingDown,
TrendingUp, TrendingUp,
Trophy, Trophy,
@@ -650,7 +649,6 @@
userEvents.length === 0 ? 0 : Math.min(recentActivityIndex, userEvents.length - 1) userEvents.length === 0 ? 0 : Math.min(recentActivityIndex, userEvents.length - 1)
); );
const activeEvent = $derived(userEvents[safeEventIndex]); const activeEvent = $derived(userEvents[safeEventIndex]);
const latestEvent = $derived(activeEvent ?? userEvents[0]);
const timeGreeting = $derived.by(() => { const timeGreeting = $derived.by(() => {
const hour = new Date().getHours(); const hour = new Date().getHours();
@@ -2607,7 +2605,7 @@
<!-- Mini Feed of Recent Plays (clickable chips) --> <!-- Mini Feed of Recent Plays (clickable chips) -->
{#if userEvents.length > 1} {#if userEvents.length > 1}
<div class="flex items-center gap-1.5 pt-0.5 overflow-x-auto no-scrollbar"> <div class="flex items-center gap-1.5 pt-0.5 overflow-x-auto no-scrollbar">
{#each userEvents.slice(0, 4) as event, idx} {#each userEvents.slice(0, 4) as event, idx (`${event.time}-${idx}`)}
{@const eventGrade = gradeBadgeStyle(event.grade)} {@const eventGrade = gradeBadgeStyle(event.grade)}
<button <button
type="button" type="button"
@@ -3226,13 +3224,7 @@
variant="outline" variant="outline"
size="sm" size="sm"
class="h-8 gap-1.5 px-3 text-xs shrink-0" class="h-8 gap-1.5 px-3 text-xs shrink-0"
onclick={async () => { onclick={openDiscordPresenceEditor}
try {
await invoke('open_presence_editor');
} catch {
presenceEditorOpen = true;
}
}}
> >
<ThemeIcon name="palette" set={iconSet} class="size-3.5" /> <ThemeIcon name="palette" set={iconSet} class="size-3.5" />
Customize Activity Customize Activity