@cccarv82/freya 1.0.64 → 1.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/web-ui.css +0 -3
- package/cli/web-ui.js +27 -35
- package/package.json +1 -1
package/cli/web-ui.css
CHANGED
|
@@ -356,9 +356,6 @@ body {
|
|
|
356
356
|
.reportPreview strong { font-weight: 700; }
|
|
357
357
|
.reportPreview em { font-style: italic; }
|
|
358
358
|
|
|
359
|
-
.reportRaw { display: none; width: 100%; overflow: hidden; resize: none; }
|
|
360
|
-
.reportCard.raw .reportPreview { display: none; }
|
|
361
|
-
.reportCard.raw .reportRaw { display: block; }
|
|
362
359
|
.centerHead { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 14px; }
|
|
363
360
|
.statusLine { display:flex; align-items:center; justify-content:flex-end; gap: 12px; }
|
|
364
361
|
|
package/cli/web-ui.js
CHANGED
|
@@ -555,7 +555,7 @@
|
|
|
555
555
|
for (const item of list) {
|
|
556
556
|
const card = document.createElement('div');
|
|
557
557
|
const mode = state.reportModes[item.relPath] || 'preview';
|
|
558
|
-
const expanded =
|
|
558
|
+
const expanded = state.reportExpanded && state.reportExpanded[item.relPath];
|
|
559
559
|
card.className = 'reportCard' + (mode === 'raw' ? ' raw' : '') + (expanded ? ' expanded' : '');
|
|
560
560
|
|
|
561
561
|
const meta = fmtWhen(item.mtimeMs);
|
|
@@ -565,34 +565,21 @@
|
|
|
565
565
|
+ '<div class="reportName">' + escapeHtml(item.name) + '</div>'
|
|
566
566
|
+ '<div class="reportMeta">'
|
|
567
567
|
+ '<span class="reportMetaText">' + escapeHtml(item.relPath) + ' • ' + escapeHtml(meta) + '</span>'
|
|
568
|
+
+ '<button class="iconBtn" data-action="copy" title="Copiar">⧉</button>'
|
|
568
569
|
+ '<button class="iconBtn" data-action="pdf" title="Baixar PDF">⬇</button>'
|
|
569
570
|
+ '</div>'
|
|
570
571
|
+ '</div>'
|
|
571
572
|
+ '<div class="reportHeadActions">'
|
|
572
|
-
+ '<button class="btn small" data-action="toggle">' + (mode === 'raw' ? 'Preview' : 'Markdown') + '</button>'
|
|
573
573
|
+ '<button class="btn small primary" data-action="save">Salvar</button>'
|
|
574
574
|
+ '</div>'
|
|
575
575
|
+ '</div>'
|
|
576
576
|
+ '<div class="reportBody">'
|
|
577
577
|
+ '<div class="reportPreview" contenteditable="true"></div>'
|
|
578
|
-
+ '<textarea class="reportRaw" rows="6"></textarea>'
|
|
579
578
|
+ '</div>';
|
|
580
579
|
|
|
581
580
|
const text = state.reportTexts[item.relPath] || '';
|
|
582
581
|
const preview = card.querySelector('.reportPreview');
|
|
583
582
|
if (preview) preview.innerHTML = renderMarkdown(text || '');
|
|
584
|
-
const raw = card.querySelector('.reportRaw');
|
|
585
|
-
if (raw) {
|
|
586
|
-
raw.value = text;
|
|
587
|
-
autoGrowTextarea(raw);
|
|
588
|
-
raw.addEventListener('input', () => {
|
|
589
|
-
state.reportTexts[item.relPath] = raw.value;
|
|
590
|
-
autoGrowTextarea(raw);
|
|
591
|
-
if (state.reportModes[item.relPath] !== 'raw' && preview && !preview.dataset.editing) {
|
|
592
|
-
preview.innerHTML = renderMarkdown(raw.value);
|
|
593
|
-
}
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
583
|
|
|
597
584
|
if (preview) {
|
|
598
585
|
preview.addEventListener('focus', () => {
|
|
@@ -603,24 +590,10 @@
|
|
|
603
590
|
preview.dataset.editing = '';
|
|
604
591
|
const val = preview.innerText || '';
|
|
605
592
|
state.reportTexts[item.relPath] = val;
|
|
606
|
-
if (raw) {
|
|
607
|
-
raw.value = val;
|
|
608
|
-
autoGrowTextarea(raw);
|
|
609
|
-
}
|
|
610
593
|
preview.innerHTML = renderMarkdown(val);
|
|
611
594
|
});
|
|
612
595
|
}
|
|
613
596
|
|
|
614
|
-
const toggleBtn = card.querySelector('[data-action="toggle"]');
|
|
615
|
-
if (toggleBtn) {
|
|
616
|
-
toggleBtn.onclick = (ev) => {
|
|
617
|
-
ev.stopPropagation();
|
|
618
|
-
state.reportModes[item.relPath] = (state.reportModes[item.relPath] === 'raw') ? 'preview' : 'raw';
|
|
619
|
-
state.reportExpanded[item.relPath] = true;
|
|
620
|
-
renderReportsPage();
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
|
|
624
597
|
const saveBtn = card.querySelector('[data-action="save"]');
|
|
625
598
|
if (saveBtn) {
|
|
626
599
|
saveBtn.onclick = async (ev) => {
|
|
@@ -639,6 +612,30 @@
|
|
|
639
612
|
};
|
|
640
613
|
}
|
|
641
614
|
|
|
615
|
+
const copyBtn = card.querySelector('[data-action="copy"]');
|
|
616
|
+
if (copyBtn) {
|
|
617
|
+
copyBtn.onclick = async (ev) => {
|
|
618
|
+
ev.stopPropagation();
|
|
619
|
+
try {
|
|
620
|
+
const html = renderMarkdown(state.reportTexts[item.relPath] || '');
|
|
621
|
+
const text = (preview && preview.innerText) ? preview.innerText : (state.reportTexts[item.relPath] || '');
|
|
622
|
+
const blob = new Blob([`<div>${html}</div>`], { type: 'text/html' });
|
|
623
|
+
const data = [new ClipboardItem({ 'text/html': blob, 'text/plain': new Blob([text], { type: 'text/plain' }) })];
|
|
624
|
+
await navigator.clipboard.write(data);
|
|
625
|
+
setPill('ok', 'copiado');
|
|
626
|
+
setTimeout(() => setPill('ok', 'pronto'), 800);
|
|
627
|
+
} catch {
|
|
628
|
+
try {
|
|
629
|
+
await navigator.clipboard.writeText(state.reportTexts[item.relPath] || '');
|
|
630
|
+
setPill('ok', 'copiado');
|
|
631
|
+
setTimeout(() => setPill('ok', 'pronto'), 800);
|
|
632
|
+
} catch {
|
|
633
|
+
setPill('err', 'copy failed');
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
642
639
|
const pdfBtn = card.querySelector('[data-action="pdf"]');
|
|
643
640
|
if (pdfBtn) {
|
|
644
641
|
pdfBtn.onclick = (ev) => {
|
|
@@ -656,12 +653,7 @@
|
|
|
656
653
|
};
|
|
657
654
|
}
|
|
658
655
|
|
|
659
|
-
grid.appendChild(card);
|
|
660
|
-
|
|
661
|
-
if (expanded && raw) {
|
|
662
|
-
requestAnimationFrame(() => autoGrowTextarea(raw));
|
|
663
|
-
}
|
|
664
|
-
}
|
|
656
|
+
grid.appendChild(card); }
|
|
665
657
|
}
|
|
666
658
|
|
|
667
659
|
async function refreshReportsPage() {
|