vista-core-js 0.0.2
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/dist/ErrorOverlay.d.ts +7 -0
- package/dist/ErrorOverlay.js +68 -0
- package/dist/app.d.ts +21 -0
- package/dist/app.js +119 -0
- package/dist/client/link.d.ts +23 -0
- package/dist/client/link.js +42 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +290 -0
- package/dist/components/PixelBlast.d.ts +28 -0
- package/dist/components/PixelBlast.js +584 -0
- package/dist/entry-client.d.ts +1 -0
- package/dist/entry-client.js +56 -0
- package/dist/entry-server.d.ts +9 -0
- package/dist/entry-server.js +33 -0
- package/dist/error-overlay.d.ts +1 -0
- package/dist/error-overlay.js +166 -0
- package/dist/font/google/index.d.ts +1923 -0
- package/dist/font/google/index.js +1948 -0
- package/dist/image/get-img-props.d.ts +20 -0
- package/dist/image/get-img-props.js +46 -0
- package/dist/image/image-config.d.ts +20 -0
- package/dist/image/image-config.js +17 -0
- package/dist/image/image-loader.d.ts +7 -0
- package/dist/image/image-loader.js +10 -0
- package/dist/image/index.d.ts +12 -0
- package/dist/image/index.js +12 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.js +88 -0
- package/dist/router.d.ts +18 -0
- package/dist/router.js +55 -0
- package/package.json +47 -0
- package/src/ErrorOverlay.tsx +194 -0
- package/src/app.tsx +138 -0
- package/src/assets/vista.gif +0 -0
- package/src/client/link.tsx +85 -0
- package/src/client.tsx +368 -0
- package/src/entry-client.tsx +70 -0
- package/src/entry-server.tsx +58 -0
- package/src/error-overlay.ts +187 -0
- package/src/font/google/index.d.ts +19011 -0
- package/src/font/google/index.ts +1968 -0
- package/src/font/types.d.ts +13 -0
- package/src/image/get-img-props.ts +100 -0
- package/src/image/image-config.ts +22 -0
- package/src/image/image-loader.ts +23 -0
- package/src/image/index.tsx +21 -0
- package/src/index.ts +7 -0
- package/src/plugin.ts +100 -0
- package/src/router-loader.ts +51 -0
- package/src/router.tsx +80 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export function showErrorOverlay(err, title = 'Application Error') {
|
|
2
|
+
if (typeof document === 'undefined')
|
|
3
|
+
return;
|
|
4
|
+
// Check if overlay already exists
|
|
5
|
+
if (document.getElementById('vista-error-overlay'))
|
|
6
|
+
return;
|
|
7
|
+
// Create fonts and animations
|
|
8
|
+
const style = document.createElement('style');
|
|
9
|
+
style.innerHTML = `
|
|
10
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');
|
|
11
|
+
|
|
12
|
+
.vista-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
|
|
13
|
+
.vista-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
|
|
14
|
+
.vista-scrollbar::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
|
|
15
|
+
.vista-scrollbar::-webkit-scrollbar-thumb:hover { background: #555; }
|
|
16
|
+
|
|
17
|
+
@keyframes vistaFadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
18
|
+
@keyframes vistaSlideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
19
|
+
@keyframes vistaPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 85, 85, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(255, 85, 85, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 85, 85, 0); } }
|
|
20
|
+
`;
|
|
21
|
+
document.head.appendChild(style);
|
|
22
|
+
const overlay = document.createElement('div');
|
|
23
|
+
overlay.id = 'vista-error-overlay';
|
|
24
|
+
// Overlay handles blocking interaction when expanded, but lets clicks through when minimized
|
|
25
|
+
overlay.style.cssText = `
|
|
26
|
+
position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
|
|
27
|
+
z-index: 2147483647; display: flex; align-items: center; justify-content: center;
|
|
28
|
+
font-family: 'Inter', -apple-system, sans-serif; color: #fff;
|
|
29
|
+
pointer-events: auto; background: rgba(0, 0, 0, 0.85);
|
|
30
|
+
backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
|
|
31
|
+
transition: all 0.3s ease;
|
|
32
|
+
`;
|
|
33
|
+
const container = document.createElement('div');
|
|
34
|
+
container.style.cssText = `
|
|
35
|
+
background: #0A0A0A; border: 1px solid #333; border-radius: 16px;
|
|
36
|
+
box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 24px 72px rgba(0,0,0,0.5);
|
|
37
|
+
width: 90%; max-width: 900px; max-height: 85vh;
|
|
38
|
+
display: flex; flex-direction: column; overflow: hidden;
|
|
39
|
+
animation: vistaSlideUp 0.3s ease-out 0.1s backwards;
|
|
40
|
+
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
|
|
41
|
+
`;
|
|
42
|
+
// HEADER
|
|
43
|
+
const header = document.createElement('div');
|
|
44
|
+
header.style.cssText = `
|
|
45
|
+
padding: 16px 24px; border-bottom: 1px solid #222; background: rgba(255,255,255,0.02);
|
|
46
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
47
|
+
`;
|
|
48
|
+
const titleGroup = document.createElement('div');
|
|
49
|
+
titleGroup.style.display = 'flex';
|
|
50
|
+
titleGroup.style.alignItems = 'center';
|
|
51
|
+
titleGroup.style.gap = '12px';
|
|
52
|
+
titleGroup.innerHTML = `
|
|
53
|
+
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" width="20" height="20" style="color: #FF5555;">
|
|
54
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
|
55
|
+
</svg>
|
|
56
|
+
<div style="font-size: 14px; font-weight: 600; color: #EDEDED;">${title}</div>
|
|
57
|
+
`;
|
|
58
|
+
const actions = document.createElement('div');
|
|
59
|
+
actions.style.display = 'flex';
|
|
60
|
+
actions.style.gap = '8px';
|
|
61
|
+
const minimizeBtn = document.createElement('button');
|
|
62
|
+
minimizeBtn.innerHTML = `
|
|
63
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
64
|
+
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
65
|
+
</svg>
|
|
66
|
+
`;
|
|
67
|
+
minimizeBtn.title = "Minimize Overlay";
|
|
68
|
+
minimizeBtn.style.cssText = `
|
|
69
|
+
background: transparent; border: none; color: #888; cursor: pointer;
|
|
70
|
+
padding: 4px; border-radius: 4px; display: flex; align-items: center; justify-content: center;
|
|
71
|
+
`;
|
|
72
|
+
minimizeBtn.onmouseover = () => { minimizeBtn.style.background = 'rgba(255,255,255,0.1)'; minimizeBtn.style.color = '#fff'; };
|
|
73
|
+
minimizeBtn.onmouseout = () => { minimizeBtn.style.background = 'transparent'; minimizeBtn.style.color = '#888'; };
|
|
74
|
+
const closeBtn = document.createElement('button'); // Reuse logic for minimize
|
|
75
|
+
actions.appendChild(minimizeBtn);
|
|
76
|
+
header.appendChild(titleGroup);
|
|
77
|
+
header.appendChild(actions);
|
|
78
|
+
// BODY
|
|
79
|
+
const body = document.createElement('div');
|
|
80
|
+
body.className = 'vista-scrollbar';
|
|
81
|
+
body.style.cssText = `padding: 24px; overflow-y: auto; flex: 1;`;
|
|
82
|
+
const message = document.createElement('h2');
|
|
83
|
+
message.style.cssText = `margin: 0 0 20px 0; font-size: 18px; font-weight: 500; line-height: 1.4; color: #ffffff;`;
|
|
84
|
+
message.textContent = err.message || 'Unknown Error';
|
|
85
|
+
const stackContainer = document.createElement('div');
|
|
86
|
+
stackContainer.style.cssText = `
|
|
87
|
+
background: #111; border: 1px solid #222; border-radius: 8px; padding: 16px;
|
|
88
|
+
overflow-x: auto; font-family: 'JetBrains Mono', monospace; font-size: 12px;
|
|
89
|
+
line-height: 1.6; color: #A1A1AA;
|
|
90
|
+
`;
|
|
91
|
+
const stack = err.stack ? err.stack.replace(err.message, '') : '';
|
|
92
|
+
const formattedStack = stack.split('\n').filter(line => line.trim() !== '')
|
|
93
|
+
.map(line => line.replace(/(\(.*\))/, '<span style="color: #666;">$1</span>').replace(/(at\s+)/, '<span style="color: #FF5555;">$1</span>'))
|
|
94
|
+
.join('\n');
|
|
95
|
+
stackContainer.innerHTML = `<pre style="margin:0">${formattedStack || 'No stack trace available.'}</pre>`;
|
|
96
|
+
body.appendChild(message);
|
|
97
|
+
body.appendChild(stackContainer);
|
|
98
|
+
// FOOTER
|
|
99
|
+
const footer = document.createElement('div');
|
|
100
|
+
footer.style.cssText = `
|
|
101
|
+
padding: 16px 24px; border-top: 1px solid #222; background: #0A0A0A;
|
|
102
|
+
display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #555;
|
|
103
|
+
`;
|
|
104
|
+
footer.innerHTML = `
|
|
105
|
+
<span>Vista Framework Debugger</span>
|
|
106
|
+
<button onclick="window.location.reload()" style="
|
|
107
|
+
background: #fff; color: #000; border: none; padding: 6px 12px; border-radius: 6px;
|
|
108
|
+
font-weight: 600; font-size: 13px; cursor: pointer; transition: opacity 0.2s;
|
|
109
|
+
" onmouseover="this.style.opacity=0.9" onmouseout="this.style.opacity=1">Reload Page</button>
|
|
110
|
+
`;
|
|
111
|
+
container.appendChild(header);
|
|
112
|
+
container.appendChild(body);
|
|
113
|
+
container.appendChild(footer);
|
|
114
|
+
overlay.appendChild(container);
|
|
115
|
+
// RESTORE BADGE (Hidden primarily)
|
|
116
|
+
const restoreBadge = document.createElement('div');
|
|
117
|
+
restoreBadge.style.cssText = `
|
|
118
|
+
position: fixed; bottom: 20px; right: 20px;
|
|
119
|
+
background: #FF5555; color: white;
|
|
120
|
+
padding: 10px 16px; border-radius: 30px;
|
|
121
|
+
font-weight: 600; font-size: 13px;
|
|
122
|
+
box-shadow: 0 4px 12px rgba(255, 85, 85, 0.4);
|
|
123
|
+
cursor: pointer; z-index: 2147483647;
|
|
124
|
+
display: flex; align-items: center; gap: 8px;
|
|
125
|
+
transform: translateY(100px); opacity: 0;
|
|
126
|
+
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
127
|
+
animation: vistaPulse 2s infinite;
|
|
128
|
+
`;
|
|
129
|
+
restoreBadge.innerHTML = `
|
|
130
|
+
<svg fill="none" viewBox="0 0 24 24" stroke="currentColor" width="16" height="16">
|
|
131
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
|
132
|
+
</svg>
|
|
133
|
+
<span>Error Detected</span>
|
|
134
|
+
`;
|
|
135
|
+
document.body.appendChild(restoreBadge);
|
|
136
|
+
document.body.appendChild(overlay);
|
|
137
|
+
// LOGIC
|
|
138
|
+
let isMinimized = false;
|
|
139
|
+
const toggleMinimize = () => {
|
|
140
|
+
isMinimized = !isMinimized;
|
|
141
|
+
if (isMinimized) {
|
|
142
|
+
// Minimize
|
|
143
|
+
container.style.transform = 'scale(0.9) translateY(20px)';
|
|
144
|
+
container.style.opacity = '0';
|
|
145
|
+
overlay.style.background = 'rgba(0,0,0,0)';
|
|
146
|
+
overlay.style.backdropFilter = 'none';
|
|
147
|
+
overlay.style.webkitBackdropFilter = 'none';
|
|
148
|
+
overlay.style.pointerEvents = 'none';
|
|
149
|
+
restoreBadge.style.transform = 'translateY(0)';
|
|
150
|
+
restoreBadge.style.opacity = '1';
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// Restore
|
|
154
|
+
container.style.transform = 'scale(1) translateY(0)';
|
|
155
|
+
container.style.opacity = '1';
|
|
156
|
+
overlay.style.background = 'rgba(0, 0, 0, 0.85)';
|
|
157
|
+
overlay.style.backdropFilter = 'blur(12px)';
|
|
158
|
+
overlay.style.webkitBackdropFilter = 'blur(12px)';
|
|
159
|
+
overlay.style.pointerEvents = 'auto';
|
|
160
|
+
restoreBadge.style.transform = 'translateY(100px)';
|
|
161
|
+
restoreBadge.style.opacity = '0';
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
minimizeBtn.onclick = toggleMinimize;
|
|
165
|
+
restoreBadge.onclick = toggleMinimize;
|
|
166
|
+
}
|