drixio 1.2.0 → 1.2.1

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.
@@ -0,0 +1,85 @@
1
+ import{a as e,i as t,n,r}from"./index-CmbAXgDl.js";async function i(){let i=document.getElementById(`recycle-bin-modal`);i&&i.remove(),i=document.createElement(`div`),i.id=`recycle-bin-modal`,i.className=`modal-overlay`,i.setAttribute(`role`,`dialog`),i.setAttribute(`aria-modal`,`true`),i.setAttribute(`aria-labelledby`,`recycle-bin-title`),document.body.appendChild(i);let o=e=>{e.key===`Escape`&&s()};window.addEventListener(`keydown`,o);function s(){window.removeEventListener(`keydown`,o),i.remove()}i.onclick=e=>{e.target===i&&s()},i.innerHTML=`
2
+ <div class="modal-dialog recycle-bin-dialog">
3
+ <div class="modal-header">
4
+ <div class="modal-header-info">
5
+ <div class="modal-icon-badge" style="background: rgba(239, 68, 68, 0.1); color: #ef4444;">
6
+ <span class="material-symbols-outlined">delete</span>
7
+ </div>
8
+ <div>
9
+ <h3 id="recycle-bin-title" class="modal-title">Table Recycle Bin</h3>
10
+ <p class="modal-subtitle">Tables moved to trash can be restored instantly or permanently purged.</p>
11
+ </div>
12
+ </div>
13
+ <button class="modal-close-btn" id="recycle-bin-close-btn" aria-label="Close modal">
14
+ <span class="material-symbols-outlined">close</span>
15
+ </button>
16
+ </div>
17
+ <div class="modal-body" id="recycle-bin-body" style="min-height: 200px; display: flex; align-items: center; justify-content: center;">
18
+ <div style="display: flex; align-items: center; gap: 8px; color: var(--color-text-dim);">
19
+ <span class="material-symbols-outlined animate-spin icon-20">progress_activity</span>
20
+ <span>Loading deleted tables...</span>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ `,document.getElementById(`recycle-bin-close-btn`).onclick=s,await c();async function c(){let i=document.getElementById(`recycle-bin-body`);if(!i)return;let o=await n(),s=o.success?o.data:[];if(window.updateSidebarTrashBadge&&window.updateSidebarTrashBadge(s.length),s.length===0){i.style.display=`flex`,i.innerHTML=`
25
+ <div class="recycle-bin-empty-state" style="text-align: center; padding: 40px 20px;">
26
+ <div style="width: 56px; height: 56px; border-radius: 50%; background: var(--color-bg-subtle, rgba(255,255,255,0.05)); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; color: var(--color-text-dim);">
27
+ <span class="material-symbols-outlined" style="font-size: 28px;">delete_outline</span>
28
+ </div>
29
+ <h4 style="margin: 0 0 6px 0; font-size: 15px; font-weight: 600; color: var(--color-text);">Recycle Bin is Empty</h4>
30
+ <p style="margin: 0; font-size: 13px; color: var(--color-text-dim); max-width: 320px;">
31
+ No tables in the trash. When you delete a table in Studio, it is safely retained here for instant recovery.
32
+ </p>
33
+ </div>
34
+ `;return}i.style.display=`block`,i.innerHTML=`
35
+ ${s.length>=10?`
36
+ <div class="recycle-bin-tip-banner" style="display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.25); color: #f59e0b; margin-bottom: 16px; font-size: 12.5px;">
37
+ <span class="material-symbols-outlined" style="font-size: 18px; margin-top: 1px;">info</span>
38
+ <div>
39
+ <strong>Notice:</strong> You have ${s.length} tables in the recycle bin. If you are using a cloud database (Supabase, RDS, PlanetScale), consider purging old tables to keep your catalog clean.
40
+ </div>
41
+ </div>
42
+ `:``}
43
+
44
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;">
45
+ <span style="font-size: 13px; font-weight: 500; color: var(--color-text-dim);">
46
+ ${s.length} ${s.length===1?`table`:`tables`} in trash
47
+ </span>
48
+ <button id="purge-all-btn" class="btn btn-outline-danger" style="font-size: 12px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 4px;">
49
+ <span class="material-symbols-outlined icon-16">delete_forever</span>
50
+ <span>Empty Recycle Bin</span>
51
+ </button>
52
+ </div>
53
+
54
+ <div class="recycle-bin-table-list" style="display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto;">
55
+ ${s.map(e=>{let t=a(e.deletedAt);return`
56
+ <div class="recycle-bin-item-row" data-trash-id="${e.trashId}" style="display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 8px; background: var(--color-bg-subtle, rgba(255,255,255,0.03)); border: 1px solid var(--color-border); transition: border-color 0.2s;">
57
+ <div style="display: flex; flex-direction: column; gap: 4px; overflow: hidden; max-width: 65%;">
58
+ <div style="display: flex; align-items: center; gap: 8px;">
59
+ <span class="material-symbols-outlined icon-18" style="color: var(--color-primary);">table</span>
60
+ <span style="font-weight: 600; font-size: 14px; color: var(--color-text); text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">${e.originalName}</span>
61
+ <span class="badge" style="font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text-dim);">
62
+ ${e.rowCount.toLocaleString()} rows
63
+ </span>
64
+ ${e.hasLocalBackup?`<span class="badge" style="font-size: 11px; padding: 2px 6px; border-radius: 4px; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: #10b981;" title="Local snapshot JSON exists in .drixio/backups">💾 Backup</span>`:``}
65
+ </div>
66
+ <div style="display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-text-dim);">
67
+ <span>Deleted ${t}</span>
68
+ <span>•</span>
69
+ <span style="font-family: monospace; font-size: 11px; opacity: 0.7;">${e.trashId}</span>
70
+ </div>
71
+ </div>
72
+
73
+ <div style="display: flex; align-items: center; gap: 8px;">
74
+ <button class="btn btn-primary restore-item-btn" data-trash-id="${e.trashId}" data-orig-name="${e.originalName}" style="font-size: 12px; padding: 5px 12px; display: inline-flex; align-items: center; gap: 4px;">
75
+ <span class="material-symbols-outlined icon-16">settings_backup_restore</span>
76
+ <span>Restore</span>
77
+ </button>
78
+ <button class="btn btn-ghost purge-item-btn" data-trash-id="${e.trashId}" data-orig-name="${e.originalName}" title="Permanently delete from database" style="color: #ef4444; padding: 6px 8px;">
79
+ <span class="material-symbols-outlined icon-18">delete_forever</span>
80
+ </button>
81
+ </div>
82
+ </div>
83
+ `}).join(``)}
84
+ </div>
85
+ `;let l=document.getElementById(`purge-all-btn`);l&&(l.onclick=async()=>{if(!confirm(`Are you sure you want to PERMANENTLY delete all ${s.length} tables in the recycle bin? This will physically drop them from the database and free up storage.`))return;l.disabled=!0,l.innerHTML=`<span class="material-symbols-outlined animate-spin icon-16">progress_activity</span> Purging...`;let e=await r();e.success?(window.showToast&&window.showToast(`Recycle bin emptied (${e.data.purgedCount} tables purged).`,`success`),await c()):(alert(e.error||`Failed to empty recycle bin.`),l.disabled=!1,l.innerHTML=`<span class="material-symbols-outlined icon-16">delete_forever</span> Empty Recycle Bin`)}),i.querySelectorAll(`.restore-item-btn`).forEach(t=>{t.onclick=async()=>{let n=t.dataset.trashId;t.dataset.origName,t.disabled=!0,t.innerHTML=`<span class="material-symbols-outlined animate-spin icon-16">progress_activity</span> Restoring...`;let r=await e(n);if(r.success){let e=r.data.restoredTable;window.showToast&&window.showToast(`Table "${e}" restored successfully!`,`success`),window.refreshTableList&&await window.refreshTableList(!0),window.AppState&&(window.AppState.currentTable=e,window.renderCurrentView&&window.renderCurrentView()),await c()}else alert(r.error||`Failed to restore table.`),t.disabled=!1,t.innerHTML=`<span class="material-symbols-outlined icon-16">settings_backup_restore</span> Restore`}}),i.querySelectorAll(`.purge-item-btn`).forEach(e=>{e.onclick=async()=>{let n=e.dataset.trashId,r=e.dataset.origName;if(!confirm(`Permanently delete table "${r}" from the database? This cannot be undone.`))return;e.disabled=!0;let i=await t(n);i.success?(window.showToast&&window.showToast(`Table "${r}" permanently purged.`,`info`),await c()):(alert(i.error||`Failed to purge table.`),e.disabled=!1)}})}}function a(e){if(!e||e<=0)return`recently`;let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:new Date(e).toLocaleDateString()}export{i as openRecycleBinModal};