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.
Files changed (2) hide show
  1. package/main.js +51 -32
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -1,7 +1,5 @@
1
- // main.js - Simple Developer Interface Facade
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
- // 1. Fire up the kernel underneath automatically
26
- const ready = await window._vfsKernel.init();
27
- if (!ready) return;
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
- // 2. Add your scripts and styles to memory
32
- vfs.add('live-theme.css', `
33
- body { background: #020617 !important; color: #a5f3fc !important; }
34
- #status { border-color: #334155 !important; background: #0f172a !important; }
35
- `, 'text/css');
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
- vfs.add('index.js', `
38
- console.log("VFS Engine: Hooked successfully!");
39
- document.getElementById('status').innerHTML += "<br>> <span style='color: #22c55e;'>Virtual asset code running live!</span>";
40
- `, 'text/javascript');
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
- // Give the worker split-second thread cache timing
43
- await new Promise(r => setTimeout(r, 50));
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
- // 3. Mount them into the page environment using your new API!
46
- vfs.hook('live-theme.css', 'css');
47
- vfs.hook('index.js', 'js');
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
- // Example Test: You can run vfs.unhook() anytime later to completely pull them out!
50
- // setTimeout(() => { vfs.unhook(); }, 5000);
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
- startDeveloperWorkspace();
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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vfsjs-test",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "index.html",
6
6
  "scripts": {