atagen

malice

public
Star0
Watch0
8e8f1cef327b55432644ae1b843f39ca20e91609
2
ssh://brewery@pls.lobotomise.me:33/atagen/malice.git

Blame: web/src/lib/SettingsPanel.svelte

df3c0f2b3da4atagen2026-10-22 13:07 UTC1
<script lang="ts">
df3c0f2b3da4atagen2026-10-22 13:07 UTC2
  import { createEventDispatcher } from 'svelte';
df3c0f2b3da4atagen2026-10-22 13:07 UTC3
  import {
df3c0f2b3da4atagen2026-10-22 13:07 UTC4
    LINE_HEIGHT_DEFAULT,
df3c0f2b3da4atagen2026-10-22 13:07 UTC5
    LINE_HEIGHT_MAX,
df3c0f2b3da4atagen2026-10-22 13:07 UTC6
    LINE_HEIGHT_MIN,
df3c0f2b3da4atagen2026-10-22 13:07 UTC7
    MESSAGE_SPACING_DEFAULT,
df3c0f2b3da4atagen2026-10-22 13:07 UTC8
    MESSAGE_SPACING_MAX,
df3c0f2b3da4atagen2026-10-22 13:07 UTC9
    MESSAGE_SPACING_MIN,
df3c0f2b3da4atagen2026-10-22 13:07 UTC10
    lineHeight,
c122e088beceatagen2026-10-25 02:37 UTC11
    messageSpacing
df3c0f2b3da4atagen2026-10-22 13:07 UTC12
  } from './appearance';
df3c0f2b3da4atagen2026-10-22 13:07 UTC13
  import { DEFAULT_QUICK_REACTIONS } from './quick-reactions';
df3c0f2b3da4atagen2026-10-22 13:07 UTC14
  import ReactionPicker from './ReactionPicker.svelte';
c122e088beceatagen2026-10-25 02:37 UTC15
  import ThemeSettings from './ThemeSettings.svelte';
df3c0f2b3da4atagen2026-10-22 13:07 UTC16
  import type { ImagePack, QuickReaction } from './types';
df3c0f2b3da4atagen2026-10-22 13:07 UTC17
df3c0f2b3da4atagen2026-10-22 13:07 UTC18
  export let quick: QuickReaction[];
df3c0f2b3da4atagen2026-10-22 13:07 UTC19
  export let packs: ImagePack[] = [];
df3c0f2b3da4atagen2026-10-22 13:07 UTC20
  export let onQuickChange: (list: QuickReaction[]) => void;
df3c0f2b3da4atagen2026-10-22 13:07 UTC21
d095131eec0eatagen2026-10-24 08:39 UTC22
  const dispatch = createEventDispatcher<{ close: void; packs: void }>();
df3c0f2b3da4atagen2026-10-22 13:07 UTC23
df3c0f2b3da4atagen2026-10-22 13:07 UTC24
  $: quickIsDefault =
df3c0f2b3da4atagen2026-10-22 13:07 UTC25
    quick.length === DEFAULT_QUICK_REACTIONS.length && quick.every((r, i) => r.key === DEFAULT_QUICK_REACTIONS[i].key);
df3c0f2b3da4atagen2026-10-22 13:07 UTC26
df3c0f2b3da4atagen2026-10-22 13:07 UTC27
</script>
df3c0f2b3da4atagen2026-10-22 13:07 UTC28
df3c0f2b3da4atagen2026-10-22 13:07 UTC29
<div class="modal settings" role="dialog" aria-modal="true" aria-label="Settings">
df3c0f2b3da4atagen2026-10-22 13:07 UTC30
  <div class="modal-tabs" role="tablist" aria-label="Settings">
df3c0f2b3da4atagen2026-10-22 13:07 UTC31
    <button type="button" role="tab" aria-selected="true" class="active">Settings</button>
df3c0f2b3da4atagen2026-10-22 13:07 UTC32
    <button type="button" class="icon-btn modal-x" aria-label="Close settings" on:click={() => dispatch('close')}>
df3c0f2b3da4atagen2026-10-22 13:07 UTC33
      <span aria-hidden="true">✕</span>
df3c0f2b3da4atagen2026-10-22 13:07 UTC34
    </button>
df3c0f2b3da4atagen2026-10-22 13:07 UTC35
  </div>
df3c0f2b3da4atagen2026-10-22 13:07 UTC36
c122e088beceatagen2026-10-25 02:37 UTC37
  <ThemeSettings />
df3c0f2b3da4atagen2026-10-22 13:07 UTC38
df3c0f2b3da4atagen2026-10-22 13:07 UTC39
  <section aria-label="Message spacing">
df3c0f2b3da4atagen2026-10-22 13:07 UTC40
    <h3 class="sec-h">Space between messages</h3>
df3c0f2b3da4atagen2026-10-22 13:07 UTC41
    <div class="range">
df3c0f2b3da4atagen2026-10-22 13:07 UTC42
      <input
df3c0f2b3da4atagen2026-10-22 13:07 UTC43
        type="range"
df3c0f2b3da4atagen2026-10-22 13:07 UTC44
        min={MESSAGE_SPACING_MIN}
df3c0f2b3da4atagen2026-10-22 13:07 UTC45
        max={MESSAGE_SPACING_MAX}
df3c0f2b3da4atagen2026-10-22 13:07 UTC46
        step="1"
df3c0f2b3da4atagen2026-10-22 13:07 UTC47
        bind:value={$messageSpacing}
df3c0f2b3da4atagen2026-10-22 13:07 UTC48
        aria-label="Space between messages in pixels"
df3c0f2b3da4atagen2026-10-22 13:07 UTC49
      />
df3c0f2b3da4atagen2026-10-22 13:07 UTC50
      <span class="value">{$messageSpacing}px</span>
df3c0f2b3da4atagen2026-10-22 13:07 UTC51
      <button
df3c0f2b3da4atagen2026-10-22 13:07 UTC52
        type="button"
df3c0f2b3da4atagen2026-10-22 13:07 UTC53
        class="ghost-btn"
df3c0f2b3da4atagen2026-10-22 13:07 UTC54
        disabled={$messageSpacing === MESSAGE_SPACING_DEFAULT}
df3c0f2b3da4atagen2026-10-22 13:07 UTC55
        on:click={() => messageSpacing.set(MESSAGE_SPACING_DEFAULT)}
df3c0f2b3da4atagen2026-10-22 13:07 UTC56
      >
df3c0f2b3da4atagen2026-10-22 13:07 UTC57
        Reset
df3c0f2b3da4atagen2026-10-22 13:07 UTC58
      </button>
df3c0f2b3da4atagen2026-10-22 13:07 UTC59
    </div>
df3c0f2b3da4atagen2026-10-22 13:07 UTC60
    <h3 class="sec-h">Line height</h3>
df3c0f2b3da4atagen2026-10-22 13:07 UTC61
    <div class="range">
df3c0f2b3da4atagen2026-10-22 13:07 UTC62
      <input
df3c0f2b3da4atagen2026-10-22 13:07 UTC63
        type="range"
df3c0f2b3da4atagen2026-10-22 13:07 UTC64
        min={LINE_HEIGHT_MIN}
df3c0f2b3da4atagen2026-10-22 13:07 UTC65
        max={LINE_HEIGHT_MAX}
df3c0f2b3da4atagen2026-10-22 13:07 UTC66
        step="0.05"
df3c0f2b3da4atagen2026-10-22 13:07 UTC67
        bind:value={$lineHeight}
df3c0f2b3da4atagen2026-10-22 13:07 UTC68
        aria-label="Line height within messages"
df3c0f2b3da4atagen2026-10-22 13:07 UTC69
      />
df3c0f2b3da4atagen2026-10-22 13:07 UTC70
      <span class="value">{$lineHeight.toFixed(2)}</span>
df3c0f2b3da4atagen2026-10-22 13:07 UTC71
      <button
df3c0f2b3da4atagen2026-10-22 13:07 UTC72
        type="button"
df3c0f2b3da4atagen2026-10-22 13:07 UTC73
        class="ghost-btn"
df3c0f2b3da4atagen2026-10-22 13:07 UTC74
        disabled={$lineHeight === LINE_HEIGHT_DEFAULT}
df3c0f2b3da4atagen2026-10-22 13:07 UTC75
        on:click={() => lineHeight.set(LINE_HEIGHT_DEFAULT)}
df3c0f2b3da4atagen2026-10-22 13:07 UTC76
      >
df3c0f2b3da4atagen2026-10-22 13:07 UTC77
        Reset
df3c0f2b3da4atagen2026-10-22 13:07 UTC78
      </button>
df3c0f2b3da4atagen2026-10-22 13:07 UTC79
    </div>
df3c0f2b3da4atagen2026-10-22 13:07 UTC80
  </section>
df3c0f2b3da4atagen2026-10-22 13:07 UTC81
df3c0f2b3da4atagen2026-10-22 13:07 UTC82
  <section aria-label="Quick reactions">
df3c0f2b3da4atagen2026-10-22 13:07 UTC83
    <div class="sec-head">
df3c0f2b3da4atagen2026-10-22 13:07 UTC84
      <h3 class="sec-h">Quick reactions</h3>
df3c0f2b3da4atagen2026-10-22 13:07 UTC85
      <button type="button" class="ghost-btn" disabled={quickIsDefault} on:click={() => onQuickChange(DEFAULT_QUICK_REACTIONS)}>
df3c0f2b3da4atagen2026-10-22 13:07 UTC86
        Reset
df3c0f2b3da4atagen2026-10-22 13:07 UTC87
      </button>
df3c0f2b3da4atagen2026-10-22 13:07 UTC88
    </div>
df3c0f2b3da4atagen2026-10-22 13:07 UTC89
    <ReactionPicker embedded {quick} {packs} {onQuickChange} onPick={() => {}} onClose={() => dispatch('close')} />
df3c0f2b3da4atagen2026-10-22 13:07 UTC90
  </section>
d095131eec0eatagen2026-10-24 08:39 UTC91
d095131eec0eatagen2026-10-24 08:39 UTC92
  <section aria-label="Packs">
d095131eec0eatagen2026-10-24 08:39 UTC93
    <div class="sec-head">
d095131eec0eatagen2026-10-24 08:39 UTC94
      <h3 class="sec-h">Sticker and emoji packs</h3>
d095131eec0eatagen2026-10-24 08:39 UTC95
      <button type="button" class="ghost-btn" on:click={() => dispatch('packs')}>Manage</button>
d095131eec0eatagen2026-10-24 08:39 UTC96
    </div>
d095131eec0eatagen2026-10-24 08:39 UTC97
  </section>
df3c0f2b3da4atagen2026-10-22 13:07 UTC98
</div>
df3c0f2b3da4atagen2026-10-22 13:07 UTC99
df3c0f2b3da4atagen2026-10-22 13:07 UTC100
<style>
df3c0f2b3da4atagen2026-10-22 13:07 UTC101
  .settings { max-height: calc(100dvh - 32px); overflow-y: auto; }
c122e088beceatagen2026-10-25 02:37 UTC102
  section { margin-top: 18px; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC103
  .sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC104
  .sec-head .sec-h { margin: 0; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC105
  .sec-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC106
  .range + .sec-h { margin-top: 12px; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC107
  .range { display: flex; align-items: center; gap: 10px; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC108
  .range input[type='range'] { flex: 1; accent-color: var(--accent); }
df3c0f2b3da4atagen2026-10-22 13:07 UTC109
  .value { font-size: 13px; min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
df3c0f2b3da4atagen2026-10-22 13:07 UTC110
</style>