vzcode 0.1.1 → 0.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.
package/src/main.jsx ADDED
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import * as ReactDOM from 'react-dom/client';
3
+ import App from './App';
4
+
5
+ ReactDOM.createRoot(document.getElementById('root')).render(
6
+ <React.StrictMode>
7
+ <App />
8
+ </React.StrictMode>
9
+ );
package/src/ot.js ADDED
@@ -0,0 +1,5 @@
1
+ // This file is the central point where the OT types are imported.
2
+ // Localized to one file so it's easy to change it in future.
3
+ import OTJSON1Presence from 'sharedb-client-browser/dist/ot-json1-presence-umd.cjs';
4
+ const { json1Presence, textUnicode } = OTJSON1Presence;
5
+ export { json1Presence, textUnicode };
@@ -0,0 +1,2 @@
1
+ // Generate a random ID string consisting of digits.
2
+ export const randomId = () => Math.floor(Math.random() * 10000000000) + '';
@@ -0,0 +1,107 @@
1
+ import { useState, useCallback } from 'react';
2
+ import Modal from 'react-bootstrap/Modal';
3
+ import Form from 'react-bootstrap/Form';
4
+ import Button from 'react-bootstrap/Button';
5
+ import Select from 'react-select';
6
+
7
+ // TODO document where this list came from
8
+ // TODO research which themes are available for CodeMirror 6
9
+ const themes = [
10
+ { value: 'default', label: 'default' },
11
+ { value: '3024-day', label: '3024-day' },
12
+ { value: '3024-night', label: '3024-night' },
13
+ { value: 'abbott', label: 'abbott' },
14
+ { value: 'abcdef', label: 'abcdef' },
15
+ { value: 'ambiance', label: 'ambiance' },
16
+ { value: 'ayu-dark', label: 'ayu-dark' },
17
+ { value: 'ayu-mirage', label: 'ayu-mirage' },
18
+ { value: 'base16-dark', label: 'base16-dark' },
19
+ { value: 'base16-light', label: 'base16-light' },
20
+ { value: 'bespin', label: 'bespin' },
21
+ { value: 'blackboard', label: 'blackboard' },
22
+ { value: 'cobalt', label: 'cobalt' },
23
+ { value: 'colorforth', label: 'colorforth' },
24
+ { value: 'darcula', label: 'darcula' },
25
+ { value: 'duotone-dark', label: 'duotone-dark' },
26
+ { value: 'duotone-light', label: 'duotone-light' },
27
+ { value: 'eclipse', label: 'eclipse' },
28
+ { value: 'elegant', label: 'elegant' },
29
+ { value: 'erlang-dark', label: 'erlang-dark' },
30
+ { value: 'gruvbox-dark', label: 'gruvbox-dark' },
31
+ { value: 'hopscotch', label: 'hopscotch' },
32
+ { value: 'icecoder', label: 'icecoder' },
33
+ { value: 'idea', label: 'idea' },
34
+ { value: 'isotope', label: 'isotope' },
35
+ { value: 'juejin', label: 'juejin' },
36
+ { value: 'lesser-dark', label: 'lesser-dark' },
37
+ { value: 'liquibyte', label: 'liquibyte' },
38
+ { value: 'lucario', label: 'lucario' },
39
+ { value: 'material', label: 'material' },
40
+ { value: 'material-darker', label: 'material-darker' },
41
+ { value: 'material-palenight', label: 'material-palenight' },
42
+ { value: 'material-ocean', label: 'material-ocean' },
43
+ { value: 'mbo', label: 'mbo' },
44
+ { value: 'mdn-like', label: 'mdn-like' },
45
+ { value: 'midnight', label: 'midnight' },
46
+ { value: 'monokai', label: 'monokai' },
47
+ { value: 'moxer', label: 'moxer' },
48
+ { value: 'neat', label: 'neat' },
49
+ { value: 'neo', label: 'neo' },
50
+ { value: 'night', label: 'night' },
51
+ { value: 'nord', label: 'nord' },
52
+ { value: 'oceanic-next', label: 'oceanic-next' },
53
+ { value: 'OneDark', label: 'One Dark' },
54
+ { value: 'panda-syntax', label: 'panda-syntax' },
55
+ { value: 'paraiso-dark', label: 'paraiso-dark' },
56
+ { value: 'paraiso-light', label: 'paraiso-light' },
57
+ { value: 'pastel-on-dark', label: 'pastel-on-dark' },
58
+ { value: 'railscasts', label: 'railscasts' },
59
+ { value: 'rubyblue', label: 'rubyblue' },
60
+ { value: 'seti', label: 'seti' },
61
+ { value: 'shadowfox', label: 'shadowfox' },
62
+ { value: 'solarized', label: 'solarized' },
63
+ { value: 'ssms', label: 'ssms' },
64
+ { value: 'the-matrix', label: 'the-matrix' },
65
+ { value: 'tomorrow-night-bright', label: 'tomorrow-night-bright' },
66
+ { value: 'tomorrow-night-eighties', label: 'tomorrow-night-eighties' },
67
+ { value: 'ttcn', label: 'ttcn' },
68
+ { value: 'twilight', label: 'twilight' },
69
+ { value: 'vibrant-ink', label: 'vibrant-ink' },
70
+ { value: 'xq-dark', label: 'xq-dark' },
71
+ { value: 'xq-light', label: 'xq-light' },
72
+ { value: 'yeti', label: 'yeti' },
73
+ { value: 'yonce', label: 'yonce' },
74
+ { value: 'zenburn', label: 'zenburn' },
75
+ ];
76
+
77
+ export const Settings = ({ show, onClose, setTheme }) => {
78
+ const handleChange = useCallback((selectedOption) => {
79
+ setTheme(selectedOption.value);
80
+ }, []);
81
+
82
+ return show ? (
83
+ <Modal show={show} onHide={onClose} animation={false}>
84
+ <Modal.Header closeButton>
85
+ <Modal.Title>Settings</Modal.Title>
86
+ </Modal.Header>
87
+ <Modal.Body>
88
+ <Form.Group className="mb-3" controlId="formFork">
89
+ <Form.Label>Theme</Form.Label>
90
+ <Select
91
+ classvalue="themes"
92
+ options={themes}
93
+ onChange={handleChange}
94
+ />
95
+ <Form.Text className="text-muted">
96
+ Select a color theme for the editor
97
+ </Form.Text>
98
+ </Form.Group>
99
+ </Modal.Body>
100
+ <Modal.Footer>
101
+ <Button variant="primary" onClick={onClose}>
102
+ Done
103
+ </Button>
104
+ </Modal.Footer>
105
+ </Modal>
106
+ ) : null;
107
+ };
package/src/style.css ADDED
@@ -0,0 +1,178 @@
1
+ /* Inspired by: https://www.codinglabweb.com/2021/06/dropdown-sidebar-menu-html-css.html */
2
+ /* Google Fonts Import Link */
3
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
4
+ @import url('https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css');
5
+ @import url('https://unpkg.com/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css');
6
+
7
+ * {
8
+ margin: 0;
9
+ padding: 0;
10
+ box-sizing: border-box;
11
+ }
12
+
13
+ :root {
14
+ --main-font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas,
15
+ Liberation Mono, monospace;
16
+ }
17
+
18
+ body {
19
+ background: rgb(41, 44, 52);
20
+ font-family: 'Poppins', sans-serif;
21
+ }
22
+
23
+ .tab {
24
+ width: max-content;
25
+ height: 30px;
26
+ background: rgb(45, 45, 45);
27
+ text-align: center;
28
+ color: #fff;
29
+ font-family: var(--main-font-family);
30
+ justify-content: center;
31
+ align-items: center;
32
+ display: flex;
33
+ padding-left: 10px;
34
+ padding-right: 10px;
35
+ border-top-left-radius: 10px;
36
+ border-top-right-radius: 10px;
37
+ margin-top: 5px;
38
+ margin-left: 2px;
39
+ margin-right: 2px;
40
+ cursor: pointer;
41
+ }
42
+
43
+ .tab.active {
44
+ background-color: rgb(41, 44, 52);
45
+ }
46
+
47
+ .tab-close {
48
+ display: flex;
49
+ cursor: pointer;
50
+ margin-left: 5px;
51
+ justify-content: center;
52
+ align-items: center;
53
+ }
54
+
55
+ .tab-close:hover {
56
+ border-radius: 30%;
57
+ background-color: rgb(37, 37, 38);
58
+ }
59
+
60
+ .editor {
61
+ position: fixed;
62
+ margin-left: 200px;
63
+ width: 100%;
64
+ height: 100%;
65
+ top: 30px;
66
+ bottom: 0;
67
+ background-color: rgb(41, 44, 52);
68
+ color: #fff;
69
+ font-family: var(--main-font-family);
70
+ }
71
+
72
+ .tab-list {
73
+ position: fixed;
74
+ display: flex;
75
+ flex-direction: row;
76
+ top: 0;
77
+ left: 200px;
78
+ height: 35px;
79
+ width: 100%;
80
+ background: rgb(37, 37, 38);
81
+ z-index: 100;
82
+ transition: all 0.5s ease;
83
+ }
84
+
85
+ .bottom-bar {
86
+ position: absolute;
87
+ bottom: 0;
88
+ left: 0;
89
+ height: 20px;
90
+ width: 100%;
91
+ background: rgb(45, 45, 45);
92
+ z-index: 100;
93
+ transition: all 0.5s ease;
94
+ }
95
+
96
+ .sidebar {
97
+ position: fixed;
98
+ top: 0;
99
+ left: 0;
100
+ height: 100%;
101
+ width: 200px;
102
+ background: rgb(54, 65, 89);
103
+ z-index: 100;
104
+ transition: all 0.5s ease;
105
+ }
106
+
107
+ .link-name {
108
+ margin-top: 30px;
109
+ margin-left: 10px;
110
+ color: rgb(154, 160, 172);
111
+ font-size: 12px;
112
+ text-decoration: none;
113
+ }
114
+
115
+ .file {
116
+ display: flex;
117
+ flex-direction: row;
118
+ align-items: center;
119
+ justify-content: left;
120
+ width: 180px;
121
+ cursor: pointer;
122
+ margin-left: 10px;
123
+ color: rgb(219, 221, 225);
124
+ border-radius: 5px;
125
+ }
126
+
127
+ .full-Box {
128
+ width: inherit;
129
+ height: inherit;
130
+ padding: 7px;
131
+ display: flex;
132
+ flex-direction: row;
133
+ align-items: center;
134
+ justify-content: space-between;
135
+ }
136
+
137
+ .utilities {
138
+ justify-content: right;
139
+ margin-right: 3px;
140
+ }
141
+
142
+ /* TODO consistent naming "no-utils" */
143
+ .noUtils {
144
+ display: none;
145
+ }
146
+
147
+ .settings {
148
+ position: absolute;
149
+ bottom: 0;
150
+ height: 30px;
151
+ /* TODO overhaul CSS to use Flexbox for entire sidebar */
152
+ width: 180px;
153
+ z-index: 100;
154
+ color: rgb(219, 221, 225);
155
+ cursor: pointer;
156
+ display: flex;
157
+ align-items: center;
158
+ justify-content: center;
159
+ padding: 14px 0;
160
+ margin: 10px;
161
+ border-radius: 5px;
162
+ }
163
+
164
+ .file:hover,
165
+ .settings:hover {
166
+ background-color: rgb(74, 84, 105);
167
+ }
168
+
169
+ /* TODO consistent naming new-btn */
170
+ .newBTN {
171
+ justify-content: right;
172
+ margin-right: 10px;
173
+ cursor: pointer;
174
+ }
175
+
176
+ .themes {
177
+ color: rgb(37, 37, 38);
178
+ }