Skip to content

Commit d5843cf

Browse files
authored
1.9.0
1.9.0
2 parents 8b85534 + 8791e7c commit d5843cf

19 files changed

+1051
-614
lines changed

LICENSE

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,2 @@
1-
MIT License
2-
3-
Copyright (c) Codeit
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
Codeit is licensed under the GNU-GPL v3 or any later version.
2+
For more info, see: https://gnu.org/licenses/gpl-3.0

bottomfloat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function checkBottomFloat() {
121121
if ((cd.scrollTop + cd.offsetHeight) >= cd.scrollHeight) {
122122

123123
// show bottom float
124-
bottomFloat.classList.remove('hidden');
124+
bottomWrapper.classList.remove('hidden');
125125

126126
}
127127

codedrop.js

-9
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ function getFileLang(src) {
2020

2121
}
2222

23-
function splitFileName(src) {
24-
25-
src = src.replaceAll('\n', '');
26-
27-
const extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
28-
return [src.replace(('.' + extension), ''), '.' + extension];
29-
30-
}
31-
3223

3324
function processFile(file) {
3425

dark.css renamed to dark-theme.css

+98-17
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ cd-el {
5656
border-radius: 0;
5757
}
5858

59-
.token.comment,
6059
.token.prolog,
6160
.token.doctype,
6261
.token.cdata {
@@ -77,12 +76,14 @@ cd-el {
7776
opacity: 1;
7877
}
7978

80-
.token.property {
79+
.token.property,
80+
.language-css .token.variable {
8181
color: #35d4c7;
8282
}
8383

8484
.token.boolean,
8585
.token.number,
86+
.token.unit,
8687
.token.constant,
8788
.token.symbol,
8889
.token.deleted,
@@ -91,8 +92,6 @@ cd-el {
9192
}
9293

9394
.token.attr-value,
94-
.token.string,
95-
.style .token.string,
9695
.token.char,
9796
.token.url,
9897
.token.builtin,
@@ -124,6 +123,17 @@ cd-el {
124123
color: #75bfff;
125124
}
126125

126+
.token.comment,
127+
.token.comment * {
128+
color: hsl(218deg 7% 64% / 72%) !important;
129+
}
130+
131+
.token.string,
132+
.token.string *,
133+
.style .token.string {
134+
color: #c1ffd5cc !important;
135+
}
136+
127137
.token.italic {
128138
font-style: normal;
129139
}
@@ -132,6 +142,19 @@ cd-el {
132142
cursor: unset;
133143
}
134144

145+
.token a {
146+
color: inherit;
147+
}
148+
149+
.token.string .token.url-link {
150+
text-decoration: none;
151+
}
152+
153+
.language-css .token.string .token.url-link {
154+
text-decoration: underline;
155+
}
156+
157+
135158
.token.brace.brace-active {
136159
position: relative;
137160
background: rgb(166 195 212 / 12%);
@@ -158,9 +181,9 @@ cd-el {
158181
transform: rotateZ(-25deg);
159182
}
160183

184+
161185
.line-numbers {
162186
position: relative;
163-
counter-reset: linenumber;
164187
padding-left: calc(var(--gutter-length) + env(safe-area-inset-left));
165188
scroll-padding-left: calc(var(--gutter-length) + env(safe-area-inset-left));
166189
--gutter-length: calc(1.2em + 30px + env(safe-area-inset-left));
@@ -176,22 +199,80 @@ cd-el {
176199
pointer-events: none;
177200
line-height: inherit;
178201
font-size: inherit;
179-
}
180-
181-
.line-numbers-rows > span {
182-
display: block;
183-
counter-increment: linenumber;
184-
}
185-
186-
.line-numbers-rows > span:before {
187-
content: counter(linenumber);
188202
color: #636d83;
189203
display: block;
190204
text-align: right;
191205
padding-right: 13.5px;
192206
padding-left: calc(13.5px + env(safe-area-inset-left));
193-
white-space: nowrap;
194207
min-width: 1.2em;
195-
line-height: inherit;
196-
font-size: inherit;
208+
white-space: pre;
209+
}
210+
211+
.line-numbers .line-numbers-rows::before {
212+
content: attr(line-numbers);
213+
}
214+
215+
216+
span.inline-color-wrapper {
217+
/*
218+
* The background image is the following SVG inline in base 64:
219+
*
220+
* <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 2">
221+
* <path fill="#fff" d="M0 0h2v2H0z"/>
222+
* <path fill="#ccc" d="M0 0h1v1H0zM1 1h1v1H1z"/>
223+
* </svg>
224+
*
225+
* SVG-inlining explained:
226+
* https://stackoverflow.com/a/21626701/7595472
227+
*/
228+
background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyIDIiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0wIDBoMnYySDB6Ii8+PHBhdGggZmlsbD0iI2NjYyIgZD0iTTAgMGgxdjFIMHpNMSAxaDF2MUgxeiIvPjwvc3ZnPg==);
229+
230+
height: 12px;
231+
width: 12px;
232+
margin-left: 2px;
233+
margin-right: 4px;
234+
display: inline-block;
235+
user-select: none;
236+
-webkit-user-select: none;
237+
line-height: 10px;
238+
border-radius: 50%;
239+
cursor: pointer;
240+
241+
transition: 0.3s cubic-bezier(0, 0.88, 0.46, 1.36);
242+
transition: 0.6s cubic-bezier(.165,.84,.44,1);
243+
transition: .4s cubic-bezier(.68,-.55,.265,1.55);
244+
transition: .4s cubic-bezier(0.19,1,0.22,1);
245+
transition: .5s cubic-bezier(0.23, 1, 0.32, 1);
246+
transition: .3s cubic-bezier(.175,.885,.32,1.275);
247+
transition: .3s cubic-bezier(.075,.82,.165,1);
248+
transition: 167ms cubic-bezier(0,0,.2,1);
249+
transition: 0.3s cubic-bezier(0.4, 0, 0.25, 1);
250+
}
251+
252+
body.platform-mac span.inline-color-wrapper {
253+
cursor: default;
254+
}
255+
256+
span.inline-color {
257+
width: 100%;
258+
height: 100%;
259+
display: inline-block;
260+
box-sizing: border-box;
261+
border-radius: 50%;
262+
position: relative;
263+
}
264+
265+
span.inline-color::after {
266+
content: '';
267+
width: 100%;
268+
height: 100%;
269+
position: absolute;
270+
box-shadow: 0 0 0 1px hsl(221deg 9% 50%), inset 0 0 0 1px #313744;
271+
left: 0;
272+
top: 0;
273+
border-radius: 50%;
274+
}
275+
276+
span.inline-color-wrapper:hover span.inline-color::after {
277+
box-shadow: 0 0 0 1px hsl(221deg 12% 67%), inset 0 0 0 1px #313744;
197278
}

file.js

+30-23
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,28 @@ function onFileEclipsedInCache(oldSha, newSha, newFile) {
121121

122122
// find the eclipsed file
123123
fileToUpdate = modifiedFiles[oldSha];
124-
124+
125+
// update old file to new sha
125126
fileToUpdate.sha = newSha;
127+
128+
// update old file caret pos
126129
fileToUpdate.caretPos = [0, 0];
130+
131+
// set old file to eclipsed mode
127132
fileToUpdate.eclipsed = true;
128133

129134
// if file to update is selected
130135
if (selectedFile.sha === oldSha) {
131136

132137
// update its content
133138
// to the selected file contents
134-
updateModFileContent(oldSha, selectedFile.content);
139+
fileToUpdate.content = selectedFile.content;
135140

136-
// update selected file sha to the new sha
141+
// update selected file to new sha
137142
selectedFile.sha = newSha;
143+
144+
// set selected file to eclipsed mode
145+
selectedFile.eclipsed = true;
138146

139147
updateSelectedFileLS();
140148

@@ -223,28 +231,27 @@ function getLatestVersion(item) {
223231

224232
function followTrail(crumb) {
225233

226-
if(typeof(modifiedFiles[crumb]) == 'undefined') //@@
227-
return null;
228-
229-
// if version sha matches its key
230-
// (it dosen't point to another version)
231-
if (modifiedFiles[crumb].sha === crumb) {
232-
233-
// reached the most recent version
234-
return modifiedFiles[crumb];
234+
if (modifiedFiles[crumb]) {
235+
236+
// if version sha matches its key
237+
// (it dosen't point to another version)
238+
if (modifiedFiles[crumb].sha === crumb) {
239+
240+
// reached the most recent version
241+
return modifiedFiles[crumb];
242+
243+
} else {
244+
245+
// version sha points to another version,
246+
// follow the trail
247+
return followTrail(modifiedFiles[crumb].sha);
248+
249+
}
235250

236251
} else {
237252

238-
// version sha points to another version,
239-
// follow the trail
240-
let ret = followTrail(modifiedFiles[crumb].sha);
241-
242-
if(ret == null){
243-
// No file with this sha was found in modifiedFiles, return the file with latest bread crumb: //@@
244-
return modifiedFiles[crumb];
245-
}else{
246-
return ret;
247-
}
253+
console.log(item, crumb);
254+
return;
248255

249256
}
250257

@@ -262,4 +269,4 @@ function getLatestVersion(item) {
262269

263270
}
264271

265-
}
272+
}

0 commit comments

Comments
 (0)