Palettes: pastel-lavender/peach/cloud presets + semantic status colors (#16)
- Three new light [data-preset] blocks alongside midnight (default) and smooth - --ok/--warn/--err semantic tokens with 4.5:1 contrast per preset - .toast success/error variants wired in new.html - ?theme= query param preview hook in layout head (screenshots only) - Preview screenshots in docs/palette-previews/ Closes #16
This commit is contained in:
@@ -74,10 +74,13 @@ function updateGutter() {
|
||||
content.addEventListener('input', updateGutter);
|
||||
updateGutter();
|
||||
|
||||
function toast(msg) {
|
||||
function toast(msg, kind) {
|
||||
let t = document.querySelector('.toast');
|
||||
if (!t) { t = document.createElement('div'); t.className = 'toast'; document.body.appendChild(t); }
|
||||
t.textContent = msg;
|
||||
t.classList.remove('success', 'error');
|
||||
if (kind === 'success') t.classList.add('success');
|
||||
if (kind === 'error') t.classList.add('error');
|
||||
t.classList.add('show');
|
||||
clearTimeout(t._h);
|
||||
t._h = setTimeout(() => t.classList.remove('show'), 2000);
|
||||
@@ -162,12 +165,13 @@ async function create() {
|
||||
const data = await res.json();
|
||||
if (!res.ok) {
|
||||
showResult('Error: ' + (data.error || res.status), true);
|
||||
toast('Create failed', 'error');
|
||||
return;
|
||||
}
|
||||
const url = location.origin + '/' + (data.custom_slug || data.id);
|
||||
showResult('<a href="' + url + '">' + url + '</a>', false);
|
||||
$('result').dataset.token = data.deletion_token || '';
|
||||
try { navigator.clipboard.writeText(url); toast('Copied'); } catch(e) {}
|
||||
try { navigator.clipboard.writeText(url); toast('Copied', 'success'); } catch(e) {}
|
||||
const dest = '/' + data.id + '?created=1&token=' + encodeURIComponent(data.deletion_token || '');
|
||||
// password-protected: unlock now with the password we already have (#26)
|
||||
if ($('haspw').checked && data.id) {
|
||||
|
||||
Reference in New Issue
Block a user