nanoshell 1.7.5 → 1.7.7

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 (4) hide show
  1. package/README.md +34 -47
  2. package/SKILL.md +128 -0
  3. package/cli/index.js +27 -0
  4. package/package.json +2 -2
package/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # NanoShell ⚡ (`nanoshell`)
1
+ # NanoShell ⚡ (`nanoshell@1.7.7`)
2
2
 
3
- **NanoShell** is a hyper-lightweight, browser-free, open-source native desktop application framework & runtime engine designed for building ultra-fast, 120 FPS desktop applications with standard HTML, CSS, and JavaScript.
3
+ > **Created & Engineered by Suman Biswas** 👑
4
+ > *Hyper-lightweight 17MB RAM, 120 FPS Native WebKit Desktop Application Framework & Runtime Engine*
4
5
 
5
- **Created & Engineered by Suman Biswas** 👑
6
+ **NanoShell** is a hyper-lightweight, browser-free, open-source native desktop application framework & runtime engine designed for building ultra-fast desktop applications with standard HTML, CSS, and Vanilla JavaScript.
6
7
 
7
8
  ---
8
9
 
@@ -11,15 +12,34 @@
11
12
  - **Physical RAM Footprint**: **17.0 MB** (vs. 500 MB – 1.2 GB in Electron)
12
13
  - **Cold Boot Time**: **< 0.8 ms** (Instant Snapshot Thaw)
13
14
  - **Frame Rate**: **120 FPS Locked** Hardware GPU Direct Rendering
14
- - **Executable Size**: **3.00 MB** Self-Contained Binary
15
+ - **Executable Size**: **~850 KB** Native Binary (No embedded Chromium browser)
15
16
  - **IPC Latency**: **0.00 ms** Zero-Copy Shared Memory Matrix across Python/C++/Rust
16
- - **CSS Engine**: Universal Dynamic CSS Flex/Grid Gap Engine (0 hardcoded class names)
17
- # NanoShell (v1.5.0)
17
+ - **CSS Engine**: Universal Dynamic CSS Flex/Grid Gap Engine
18
+ - **OS Subsystem**: Pure Win32 Subsystem (Zero background CMD console window)
18
19
 
19
- > **Created by Suman Biswas**
20
- > *Hyper-lightweight 17MB RAM, 120 FPS Native WebKit Desktop Application Framework & Runtime Engine*
20
+ ---
21
+
22
+ ## 🆕 What's New in v1.7.7
23
+
24
+ ### 🪟 Pure Native Win32 Windowing & Full API Control
25
+ - **Zero Windowing Wrappers**: Fully excised AppCore window wrappers to give direct, un-sandboxed `HWND` control to native Zig code.
26
+ - **Instant Window Operations**: Native `ShowWindow`, `SetWindowPos`, and window manipulation calls execute in `< 0.1ms` without AppCore state collisions or crashes.
27
+
28
+ ### 🖥️ Per-Monitor DPI V2 & High-DPI Crisp Rendering
29
+ - **Per-Monitor DPI V2 Support**: Integrated `DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2` across all Windows displays.
30
+ - **Dynamic `WM_DPICHANGED` Handling**: Automatically resizes physical canvas, recalculates client metrics, and scales WebKit view when moving windows across multi-monitor setups with different scaling (100%, 125%, 150%, 200%).
31
+ - **Pixel-Accurate Hit-Testing**: Mouse input coordinates `(x, y)` are dynamically converted from Windows physical pixels to WebKit logical CSS coordinates (`toLogical = physical / dpi_scale`). Clicks, hovers, and drags land pixel-perfectly on DOM elements at any DPI.
32
+ - **High-Quality GDI Halftone Blitting**: `SetStretchBltMode(HALFTONE)` ensures razor-sharp text and graphics rendering.
21
33
 
22
- NanoShell is an ultra-fast, zero-overhead desktop application engine built with **Zig** and **Ultralight GPU-Accelerated WebKit C++**. It allows web developers to build native desktop applications using HTML, CSS, and Vanilla JavaScript with **17MB RSS RAM footprint**, **120 FPS performance**, and **zero-copy C-level OS bindings**.
34
+ ### 📦 Automatic Out-of-the-Box Windows Installer (`nanoshell package`)
35
+ - Generate full-featured Windows Setup installers (`.exe`) with **one single command**:
36
+ ```bash
37
+ npx nanoshell package
38
+ ```
39
+ - **Inno Setup Integration**: Auto-detects local or system Inno Setup (`ISCC.exe`), generates `setup.iss`, and builds single-file installers in `dist/` with Start Menu, Desktop shortcuts, and Control Panel Uninstaller support.
40
+
41
+ ### ⚡ Auto-Updating NPX Cache Detection
42
+ - **No More Stale `npx` Caches**: `npx nanoshell` automatically checks for the latest registry release. If a stale local `npx` cache is detected, it auto-updates to `@latest` seamlessly.
23
43
 
24
44
  ---
25
45
 
@@ -87,13 +107,11 @@ npx nanoshell package
87
107
  ---
88
108
 
89
109
  ## 📦 100% Portable Bundle
90
- Every scaffolded NanoShell app includes portable Visual C++ runtime DLLs (`vcruntime140.dll`, `msvcp140.dll`, `vcruntime140_1.dll`) and is compiled against `x86_64-windows-gnu` baseline CPU targets — ensuring **100% portable out-of-the-box execution on any Windows laptop without admin rights or external installers**.
91
- - Automatic Start Menu & Desktop shortcuts
92
-
110
+ Every scaffolded NanoShell app includes portable Visual C++ runtime DLLs (`vcruntime140.dll`, `msvcp140.dll`, `vcruntime140_1.dll`) and is compiled against `x86_64-windows-gnu` baseline CPU targets — ensuring **100% portable execution on any Windows laptop without admin rights or external installers**.
93
111
 
94
112
  ---
95
113
 
96
- ## 📁 Custom Project Structure
114
+ ## 📁 Project Structure
97
115
 
98
116
  ```text
99
117
  my-awesome-app/
@@ -106,17 +124,12 @@ my-awesome-app/
106
124
  │ ├── icudt67l.dat <-- Unicode ICU data
107
125
  │ └── cacert.pem <-- SSL certificates
108
126
  └── dist/
109
- └── my-awesome-app.exe <-- Your Custom Named Native Executable
127
+ ├── MyAwesomeApp.exe <-- Standalone Executable
128
+ └── MyAwesomeApp-Setup.exe <-- Windows Setup Installer
110
129
  ```
111
130
 
112
131
  ---
113
132
 
114
- ## ⚡ Universal CPU Architecture & Hardware Compatibility
115
-
116
- NanoShell binaries are built using the **`x86_64-windows-baseline` CPU target architecture**, ensuring universal hardware compatibility across all 64-bit Windows laptops and PCs without throwing `illegal instruction` hardware panics on older processors.
117
-
118
- ---
119
-
120
133
  ## 📊 Real-Time FPS Overlay Control (`nanoshell.json`)
121
134
 
122
135
  You can control real-time FPS overlay rendering directly inside your app's `nanoshell.json` manifest:
@@ -134,31 +147,6 @@ You can control real-time FPS overlay rendering directly inside your app's `nano
134
147
  }
135
148
  ```
136
149
 
137
- - `"show_fps": true` — Displays a sleek real-time 120 FPS counter overlay in the top-right corner.
138
- - `"show_fps": false` — Hides the FPS counter overlay.
139
-
140
- ---
141
-
142
- ## 🎨 Writing HTML & CSS
143
-
144
- Developers write standard web code inside `assets/`. NanoShell automatically polyfills flex gaps, handles High-DPI scaling, and trims memory working sets in the background.
145
-
146
- ```css
147
- .content-area {
148
- display: flex;
149
- flex-direction: column;
150
- gap: 24px;
151
- padding: 32px;
152
- }
153
-
154
- .glass-card {
155
- background: rgba(30, 41, 59, 0.45);
156
- border: 1px solid rgba(255, 255, 255, 0.1);
157
- border-radius: 16px;
158
- padding: 24px;
159
- }
160
- ```
161
-
162
150
  ---
163
151
 
164
152
  ## 🤖 AI Agent Integration
@@ -172,5 +160,4 @@ NanoShell includes a built-in AI Agent Skill definition (`SKILL.md`). Any AI cod
172
160
  **Created & Engineered by Suman Biswas**
173
161
 
174
162
  MIT License © Suman Biswas (NanoShell Creator)
175
- "# nanoshell"
176
- # nanoshell
163
+
package/SKILL.md ADDED
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: nanoshell-desktop-framework
3
+ description: Build ultra-fast, 120 FPS, 17MB RAM native desktop applications using HTML, CSS, JS, and Zig with the NanoShell runtime engine (nanoshell) created by Suman Biswas. Includes Per-Monitor DPI V2 crisp scaling and Win32 direct windowing.
4
+ ---
5
+
6
+ # NanoShell Native Desktop Framework Skill Guide (`nanoshell@1.7.7`)
7
+
8
+ **Created & Engineered by Suman Biswas**
9
+
10
+ NanoShell is a hyper-lightweight, browser-free native desktop application framework created by Suman Biswas that compiles to a single ~850KB executable, boots in < 0.8ms, runs at 120 FPS, and consumes only **17.0 MB RAM**.
11
+
12
+ ---
13
+
14
+ ## Starter Template Scaffolding Command
15
+
16
+ AI agents or developers can scaffold a new application using:
17
+
18
+ ```bash
19
+ npx nanoshell <app-name> # Scaffold new app template
20
+ npx nanoshell start # Launch dev engine with hot-reloading
21
+ npx nanoshell build # Build production release binary only
22
+ npx nanoshell package # Build binary and generate Windows Inno Setup installer (.exe)
23
+ ```
24
+
25
+ `npx nanoshell package` generates a single-file Windows Setup `.exe` with a installer dialog allowing end-users to choose:
26
+ - **Per-User Install** (No admin rights required, installs to `%LocalAppData%`)
27
+ - **System-Wide Install** (Requires admin rights, installs to `Program Files`)
28
+
29
+ ---
30
+
31
+ ## ⚡ v1.7.7 Engine Architecture & High-DPI Rules for AI Agents
32
+
33
+ 1. **Pure Win32 Subsystem**: Runs on `.Windows` subsystem with zero background CMD console windows.
34
+ 2. **Per-Monitor DPI V2 Aware**: Integrates `DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2`. Window client sizes are automatically scaled physically (`physical_size = logical_size * dpi_scale`).
35
+ 3. **Pixel-Accurate Mouse Input**: Converts physical Win32 mouse input coordinates `(x, y)` to WebKit logical CSS coordinates via `toLogical(physical, dpi_scale)`. All DOM click and hover events hit pixel-perfectly at 100%, 125%, 150%, and 200% DPI.
36
+ 4. **`WM_DPICHANGED` Handling**: Listens for dynamic display scaling changes when windows move across different monitors and resizes the physical canvas and WebKit view automatically.
37
+ 5. **Standard ES6 Code**: Use standard ES6 DOM event listeners in `app.js`. Avoid optional chaining (`?.`) or nullish coalescing (`??`) if compiling against embedded JavaScriptCore targets.
38
+
39
+ ---
40
+
41
+ ## Developer Workflow Guide
42
+
43
+ ### 1. Project Directory Structure
44
+
45
+ ```text
46
+ my_nanoshell_app/
47
+ ├── app/
48
+ │ ├── index.html <-- Standard HTML markup
49
+ │ ├── styles.css <-- Standard CSS (Flexbox, Grid, Glassmorphism)
50
+ │ └── app.js <-- Application JavaScript logic
51
+ ├── resources/
52
+ │ ├── icudt67l.dat <-- Unicode ICU data
53
+ │ └── cacert.pem <-- SSL certificates
54
+ ├── build.zig <-- Zig build script
55
+ ├── src/
56
+ │ └── main.zig <-- NanoShell host runner
57
+ └── dist/
58
+ ├── my_app.exe <-- Compiled self-contained executable
59
+ └── my_app-Setup.exe <-- Windows Setup Installer
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 2. Developer HTML & CSS Best Practices
65
+
66
+ Developers write standard HTML, CSS, and JS. NanoShell automatically polyfills and optimizes layout rendering at runtime.
67
+
68
+ ### `app/index.html`
69
+ ```html
70
+ <!DOCTYPE html>
71
+ <html lang="en">
72
+ <head>
73
+ <meta charset="UTF-8">
74
+ <title>My NanoShell Native App</title>
75
+ <link rel="stylesheet" href="styles.css">
76
+ </head>
77
+ <body>
78
+ <main class="content-area">
79
+ <header class="glass-card">
80
+ <h1>My NanoShell App</h1>
81
+ </header>
82
+ </main>
83
+ <script src="app.js"></script>
84
+ </body>
85
+ </html>
86
+ ```
87
+
88
+ ### `app/styles.css`
89
+ ```css
90
+ * {
91
+ box-sizing: border-box;
92
+ margin: 0;
93
+ padding: 0;
94
+ font-family: 'Segoe UI', sans-serif;
95
+ }
96
+
97
+ body {
98
+ background: #0b0d19;
99
+ color: #ffffff;
100
+ height: 100vh;
101
+ overflow: hidden;
102
+ }
103
+
104
+ .content-area {
105
+ display: flex;
106
+ flex-direction: column;
107
+ gap: 24px; /* NanoShell engine auto-polyfills flex gap for WebKit */
108
+ padding: 32px;
109
+ }
110
+
111
+ .glass-card {
112
+ background: rgba(30, 41, 59, 0.45);
113
+ border: 1px solid rgba(255, 255, 255, 0.1);
114
+ border-radius: 16px;
115
+ padding: 24px;
116
+ }
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 3. How AI Agents Use This Framework
122
+
123
+ Any AI agent (Antigravity, Claude, Copilot, ChatGPT) can use this framework by following these rules:
124
+
125
+ 1. **Scaffold Web Assets in `app/`**: Put all developer HTML, CSS, and JS in `app/`. Never hardcode UI elements inside C or Zig source files.
126
+ 2. **Standard CSS Rules**: Write standard CSS with `gap`, `display: flex`, and `display: grid`. NanoShell's engine pre-parser handles WebKit layout rules automatically.
127
+ 3. **Build & Package via CLI**: Execute `npx nanoshell build` for binaries or `npx nanoshell package` for installer `.exe` generation.
128
+ 4. **Low Memory Overhead**: NanoShell automatically purges memory caches via `ulPurgeMemory()` and `EmptyWorkingSet()` to maintain a 17MB RAM footprint.
package/cli/index.js CHANGED
@@ -4,6 +4,33 @@ const path = require('path');
4
4
  const fs = require('fs');
5
5
 
6
6
  const pkgDir = path.join(__dirname, '..');
7
+ const pkg = require(path.join(pkgDir, 'package.json'));
8
+
9
+ // ── Auto-Update Cached NPX Check ─────────────────────────────────────────────
10
+ // Prevents users from running stale cached versions of npx nanoshell
11
+ if (!process.env.NANOSHELL_NO_UPDATE_CHECK) {
12
+ try {
13
+ const latestVersion = spawnSync('npm', ['show', 'nanoshell', 'version'], {
14
+ encoding: 'utf8',
15
+ timeout: 2000,
16
+ shell: true
17
+ }).stdout?.trim();
18
+
19
+ if (latestVersion && latestVersion !== pkg.version) {
20
+ console.log(`\x1b[36m⚡ [NanoShell] Outdated npx cache detected (v${pkg.version}). Auto-updating to latest (v${latestVersion})...\x1b[0m\n`);
21
+ const updateResult = spawnSync('npx', ['nanoshell@latest', ...process.argv.slice(2)], {
22
+ stdio: 'inherit',
23
+ shell: true,
24
+ env: { ...process.env, NANOSHELL_NO_UPDATE_CHECK: '1' }
25
+ });
26
+ process.exit(updateResult.status || 0);
27
+ }
28
+ } catch (e) {
29
+ // Ignore timeout or network errors silently
30
+ }
31
+ }
32
+ // ─────────────────────────────────────────────────────────────────────────────
33
+
7
34
  let exePath = path.join(pkgDir, 'zig-out', 'bin', 'nanoshell.exe');
8
35
  if (!fs.existsSync(exePath)) {
9
36
  exePath = path.join(pkgDir, 'bin', 'nanoshell.exe');
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "nanoshell",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
4
4
  "description": "Hyper-lightweight native desktop application framework. 17MB RAM, 120 FPS, pure Win32 DPI-aware windowing with WebKit rendering. No Electron. Created by Suman Biswas.",
5
5
  "main": "cli/index.js",
6
6
  "bin": {
7
7
  "nanoshell": "cli/index.js",
8
8
  "create-nanoshell-app": "cli/index.js"
9
9
  },
10
- "readme": "README.md",
11
10
  "files": [
12
11
  "cli/index.js",
13
12
  "app/",
@@ -18,6 +17,7 @@
18
17
  "zig-out/bin/*.pem",
19
18
  "zig-out/bin/resources/",
20
19
  "vendor/resources/",
20
+ "SKILL.md",
21
21
  "README.md"
22
22
  ],
23
23
  "scripts": {