zelune 1.5.2 → 1.5.5

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/src/main.tsx CHANGED
@@ -1,10 +1,80 @@
1
1
  import React from 'react';
2
2
  import ReactDOM from 'react-dom/client';
3
+ import './runtime/MockNavigationContext';
3
4
  import { CanvasApp } from './canvas/CanvasApp';
4
5
  import './styles.css';
5
6
 
7
+ class StudioRootErrorBoundary extends React.Component<
8
+ { children: React.ReactNode },
9
+ { error: Error | null }
10
+ > {
11
+ state: { error: Error | null } = { error: null };
12
+
13
+ static getDerivedStateFromError(error: Error) {
14
+ return { error };
15
+ }
16
+
17
+ render() {
18
+ if (this.state.error) {
19
+ return (
20
+ <div
21
+ style={{
22
+ minHeight: '100vh',
23
+ display: 'flex',
24
+ flexDirection: 'column',
25
+ alignItems: 'center',
26
+ justifyContent: 'center',
27
+ padding: 32,
28
+ backgroundColor: '#09090B',
29
+ color: '#F8FAFC',
30
+ fontFamily: 'system-ui, -apple-system, sans-serif',
31
+ gap: 12,
32
+ }}
33
+ >
34
+ <div style={{ fontSize: 16, fontWeight: 700, color: '#F87171' }}>
35
+ Zelune Studio Recovery Mode
36
+ </div>
37
+ <pre
38
+ style={{
39
+ maxWidth: 720,
40
+ padding: 16,
41
+ borderRadius: 8,
42
+ backgroundColor: '#18181B',
43
+ border: '1px solid #27272A',
44
+ color: '#FCA5A5',
45
+ fontSize: 12,
46
+ whiteSpace: 'pre-wrap',
47
+ wordBreak: 'break-word',
48
+ }}
49
+ >
50
+ {this.state.error.message}
51
+ </pre>
52
+ <button
53
+ type="button"
54
+ onClick={() => this.setState({ error: null })}
55
+ style={{
56
+ padding: '8px 16px',
57
+ borderRadius: 6,
58
+ border: '1px solid #4F46E5',
59
+ backgroundColor: '#4F46E5',
60
+ color: '#FFFFFF',
61
+ fontWeight: 600,
62
+ cursor: 'pointer',
63
+ }}
64
+ >
65
+ Retry Studio Render
66
+ </button>
67
+ </div>
68
+ );
69
+ }
70
+ return this.props.children;
71
+ }
72
+ }
73
+
6
74
  ReactDOM.createRoot(document.getElementById('root')!).render(
7
75
  <React.StrictMode>
8
- <CanvasApp />
76
+ <StudioRootErrorBoundary>
77
+ <CanvasApp />
78
+ </StudioRootErrorBoundary>
9
79
  </React.StrictMode>
10
80
  );