vfsjs-test 1.0.11 → 1.0.12

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 (3) hide show
  1. package/main.js +34 -20
  2. package/package.json +1 -1
  3. package/vfsjs.js +25 -36
package/main.js CHANGED
@@ -1,36 +1,50 @@
1
- // main.js - User API Facade and Browser Orchestration
1
+ // main.js - Developer Workspace API
2
2
 
3
3
  window.vfs = {
4
4
  add(filename, contentString, customMime = null) {
5
5
  return window._vfsKernel.write(filename, contentString, customMime);
6
6
  },
7
- delete(filename) {
8
- return window._vfsKernel.remove(filename);
9
- },
10
- clear() {
11
- return window._vfsKernel.wipe();
12
- }
7
+ delete(filename) { return window._vfsKernel.remove(filename); },
8
+ clear() { return window._vfsKernel.wipe(); }
13
9
  };
14
10
 
15
11
  async function startDeveloperWorkspace() {
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...";
12
+ // 1. Add standard CSS rules directly
13
+ vfs.add('live_theme.css', `
14
+ html, body { margin: 0; padding: 40px; height: 100%; overflow: hidden; font-family: monospace; background: #020617; color: #38bdf8; }
15
+ body { background: linear-gradient(-45deg, #ff007f, #7f00ff, #00bfff, #00ff7f, #ffea00, #ff007f) !important; background-size: 400% 400% !important; animation: rainbowShift 12s ease infinite !important; color: #ffffff !important; }
16
+ @keyframes rainbowShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
17
+ `, 'text/css');
19
18
 
20
- // Add your scripts and styles to memory target registers
21
- vfs.add('live_theme.css', `body { background: linear-gradient(-45deg, #ff007f, #7f00ff, #00bfff, #00ff7f, #ffea00, #ff007f) !important; background-size: 400% 400% !important; animation: rainbowShift 12s ease infinite !important; color: #ffffff !important; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); }
22
- h2 { color: #ffffff !important; text-shadow: 0 0 10px rgba(255,255,255,0.6), 0 0 20px rgba(0,255,255,0.4); }
23
- #status { background: rgba(10, 10, 25, 0.85) !important; border: 2px solid #ff007f !important; border-radius: 8px; box-shadow: 0 0 15px rgba(255, 0, 127, 0.4), inset 0 0 10px rgba(0, 0, 0, 0.9) !important; color: #00ffcc !important; }
24
- #status b { color: #ffea00 !important; text-shadow: 0 0 5px rgba(255,234,0,0.5); }
25
- @keyframes rainbowShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }\n`, 'text/css');
19
+ // 2. Add traditional JavaScript code
26
20
  vfs.add('index.js', `
27
- console.log("VFS Engine: Intercepted via head script execution successfully!");
28
- const statusEl = document.getElementById('status');
29
- if (statusEl) statusEl.innerHTML += "<br>> <span style='color: #22c55e;'>Virtual asset code running live!</span>";
21
+ console.log("Normal layout execution script loaded smoothly!");
30
22
  `, 'text/javascript');
23
+
24
+ // 3. Add the main index entry file using native, normal markup tags!
25
+ vfs.add('workspace.html', `
26
+ <!DOCTYPE html>
27
+ <html>
28
+ <head>
29
+ <meta charset="UTF-8">
30
+ <link rel="stylesheet" href="live_theme.css?vfs=true">
31
+ </head>
32
+ <body>
33
+ <h2>Infrared Seamless Virtual Environment</h2>
34
+ <p>This layout runs seamlessly inside an entirely virtual context.</p>
35
+ <script src="index.js?vfs=true"></script>
36
+ </body>
37
+ </html>
38
+ `, 'text/html');
39
+
40
+ // 4. Point the auto-generated viewport to the entry path!
41
+ const viewport = document.getElementById('canvas-viewport');
42
+ if (viewport) {
43
+ viewport.src = 'workspace.html?vfs=true';
44
+ }
31
45
  }
32
46
 
33
- // FIX: Wait for the DOM to be built before initializing the workspace thread structures
47
+ // Automatically bootstrap when document structure is verified
34
48
  document.addEventListener('DOMContentLoaded', async () => {
35
49
  const ready = await window._vfsKernel.init();
36
50
  if (ready) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vfsjs-test",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "main": "index.html",
6
6
  "scripts": {
package/vfsjs.js CHANGED
@@ -1,24 +1,40 @@
1
- // vfsjs.js - Upgraded Core Logic Engine
1
+ // vfsjs.js - Automated Infrastructure Engine Core
2
2
  (function() {
3
3
  const encoder = new TextEncoder();
4
- const display = document.getElementById('status');
5
- let injectedNodes = []; // Tracks dynamically mounted elements
6
4
 
7
5
  const engineCore = {
8
- // Automatically registers and activates the Service Worker thread
9
6
  async init() {
10
7
  try {
8
+ // 1. Core Service Worker Registration
11
9
  await navigator.serviceWorker.register('./sw.js');
12
- if (display) display.innerHTML += "<br>> Service worker synchronized.";
13
-
14
10
  if (!navigator.serviceWorker.controller) {
15
- if (display) display.innerHTML += "<br>> Securing worker routing links...";
16
11
  await new Promise(r => navigator.serviceWorker.addEventListener('controllerchange', r, { once: true }));
17
12
  }
18
- if (display) display.innerHTML += "<br>> Matrix pipeline fully established.";
13
+
14
+ // 2. AUTOMATION UPGRADE: Enforce full-screen layout constraints on the main window
15
+ Object.assign(document.documentElement.style, { width: '100%', height: '100%', overflow: 'hidden', margin: '0', padding: '0' });
16
+ Object.assign(document.body.style, { width: '100%', height: '100%', overflow: 'hidden', margin: '0', padding: '0', background: '#020617' });
17
+
18
+ // 3. AUTOMATION UPGRADE: Create and mount the seamless borderless canvas iframe
19
+ const iframe = document.createElement('iframe');
20
+ iframe.id = 'canvas-viewport';
21
+ iframe.setAttribute('scrolling', 'no');
22
+ Object.assign(iframe.style, {
23
+ position: 'absolute',
24
+ top: '0',
25
+ left: '0',
26
+ width: '100%',
27
+ height: '100%',
28
+ border: 'none',
29
+ margin: '0',
30
+ padding: '0',
31
+ zIndex: '999999'
32
+ });
33
+
34
+ document.body.appendChild(iframe);
19
35
  return true;
20
36
  } catch (err) {
21
- if (display) display.innerHTML += `<br>><span style="color: #ef4444;"> Core Init Failure: ${err.message}</span>`;
37
+ console.error("VFS Kernel Boot Failure:", err);
22
38
  return false;
23
39
  }
24
40
  },
@@ -31,46 +47,19 @@
31
47
  content: encoder.encode(contentString),
32
48
  mime: customMime
33
49
  });
34
- if (display) display.innerHTML += `<br>> Core Write: <b>${filename}</b>`;
35
50
  return true;
36
51
  },
37
52
 
38
53
  remove(filename) {
39
54
  if (!navigator.serviceWorker.controller) return false;
40
55
  navigator.serviceWorker.controller.postMessage({ type: 'VFS_DELETE', filename: filename });
41
- if (display) display.innerHTML += `<br>> Core Remove: <span style="color: #ef4444;">${filename}</span>`;
42
56
  return true;
43
57
  },
44
58
 
45
59
  wipe() {
46
60
  if (!navigator.serviceWorker.controller) return false;
47
61
  navigator.serviceWorker.controller.postMessage({ type: 'VFS_CLEAR' });
48
- if (display) display.innerHTML += `<br>><span style="color: #f59e0b;"> Core Clear: Matrix flushed.</span>`;
49
62
  return true;
50
- },
51
-
52
- // Dynamically injects virtual assets into the browser frame safely
53
- mount(filename, type) {
54
- if (type === 'css') {
55
- const el = document.createElement('link');
56
- el.rel = 'stylesheet';
57
- el.href = filename;
58
- document.head.appendChild(el);
59
- injectedNodes.push(el);
60
- } else if (type === 'js') {
61
- const el = document.createElement('script');
62
- el.src = filename;
63
- document.body.appendChild(el);
64
- injectedNodes.push(el);
65
- }
66
- if (display) display.innerHTML += `<br>> Frame Hooked: Loaded [${filename}]`;
67
- },
68
-
69
- // Pulls all injected elements back out of the DOM frame
70
- unmount() {
71
- injectedNodes.forEach(node => node.remove());
72
- injectedNodes = [];
73
- if (display) display.innerHTML += `<br>><span style="color: #f43f5e;"> Frame Unhooked: Virtual nodes detached.</span>`;
74
63
  }
75
64
  };
76
65