sdocs-dev 1.0.0
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/bin/sdocs-dev.js +443 -0
- package/package.json +40 -0
- package/public/css/layout.css +237 -0
- package/public/css/mobile.css +189 -0
- package/public/css/panel.css +348 -0
- package/public/css/rendered.css +278 -0
- package/public/css/tokens.css +112 -0
- package/public/css/write.css +128 -0
- package/public/default.md +129 -0
- package/public/index.html +533 -0
- package/public/sdocs-app.js +595 -0
- package/public/sdocs-controls.js +221 -0
- package/public/sdocs-export.js +193 -0
- package/public/sdocs-state.js +43 -0
- package/public/sdocs-styles.js +285 -0
- package/public/sdocs-theme.js +168 -0
- package/public/sdocs-write.js +737 -0
- package/public/sdocs-yaml.js +78 -0
- package/server.js +65 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/* ═══════════════════════════════════════════════════
|
|
2
|
+
RESET & BASE
|
|
3
|
+
═══════════════════════════════════════════════════ */
|
|
4
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
5
|
+
|
|
6
|
+
body {
|
|
7
|
+
font-family: var(--font-ui);
|
|
8
|
+
background: var(--bg);
|
|
9
|
+
color: var(--text);
|
|
10
|
+
height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
font-size: 13px;
|
|
15
|
+
-webkit-font-smoothing: antialiased;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* ═══════════════════════════════════════════════════
|
|
19
|
+
TOOLBAR BRAND
|
|
20
|
+
═══════════════════════════════════════════════════ */
|
|
21
|
+
#toolbar-brand {
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
color: var(--accent);
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
border-radius: var(--radius-sm);
|
|
29
|
+
padding: 2px;
|
|
30
|
+
margin-right: auto;
|
|
31
|
+
transition: opacity .12s;
|
|
32
|
+
}
|
|
33
|
+
#toolbar-brand:hover { opacity: .7; }
|
|
34
|
+
.toolbar-brand-text { display: none; }
|
|
35
|
+
.toolbar-brand-full { display: inline; font-size: 13px; font-weight: 600; }
|
|
36
|
+
.toolbar-brand-short { display: none; }
|
|
37
|
+
.toolbar-brand-tiny { display: none; }
|
|
38
|
+
|
|
39
|
+
.btn {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 5px;
|
|
43
|
+
padding: 5px 11px;
|
|
44
|
+
border-radius: var(--radius);
|
|
45
|
+
border: 1px solid var(--border);
|
|
46
|
+
background: var(--bg-input);
|
|
47
|
+
color: var(--text-2);
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
font-family: var(--font-ui);
|
|
52
|
+
line-height: 1;
|
|
53
|
+
transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
box-shadow: var(--shadow-sm);
|
|
56
|
+
}
|
|
57
|
+
.btn:hover {
|
|
58
|
+
background: var(--bg-hover);
|
|
59
|
+
border-color: var(--border-strong);
|
|
60
|
+
color: var(--text);
|
|
61
|
+
}
|
|
62
|
+
.btn:active { background: var(--bg-active); }
|
|
63
|
+
.btn.active {
|
|
64
|
+
background: var(--accent);
|
|
65
|
+
border-color: var(--accent);
|
|
66
|
+
color: var(--text-inv);
|
|
67
|
+
box-shadow: 0 1px 3px rgba(37,99,235,.25);
|
|
68
|
+
}
|
|
69
|
+
.btn.ghost {
|
|
70
|
+
background: transparent;
|
|
71
|
+
border-color: transparent;
|
|
72
|
+
box-shadow: none;
|
|
73
|
+
color: var(--text-2);
|
|
74
|
+
}
|
|
75
|
+
.btn.ghost:hover {
|
|
76
|
+
background: var(--bg-hover);
|
|
77
|
+
border-color: var(--border);
|
|
78
|
+
color: var(--text);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
/* ═══════════════════════════════════════════════════
|
|
83
|
+
MAIN LAYOUT
|
|
84
|
+
═══════════════════════════════════════════════════ */
|
|
85
|
+
#main {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex: 1;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* ═══════════════════════════════════════════════════
|
|
92
|
+
LEFT PANEL
|
|
93
|
+
═══════════════════════════════════════════════════ */
|
|
94
|
+
#left {
|
|
95
|
+
flex: 1;
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
overflow: hidden;
|
|
99
|
+
background: var(--bg-input);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#left-toolbar {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 6px;
|
|
106
|
+
height: 40px;
|
|
107
|
+
padding: 0 12px;
|
|
108
|
+
background: var(--bg);
|
|
109
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
overflow-x: auto;
|
|
112
|
+
overflow-y: hidden;
|
|
113
|
+
-webkit-overflow-scrolling: touch;
|
|
114
|
+
scrollbar-width: none;
|
|
115
|
+
}
|
|
116
|
+
#left-toolbar::-webkit-scrollbar {
|
|
117
|
+
display: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.toggle-group {
|
|
121
|
+
display: flex;
|
|
122
|
+
background: var(--bg-surface);
|
|
123
|
+
border: 1px solid var(--border);
|
|
124
|
+
border-radius: var(--radius);
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
padding: 2px;
|
|
127
|
+
gap: 2px;
|
|
128
|
+
}
|
|
129
|
+
.toggle-group .btn {
|
|
130
|
+
border: none;
|
|
131
|
+
border-radius: calc(var(--radius) - 2px);
|
|
132
|
+
box-shadow: none;
|
|
133
|
+
background: transparent;
|
|
134
|
+
padding: 6px 8px;
|
|
135
|
+
color: var(--text-2);
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
}
|
|
140
|
+
.toggle-group .btn.active {
|
|
141
|
+
background: var(--bg-input);
|
|
142
|
+
color: var(--text);
|
|
143
|
+
box-shadow: var(--shadow-sm);
|
|
144
|
+
}
|
|
145
|
+
.toggle-group .btn:hover:not(.active) {
|
|
146
|
+
background: var(--bg-hover);
|
|
147
|
+
border-color: transparent;
|
|
148
|
+
color: var(--text);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#drop-hint {
|
|
152
|
+
font-size: 11.5px;
|
|
153
|
+
color: var(--text-3);
|
|
154
|
+
margin-left: auto;
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
gap: 4px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#btn-theme,
|
|
161
|
+
.toolbar-icon-btn {
|
|
162
|
+
display: inline-flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
width: 26px;
|
|
166
|
+
height: 26px;
|
|
167
|
+
border: none;
|
|
168
|
+
background: none;
|
|
169
|
+
color: var(--text-3);
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
border-radius: var(--radius-sm);
|
|
172
|
+
padding: 0;
|
|
173
|
+
transition: color .12s, background .12s;
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
}
|
|
176
|
+
@media (hover: hover) {
|
|
177
|
+
#btn-theme:hover,
|
|
178
|
+
.toolbar-icon-btn:hover {
|
|
179
|
+
color: var(--text-2);
|
|
180
|
+
background: var(--bg-hover);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#content-area {
|
|
185
|
+
flex: 1;
|
|
186
|
+
overflow: auto;
|
|
187
|
+
position: relative;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* drag overlay */
|
|
191
|
+
#content-area.drag-over::after {
|
|
192
|
+
content: 'Drop file to load';
|
|
193
|
+
position: absolute;
|
|
194
|
+
inset: 0;
|
|
195
|
+
background: rgba(37,99,235,.06);
|
|
196
|
+
border: 2px dashed var(--accent);
|
|
197
|
+
border-radius: var(--radius-md);
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
justify-content: center;
|
|
201
|
+
font-size: 16px;
|
|
202
|
+
font-weight: 500;
|
|
203
|
+
color: var(--accent);
|
|
204
|
+
pointer-events: none;
|
|
205
|
+
z-index: 10;
|
|
206
|
+
margin: 8px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* ═══════════════════════════════════════════════════
|
|
210
|
+
RAW TEXTAREA
|
|
211
|
+
═══════════════════════════════════════════════════ */
|
|
212
|
+
#raw {
|
|
213
|
+
display: none;
|
|
214
|
+
width: 100%;
|
|
215
|
+
height: 100%;
|
|
216
|
+
padding: 40px 48px;
|
|
217
|
+
background: var(--bg-input);
|
|
218
|
+
color: var(--text);
|
|
219
|
+
border: none;
|
|
220
|
+
resize: none;
|
|
221
|
+
font-family: 'JetBrains Mono', 'Fira Mono', monospace;
|
|
222
|
+
font-size: 13px;
|
|
223
|
+
line-height: 1.7;
|
|
224
|
+
outline: none;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/* ═══════════════════════════════════════════════════
|
|
228
|
+
DIVIDER (resize handle aesthetic)
|
|
229
|
+
═══════════════════════════════════════════════════ */
|
|
230
|
+
#divider {
|
|
231
|
+
width: 0;
|
|
232
|
+
background: var(--border);
|
|
233
|
+
flex-shrink: 0;
|
|
234
|
+
transition: width .32s cubic-bezier(.4,0,.2,1);
|
|
235
|
+
}
|
|
236
|
+
body.style-mode #divider,
|
|
237
|
+
body.export-mode #divider { width: 1px; }
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/* ═══════════════════════════════════════════════════
|
|
2
|
+
MOBILE
|
|
3
|
+
═══════════════════════════════════════════════════ */
|
|
4
|
+
@media (max-width: 768px) {
|
|
5
|
+
/* ── Make body the scroll container (iOS tap-to-top) ── */
|
|
6
|
+
body { overflow: visible; height: auto; }
|
|
7
|
+
#main { flex-direction: column; overflow: visible; }
|
|
8
|
+
#left { min-height: 0; overflow: visible; }
|
|
9
|
+
#content-area { overflow: visible; }
|
|
10
|
+
html { scroll-padding-top: 44px; }
|
|
11
|
+
|
|
12
|
+
/* ── Show short brand text on mobile ── */
|
|
13
|
+
.toolbar-brand-full { display: none; }
|
|
14
|
+
.toolbar-brand-short { display: inline; font-size: 13px; font-weight: 600; }
|
|
15
|
+
|
|
16
|
+
/* ── Sticky left toolbar: horizontal scroll, left-aligned ── */
|
|
17
|
+
#left-toolbar { position: sticky; top: 0; z-index: 99; overflow-x: auto; -webkit-overflow-scrolling: touch; }
|
|
18
|
+
#left-toolbar > * { flex-shrink: 0; }
|
|
19
|
+
#toolbar-brand { margin-right: 0; }
|
|
20
|
+
|
|
21
|
+
/* ── Stack layout instead of side-by-side ── */
|
|
22
|
+
#divider { display: none; }
|
|
23
|
+
|
|
24
|
+
/* ── Content: tighter padding for small screens ── */
|
|
25
|
+
#rendered { padding: 24px 20px 40px; max-width: 100%; overflow-x: hidden; }
|
|
26
|
+
#write { padding: 24px 20px 40px; max-width: 100%; }
|
|
27
|
+
#raw { padding: 20px 16px; min-height: calc(100dvh - 36px); font-size: 16px; }
|
|
28
|
+
|
|
29
|
+
/* ── Write toolbar: sticky below left-toolbar ── */
|
|
30
|
+
body.write-mode #write-toolbar { position: sticky; top: 36px; z-index: 98; justify-content: flex-start; }
|
|
31
|
+
|
|
32
|
+
/* ── Left toolbar: hide drop hint ── */
|
|
33
|
+
#drop-hint { display: none; }
|
|
34
|
+
|
|
35
|
+
/* ── Status bar: hidden on mobile ── */
|
|
36
|
+
#statusbar { display: none; }
|
|
37
|
+
|
|
38
|
+
/* ── Right panel: bottom sheet overlay ── */
|
|
39
|
+
#right {
|
|
40
|
+
position: fixed;
|
|
41
|
+
bottom: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
right: 0;
|
|
44
|
+
width: 100% !important;
|
|
45
|
+
max-height: 0;
|
|
46
|
+
border-radius: 16px 16px 0 0;
|
|
47
|
+
box-shadow: 0 -4px 24px rgba(28,25,23,.15), 0 -1px 4px rgba(28,25,23,.08);
|
|
48
|
+
z-index: 100;
|
|
49
|
+
transition: max-height .32s cubic-bezier(.4,0,.2,1),
|
|
50
|
+
transform .32s cubic-bezier(.4,0,.2,1),
|
|
51
|
+
opacity .25s ease;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
}
|
|
54
|
+
/* Style mode: show bottom sheet */
|
|
55
|
+
body.style-mode #right {
|
|
56
|
+
max-height: 52px;
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
/* Expanded state */
|
|
60
|
+
body.mobile-sheet-open #right {
|
|
61
|
+
max-height: 70vh;
|
|
62
|
+
overflow-y: auto;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ── Drag handle indicator on the sheet ── */
|
|
66
|
+
#right::before {
|
|
67
|
+
content: '';
|
|
68
|
+
display: block;
|
|
69
|
+
width: 36px;
|
|
70
|
+
height: 4px;
|
|
71
|
+
background: var(--border-strong);
|
|
72
|
+
border-radius: 2px;
|
|
73
|
+
margin: 6px auto 0px;
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* ── Make header tappable to expand ── */
|
|
78
|
+
#right-header {
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
user-select: none;
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
min-height: 42px;
|
|
83
|
+
align-items: baseline;
|
|
84
|
+
padding: 4px 12px 0px 12px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* ── Hide "Save as default styles" on mobile ── */
|
|
88
|
+
#right .panel-section:last-child { display: none; }
|
|
89
|
+
|
|
90
|
+
/* ── Export panel: bottom sheet overlay ── */
|
|
91
|
+
#export-panel {
|
|
92
|
+
position: fixed;
|
|
93
|
+
bottom: 0;
|
|
94
|
+
left: 0;
|
|
95
|
+
right: 0;
|
|
96
|
+
width: 100% !important;
|
|
97
|
+
max-height: 0;
|
|
98
|
+
border-radius: 16px 16px 0 0;
|
|
99
|
+
box-shadow: 0 -4px 24px rgba(28,25,23,.15), 0 -1px 4px rgba(28,25,23,.08);
|
|
100
|
+
z-index: 100;
|
|
101
|
+
transition: max-height .32s cubic-bezier(.4,0,.2,1),
|
|
102
|
+
opacity .25s ease;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
body.export-mode #export-panel {
|
|
106
|
+
max-height: 52px;
|
|
107
|
+
opacity: 1;
|
|
108
|
+
}
|
|
109
|
+
body.mobile-export-open #export-panel {
|
|
110
|
+
max-height: 70vh;
|
|
111
|
+
overflow-y: auto;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ── Export panel drag handle ── */
|
|
115
|
+
#export-panel::before {
|
|
116
|
+
content: '';
|
|
117
|
+
display: block;
|
|
118
|
+
width: 36px;
|
|
119
|
+
height: 4px;
|
|
120
|
+
background: var(--border-strong);
|
|
121
|
+
border-radius: 2px;
|
|
122
|
+
margin: 6px auto 0px;
|
|
123
|
+
flex-shrink: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* ── Export panel header: tappable ── */
|
|
127
|
+
#export-panel-header {
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
user-select: none;
|
|
130
|
+
flex-shrink: 0;
|
|
131
|
+
min-height: 42px;
|
|
132
|
+
align-items: baseline;
|
|
133
|
+
padding: 4px 12px 0px 12px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ═══════════════════════════════════════════════════
|
|
138
|
+
TOOLBAR SCROLL FADE HINT (< 560px / < 342px)
|
|
139
|
+
Right-edge gradient that fades out when scrolled
|
|
140
|
+
═══════════════════════════════════════════════════ */
|
|
141
|
+
@media (max-width: 560px) {
|
|
142
|
+
body.write-mode #write-toolbar.has-overflow::after {
|
|
143
|
+
content: '';
|
|
144
|
+
position: absolute;
|
|
145
|
+
top: 0;
|
|
146
|
+
right: 0;
|
|
147
|
+
width: 32px;
|
|
148
|
+
height: 100%;
|
|
149
|
+
background: linear-gradient(to right, transparent, var(--bg) 90%);
|
|
150
|
+
pointer-events: none;
|
|
151
|
+
opacity: 1;
|
|
152
|
+
transition: opacity .2s ease;
|
|
153
|
+
}
|
|
154
|
+
body.write-mode #write-toolbar.scrolled-end::after {
|
|
155
|
+
opacity: 0;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* ═══════════════════════════════════════════════════
|
|
160
|
+
NARROW MOBILE (< 366px)
|
|
161
|
+
═══════════════════════════════════════════════════ */
|
|
162
|
+
@media (max-width: 366px) {
|
|
163
|
+
.toolbar-brand-short { display: none; }
|
|
164
|
+
.toolbar-brand-tiny { display: inline; font-size: 13px; font-weight: 600; }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* ═══════════════════════════════════════════════════
|
|
168
|
+
VERY NARROW (< 342px)
|
|
169
|
+
═══════════════════════════════════════════════════ */
|
|
170
|
+
@media (max-width: 342px) {
|
|
171
|
+
#left-toolbar {
|
|
172
|
+
position: relative;
|
|
173
|
+
}
|
|
174
|
+
#left-toolbar.has-overflow::after {
|
|
175
|
+
content: '';
|
|
176
|
+
position: absolute;
|
|
177
|
+
top: 0;
|
|
178
|
+
right: 0;
|
|
179
|
+
width: 32px;
|
|
180
|
+
height: 100%;
|
|
181
|
+
background: linear-gradient(to right, transparent, var(--bg) 90%);
|
|
182
|
+
pointer-events: none;
|
|
183
|
+
opacity: 1;
|
|
184
|
+
transition: opacity .2s ease;
|
|
185
|
+
}
|
|
186
|
+
#left-toolbar.scrolled-end::after {
|
|
187
|
+
opacity: 0;
|
|
188
|
+
}
|
|
189
|
+
}
|