fakelab 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/README.md +1 -0
- package/bin/run.js +3 -0
- package/lib/cli.js +1 -0
- package/lib/main.d.ts +27 -0
- package/lib/main.js +1 -0
- package/lib/public/css/style.css +571 -0
- package/lib/public/css/vs2015.min.css +93 -0
- package/lib/public/fonts/Inter-Regular.ttf +0 -0
- package/lib/public/fonts/Roboto-Regular.ttf +0 -0
- package/lib/public/icons/copy.svg +1 -0
- package/lib/public/icons/download.svg +1 -0
- package/lib/public/icons/link.svg +1 -0
- package/lib/public/icons/settings.svg +1 -0
- package/lib/public/js/fakelab.min.js +62 -0
- package/lib/public/js/highlight.min.js +1244 -0
- package/lib/public/js/reset.min.js +12 -0
- package/lib/views/components/code.ejs +1 -0
- package/lib/views/components/sidebar.ejs +23 -0
- package/lib/views/error.ejs +1 -0
- package/lib/views/index.ejs +9 -0
- package/lib/views/layouts/main.ejs +16 -0
- package/lib/views/preview.ejs +201 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#f9fafb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy-icon lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#f9fafb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download-icon lucide-download"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#f9fafb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-arrow-out-up-right-icon lucide-square-arrow-out-up-right"><path d="M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6"/><path d="m21 3-9 9"/><path d="M15 3h6v6"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#f9fafb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings-icon lucide-settings"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></svg>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
let address_url = document.querySelector(".address_url");
|
|
2
|
+
async function copy() {
|
|
3
|
+
try {
|
|
4
|
+
await navigator.clipboard.writeText(address_url.textContent);
|
|
5
|
+
} catch (e) {
|
|
6
|
+
console.info(e);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function open_settings() {
|
|
10
|
+
document.getElementById("setting_overlay").setAttribute("data-visible", "true");
|
|
11
|
+
}
|
|
12
|
+
function handleCloseSetting(e) {
|
|
13
|
+
var t = document.getElementById("setting_overlay");
|
|
14
|
+
e.target && !t.contains(e.target) && "overlay_trigger" !== e.target.id && t.setAttribute("data-visible", "false");
|
|
15
|
+
}
|
|
16
|
+
function submitForm(e) {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
var t = new Set(),
|
|
19
|
+
e = new FormData(e.target),
|
|
20
|
+
n = e.get("count")?.trim(),
|
|
21
|
+
e = e.get("unique_id_key")?.trim(),
|
|
22
|
+
i = new URLSearchParams(),
|
|
23
|
+
d = document.getElementById("unique_id"),
|
|
24
|
+
o = document.getElementById("unique_id_strategy"),
|
|
25
|
+
n =
|
|
26
|
+
(n && 0 < Number(n) ? (Number(n), i.set("count", n.toString()), (window.location.search = i.toString())) : (i.delete("count"), t.add("count")),
|
|
27
|
+
d.checked || (i.delete("uid"), t.add("uid")),
|
|
28
|
+
e && d.checked ? (i.set("uid", e), o.checked && i.set("s", "uuid"), (window.location.search = i.toString())) : (i.delete("uid"), i.delete("s"), t.add("uid")),
|
|
29
|
+
t.has("uid")),
|
|
30
|
+
d = t.has("count");
|
|
31
|
+
d && n
|
|
32
|
+
? window.location.href.includes("?") && (([href] = window.location.href.split("?")), (window.location.href = href))
|
|
33
|
+
: ((d && !n) || (!d && n)) && (window.location.search = i.toString());
|
|
34
|
+
}
|
|
35
|
+
function resetForm(e) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
e = new URLSearchParams(window.location.search);
|
|
38
|
+
e.delete("count"), e.delete("uid"), e.delete("s"), window.location.href.includes("?") && (window.location.href = window.location.href.split("?")[0]);
|
|
39
|
+
}
|
|
40
|
+
function onChangeGenerateUniqueId(e) {
|
|
41
|
+
var t = document.getElementById("unique_id"),
|
|
42
|
+
n = document.getElementById("unique_id_key_field"),
|
|
43
|
+
i = document.getElementById("unique_strategy_container");
|
|
44
|
+
(t.checked = !t.checked), n.setAttribute("data-visible", t.checked.toString()), i.setAttribute("data-visible", t.checked.toString());
|
|
45
|
+
}
|
|
46
|
+
function onHandleUniqueIdStrategy(e) {
|
|
47
|
+
var t = document.getElementById("unique_id_strategy");
|
|
48
|
+
t.checked = !t.checked;
|
|
49
|
+
}
|
|
50
|
+
window.addEventListener("click", handleCloseSetting),
|
|
51
|
+
window.addEventListener("DOMContentLoaded", () => {
|
|
52
|
+
var e = document.getElementById("count"),
|
|
53
|
+
t = document.getElementById("unique_id"),
|
|
54
|
+
n = document.getElementById("unique_id_strategy"),
|
|
55
|
+
i = document.getElementById("unique_id_key"),
|
|
56
|
+
d = document.getElementById("unique_id_key_field"),
|
|
57
|
+
o = document.getElementById("unique_strategy_container"),
|
|
58
|
+
a = new URLSearchParams(window.location.search),
|
|
59
|
+
u = a.get("count"),
|
|
60
|
+
c = a.get("uid");
|
|
61
|
+
u && (e.value = u), c && ((t.checked = !0), (i.value = c), d.setAttribute("data-visible", "true"), o.setAttribute("data-visible", "true"), a.has("s")) && (n.checked = !0);
|
|
62
|
+
});
|