vfsjs-test 1.0.8 → 1.0.10
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/main.js +51 -32
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// main.js -
|
|
2
|
-
const display = document.getElementById('status');
|
|
1
|
+
// main.js - User API Facade and Browser Orchestration
|
|
3
2
|
|
|
4
|
-
// Clean user-facing API surface area
|
|
5
3
|
window.vfs = {
|
|
6
4
|
add(filename, contentString, customMime = null) {
|
|
7
5
|
return window._vfsKernel.write(filename, contentString, customMime);
|
|
@@ -11,43 +9,64 @@ window.vfs = {
|
|
|
11
9
|
},
|
|
12
10
|
clear() {
|
|
13
11
|
return window._vfsKernel.wipe();
|
|
14
|
-
},
|
|
15
|
-
hook(filename, type) {
|
|
16
|
-
// type should be 'js' or 'css'
|
|
17
|
-
return window._vfsKernel.mount(filename, type);
|
|
18
|
-
},
|
|
19
|
-
unhook() {
|
|
20
|
-
return window._vfsKernel.unmount();
|
|
21
12
|
}
|
|
22
13
|
};
|
|
23
14
|
|
|
24
15
|
async function startDeveloperWorkspace() {
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
display.innerHTML += "<br>> Running developer asset deployment...";
|
|
16
|
+
// FIX: Look up the display element now that the DOM layout is guaranteed to exist
|
|
17
|
+
const display = document.getElementById('status');
|
|
18
|
+
if (display) display.innerHTML += "<br>> Running developer asset deployment...";
|
|
30
19
|
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
// Add your scripts and styles to memory target registers
|
|
21
|
+
vfs.add('live_theme.css', `
|
|
22
|
+
/* Animate the entire viewport background */
|
|
23
|
+
body {
|
|
24
|
+
background: linear-gradient(-45deg, #ff007f, #7f00ff, #00bfff, #00ff7f, #ffea00, #ff007f) !important;
|
|
25
|
+
background-size: 400% 400% !important;
|
|
26
|
+
animation: rainbowShift 12s ease infinite !important;
|
|
27
|
+
color: #ffffff !important;
|
|
28
|
+
text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
|
|
29
|
+
}
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
/* Make the title text pop */
|
|
32
|
+
h2 {
|
|
33
|
+
color: #ffffff !important;
|
|
34
|
+
text-shadow: 0 0 10px rgba(255,255,255,0.6), 0 0 20px rgba(0,255,255,0.4);
|
|
35
|
+
}
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
/* Style the log box to look like a dark synthwave terminal */
|
|
38
|
+
#status {
|
|
39
|
+
background: rgba(10, 10, 25, 0.85) !important;
|
|
40
|
+
border: 2px solid #ff007f !important;
|
|
41
|
+
border-radius: 8px;
|
|
42
|
+
box-shadow: 0 0 15px rgba(255, 0, 127, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.9) !important;
|
|
43
|
+
color: #00ffcc !important;
|
|
44
|
+
}
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
/* Bold tags inside the logs get a neon highlight */
|
|
47
|
+
#status b {
|
|
48
|
+
color: #ffea00 !important;
|
|
49
|
+
text-shadow: 0 0 5px rgba(255,234,0,0.5);
|
|
50
|
+
}
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
/* Keyframes to smoothly move the background gradients */
|
|
53
|
+
@keyframes rainbowShift {
|
|
54
|
+
0% { background-position: 0% 50%; }
|
|
55
|
+
50% { background-position: 100% 50%; }
|
|
56
|
+
100% { background-position: 0% 50%; }
|
|
57
|
+
}
|
|
58
|
+
`, 'text/css');
|
|
59
|
+
vfs.add('index.js', `
|
|
60
|
+
console.log("VFS Engine: Intercepted via head script execution successfully!");
|
|
61
|
+
const statusEl = document.getElementById('status');
|
|
62
|
+
if (statusEl) statusEl.innerHTML += "<br>> <span style='color: #22c55e;'>Virtual asset code running live!</span>";
|
|
63
|
+
`, 'text/javascript');
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
// FIX: Wait for the DOM to be built before initializing the workspace thread structures
|
|
67
|
+
document.addEventListener('DOMContentLoaded', async () => {
|
|
68
|
+
const ready = await window._vfsKernel.init();
|
|
69
|
+
if (ready) {
|
|
70
|
+
startDeveloperWorkspace();
|
|
71
|
+
}
|
|
72
|
+
});
|