Initial commit
This commit is contained in:
commit
2f5e10140c
133 changed files with 10429 additions and 0 deletions
1
packages/desktop/.gitignore
vendored
Normal file
1
packages/desktop/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
build
|
||||
37
packages/desktop/electrobun.config.ts
Normal file
37
packages/desktop/electrobun.config.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import type { ElectrobunConfig } from "electrobun";
|
||||
|
||||
import { version } from "@tensamin/shared/package.json";
|
||||
|
||||
export default {
|
||||
app: {
|
||||
name: "tensamin",
|
||||
identifier: "client.tensamin.net",
|
||||
version: version,
|
||||
},
|
||||
build: {
|
||||
views: {
|
||||
mainview: {
|
||||
entrypoint: "src/mainview/index.ts",
|
||||
},
|
||||
},
|
||||
copy: {
|
||||
"../web/dist/": "views/mainview/",
|
||||
},
|
||||
mac: {
|
||||
defaultRenderer: "cef",
|
||||
bundleCEF: true,
|
||||
},
|
||||
linux: {
|
||||
defaultRenderer: "cef",
|
||||
bundleCEF: true,
|
||||
chromiumFlags: {
|
||||
"enable-features": "UseOzonePlatform",
|
||||
"ozone-platform": "wayland",
|
||||
},
|
||||
},
|
||||
win: {
|
||||
defaultRenderer: "cef",
|
||||
bundleCEF: true,
|
||||
},
|
||||
},
|
||||
} satisfies ElectrobunConfig;
|
||||
24
packages/desktop/llms.txt
Normal file
24
packages/desktop/llms.txt
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Electrobun Project
|
||||
|
||||
This is an Electrobun desktop application.
|
||||
|
||||
IMPORTANT: Electrobun is NOT Electron. Do not use Electron APIs or patterns.
|
||||
|
||||
## Documentation
|
||||
|
||||
Full API reference: https://blackboard.sh/electrobun/llms.txt
|
||||
Getting started: https://blackboard.sh/electrobun/docs/
|
||||
|
||||
## Quick Reference
|
||||
|
||||
Import patterns:
|
||||
- Main process (Bun): `import { BrowserWindow } from "electrobun/bun"`
|
||||
- Browser context: `import { Electroview } from "electrobun/view"`
|
||||
|
||||
Use `views://` URLs to load bundled assets (e.g., `url: "views://mainview/index.html"`).
|
||||
Views must be configured in `electrobun.config.ts` to be built and copied into the bundle.
|
||||
|
||||
## About
|
||||
|
||||
Electrobun is built by Blackboard (https://blackboard.sh), an innovation lab building
|
||||
tools and funding teams that define the next generation of technology.
|
||||
19
packages/desktop/package.json
Normal file
19
packages/desktop/package.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "electrobun-hello-world",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple Electrobun app showcasing core features",
|
||||
"scripts": {
|
||||
"format": "bunx prettier --write .",
|
||||
"lint": "echo desktop lint skipped",
|
||||
"build": "echo desktop build skipped",
|
||||
"start": "electrobun dev",
|
||||
"dev": "electrobun dev --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"electrobun": "1.15.1",
|
||||
"@tensamin/shared": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest"
|
||||
}
|
||||
}
|
||||
41
packages/desktop/shell.nix
Normal file
41
packages/desktop/shell.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{pkgs ? import <nixpkgs> {}}: let
|
||||
libs = with pkgs; [
|
||||
nspr
|
||||
nss
|
||||
libxcb
|
||||
libxkbcommon
|
||||
wayland
|
||||
libdecor
|
||||
dbus
|
||||
atk
|
||||
glib
|
||||
gtk3
|
||||
cups
|
||||
libx11
|
||||
libxcomposite
|
||||
libxdamage
|
||||
libxext
|
||||
libxfixes
|
||||
libxrandr
|
||||
libgbm
|
||||
expat
|
||||
cairo
|
||||
pango
|
||||
alsa-lib
|
||||
|
||||
webkitgtk_4_1
|
||||
libsoup_3
|
||||
libayatana-appindicator
|
||||
gdk-pixbuf
|
||||
];
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = [pkgs.bun] ++ libs;
|
||||
|
||||
shellHook = ''
|
||||
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libs}:$LD_LIBRARY_PATH
|
||||
export GDK_BACKEND=wayland
|
||||
export OZONE_PLATFORM=wayland
|
||||
export XDG_SESSION_TYPE=wayland
|
||||
'';
|
||||
}
|
||||
18
packages/desktop/src/bun/index.ts
Normal file
18
packages/desktop/src/bun/index.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { BrowserWindow } from "electrobun/bun";
|
||||
|
||||
// Create the main application window
|
||||
const mainWindow = new BrowserWindow({
|
||||
title: "Hello Electrobun!",
|
||||
url: "views://mainview/index.html",
|
||||
renderer: "cef",
|
||||
frame: {
|
||||
width: 800,
|
||||
height: 800,
|
||||
x: 200,
|
||||
y: 200,
|
||||
},
|
||||
});
|
||||
|
||||
mainWindow.url = "views://mainview/index.html";
|
||||
|
||||
console.log("Hello Electrobun app started!");
|
||||
126
packages/desktop/src/mainview/index.css
Normal file
126
packages/desktop/src/mainview/index.css
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
|
||||
Cantarell, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 40px 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: white;
|
||||
font-size: 3rem;
|
||||
text-align: center;
|
||||
margin-bottom: 8px;
|
||||
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 1.25rem;
|
||||
text-align: center;
|
||||
margin-top: 0;
|
||||
margin-bottom: 40px;
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.welcome-section {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 30px;
|
||||
margin: 30px 0;
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #2563eb;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin: 20px 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.links {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
margin: 25px 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.doc-link {
|
||||
display: inline-block;
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 12px 20px;
|
||||
border-radius: 8px;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s ease;
|
||||
box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
|
||||
}
|
||||
|
||||
.doc-link:hover {
|
||||
background: #1d4ed8;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
|
||||
}
|
||||
|
||||
code {
|
||||
background: #f1f5f9;
|
||||
color: #475569;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-top: 40px;
|
||||
padding: 20px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 8px;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.footer p {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
/* Dark mode support */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.welcome-section {
|
||||
background: #1f2937;
|
||||
color: #f3f4f6;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #60a5fa;
|
||||
}
|
||||
|
||||
code {
|
||||
background: #374151;
|
||||
color: #d1d5db;
|
||||
}
|
||||
}
|
||||
64
packages/desktop/src/mainview/index.html
Normal file
64
packages/desktop/src/mainview/index.html
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Hello Electrobun!</title>
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Hello Electrobun! 🎉</h1>
|
||||
<p class="subtitle">A fast, cross-platform desktop app framework</p>
|
||||
|
||||
<div class="welcome-section">
|
||||
<p>
|
||||
Welcome to your first Electrobun app! This framework combines the
|
||||
power of Bun with native desktop capabilities.
|
||||
</p>
|
||||
|
||||
<h2>What is Electrobun?</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Fast:</strong> Built on Bun's lightning-fast JavaScript
|
||||
runtime
|
||||
</li>
|
||||
<li>
|
||||
<strong>Native:</strong> Access to system APIs like menus, trays,
|
||||
and file dialogs
|
||||
</li>
|
||||
<li>
|
||||
<strong>Cross-platform:</strong> Works on macOS, Windows, and Linux
|
||||
</li>
|
||||
<li>
|
||||
<strong>Web-based UI:</strong> Use familiar HTML, CSS, and
|
||||
JavaScript for your interface
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>Get Started</h2>
|
||||
<p>
|
||||
Ready to build something amazing? Check out the documentation and
|
||||
examples:
|
||||
</p>
|
||||
|
||||
<div class="links">
|
||||
<a href="https://electrobun.dev/" class="doc-link"> 📚 Electrobun </a>
|
||||
<a href="https://github.com/blackboardsh/electrobun" class="doc-link">
|
||||
🐙 GitHub Repository
|
||||
</a>
|
||||
<a href="https://electrobun.dev/docs/apis/bun/" class="doc-link">
|
||||
💡 Api Docs
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>
|
||||
Edit <code>src/bun/index.ts</code> and <code>src/mainview/</code> to
|
||||
customize your app
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
1
packages/desktop/src/mainview/index.ts
Normal file
1
packages/desktop/src/mainview/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
console.log("Hello Electrobun view loaded!");
|
||||
22
packages/desktop/tsconfig.json
Normal file
22
packages/desktop/tsconfig.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleDetection": "force",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noPropertyAccessFromIndexSignature": true
|
||||
},
|
||||
"include": ["src/**/*", "./electrobun.config.ts"],
|
||||
"exclude": ["node_modules", "dist", "build", "../../package/dist"]
|
||||
}
|
||||
Loading…
Reference in a new issue