@struktur/app 2.6.0
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/AGENTS.md +117 -0
- package/LICENSE +110 -0
- package/README.md +127 -0
- package/assets/icon.iconset/icon_128x128.png +0 -0
- package/assets/icon.iconset/icon_128x128@2x.png +0 -0
- package/assets/icon.iconset/icon_16x16.png +0 -0
- package/assets/icon.iconset/icon_16x16@2x.png +0 -0
- package/assets/icon.iconset/icon_256x256.png +0 -0
- package/assets/icon.iconset/icon_256x256@2x.png +0 -0
- package/assets/icon.iconset/icon_32x32.png +0 -0
- package/assets/icon.iconset/icon_32x32@2x.png +0 -0
- package/assets/icon.iconset/icon_512x512.png +0 -0
- package/assets/icon.iconset/icon_512x512@2x.png +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Info.plist +18 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/bspatch +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/bun +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/launcher +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/libNativeWrapper.dylib +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/libasar.dylib +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/MacOS/zig-zstd +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/AppIcon.icns +0 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/app/bun/index.js +231552 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/app/views/main/index.html +45 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/app/views/main/index.js +35 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/build.json +1 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/main.js +164 -0
- package/build/dev-macos-arm64/Struktur-dev.app/Contents/Resources/version.json +1 -0
- package/electrobun.config.ts +30 -0
- package/package.json +29 -0
- package/src/bun/index.ts +23 -0
- package/src/main/index.html +45 -0
- package/src/main/index.ts +48 -0
- package/src/shared/types.ts +307 -0
- package/tsconfig.json +26 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Struktur Desktop App
|
|
2
|
+
|
|
3
|
+
Native desktop application for Struktur using Electrobun.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
- **Main Process**: Bun runtime at `src/bun/index.ts`
|
|
8
|
+
- **Webview**: Production placeholder at `src/main/`
|
|
9
|
+
- **Dev Mode**: Loads from `@struktur/web` dev server with transparent title bar
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### Draggable Header
|
|
14
|
+
The header is marked as a draggable region using the `electrobun-webkit-app-region-drag` CSS class. This allows users to drag the window by grabbing the header area. Interactive elements (buttons, links) inside the header use `electrobun-webkit-app-region-no-drag` to remain clickable.
|
|
15
|
+
|
|
16
|
+
### Transparent Title Bar
|
|
17
|
+
The desktop app uses a transparent title bar (`hiddenInset` style on macOS) that blends with the web UI. The native window control buttons (close/minimize/maximize) appear in the top-left corner.
|
|
18
|
+
|
|
19
|
+
### Window Control Layout
|
|
20
|
+
The layout is specifically arranged to accommodate the window control buttons:
|
|
21
|
+
- **Header**: Reduced left padding (`pl-4`), normal right padding (`pr-6`)
|
|
22
|
+
- **Logo wrapper**: Has top padding (`pt-3`) in desktop mode, positioned below the window buttons
|
|
23
|
+
- **Logo**: Reduced left padding (`pl-3`)
|
|
24
|
+
- **Navbar height**: Fixed at `h-16` (64px) with content centered vertically
|
|
25
|
+
- **No left indent**: Logo sits directly under the window control buttons
|
|
26
|
+
- **Links section**: No border-left (avoiding duplicate borders), reduced left margin
|
|
27
|
+
|
|
28
|
+
## Development Workflow
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Start both web dev server and desktop app (recommended)
|
|
32
|
+
bun run dev
|
|
33
|
+
|
|
34
|
+
# This will:
|
|
35
|
+
# 1. Start @struktur/web dev server on port 3030
|
|
36
|
+
# 2. Wait 3 seconds for server to be ready
|
|
37
|
+
# 3. Launch Electrobun desktop app
|
|
38
|
+
# 4. Desktop app loads from http://localhost:3030?desktop=true
|
|
39
|
+
# 5. Web UI adjusts layout to accommodate window controls
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Scripts
|
|
43
|
+
|
|
44
|
+
- `bun run dev` - Run web + desktop together with hot reload
|
|
45
|
+
- `bun run dev:app` - Desktop app only (requires web server running)
|
|
46
|
+
- `bun run dev:web` - Web server only
|
|
47
|
+
- `bun run build` - Build production app
|
|
48
|
+
- `bun run package` - Package for distribution
|
|
49
|
+
|
|
50
|
+
## Desktop Mode CSS Classes
|
|
51
|
+
|
|
52
|
+
### Draggable Regions
|
|
53
|
+
- `electrobun-webkit-app-region-drag` - Makes element a draggable window region
|
|
54
|
+
- `electrobun-webkit-app-region-no-drag` - Excludes element from drag behavior (for buttons/links)
|
|
55
|
+
|
|
56
|
+
Applied in the web app:
|
|
57
|
+
- **Header**: Has drag class to allow window dragging
|
|
58
|
+
- **Logo, Docs link, GitHub link**: Have no-drag class to remain clickable
|
|
59
|
+
- **Right-side actions** (API keys, buttons): Have no-drag class
|
|
60
|
+
|
|
61
|
+
## Project Structure
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
packages/app/
|
|
65
|
+
├── electrobun.config.ts # Build configuration with icon
|
|
66
|
+
├── package.json # Scripts and dependencies
|
|
67
|
+
├── assets/
|
|
68
|
+
│ └── icon.iconset/ # macOS app icons (all sizes)
|
|
69
|
+
├── src/
|
|
70
|
+
│ ├── bun/
|
|
71
|
+
│ │ └── index.ts # Main process entry
|
|
72
|
+
│ └── main/ # Production webview assets
|
|
73
|
+
│ ├── index.html # HTML shell
|
|
74
|
+
│ └── index.ts # Placeholder
|
|
75
|
+
└── build/ # Build output (generated)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Configuration
|
|
79
|
+
|
|
80
|
+
### Window Setup with Draggable Title Bar
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const win = new BrowserWindow({
|
|
84
|
+
title: "Struktur",
|
|
85
|
+
url: isDev ? "http://localhost:3030?desktop=true" : "views://main/index.html",
|
|
86
|
+
titleBarStyle: "hiddenInset", // Transparent title bar
|
|
87
|
+
frame: { x: 0, y: 0, width: 1400, height: 900 },
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Desktop Mode Detection in Web UI
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
const isDesktop = new URLSearchParams(window.location.search).get("desktop") === "true";
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
When in desktop mode:
|
|
98
|
+
- **Logo wrapper** gets `pt-3` (12px) top padding
|
|
99
|
+
- **Navbar** has fixed height `h-16` with centered content
|
|
100
|
+
- **Header** is marked draggable with `electrobun-webkit-app-region-drag`
|
|
101
|
+
- **Interactive elements** marked with `electrobun-webkit-app-region-no-drag`
|
|
102
|
+
|
|
103
|
+
## Platform Support
|
|
104
|
+
|
|
105
|
+
| Platform | Status | Notes |
|
|
106
|
+
|----------|--------|-------|
|
|
107
|
+
| macOS 14+ | ✅ Supported | Draggable header, transparent title bar, native window controls |
|
|
108
|
+
| Windows 11+ | ⚠️ Basic | Uses WebView2, may need custom window controls |
|
|
109
|
+
| Linux | ⚠️ Basic | Uses WebKitGTK, may need custom window controls |
|
|
110
|
+
|
|
111
|
+
## TODO
|
|
112
|
+
|
|
113
|
+
For full production integration:
|
|
114
|
+
- [ ] Bundle `@struktur/web` static assets into production build
|
|
115
|
+
- [ ] Implement custom window controls for Windows/Linux (since they don't have native overlay)
|
|
116
|
+
- [ ] Add native menu bar integration
|
|
117
|
+
- [ ] Set up CI for automated builds with proper code signing
|
package/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 mateffy
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# @struktur/app
|
|
2
|
+
|
|
3
|
+
Struktur Desktop Application - A native desktop app for structured data extraction.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package packages `@struktur/web` as a native desktop application using Electrobun, which provides:
|
|
8
|
+
|
|
9
|
+
- **Ultra-small bundle size**: ~12MB
|
|
10
|
+
- **Native performance**: Uses Bun runtime and system webviews
|
|
11
|
+
- **Cross-platform**: macOS 14+, Windows 11+, Linux
|
|
12
|
+
- **Transparent title bar**: Seamlessly blends with the web UI
|
|
13
|
+
- **Desktop mode**: Web UI adapts to provide space for window controls
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
### Development (Web + Desktop together)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd packages/app
|
|
21
|
+
bun install
|
|
22
|
+
bun run dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This will:
|
|
26
|
+
1. Start the `@struktur/web` dev server on port 3030
|
|
27
|
+
2. Launch the Electrobun desktop app
|
|
28
|
+
3. Load the web UI from `http://localhost:3030?desktop=true` with full hot reload
|
|
29
|
+
4. The web UI automatically detects desktop mode and adds padding for window controls
|
|
30
|
+
|
|
31
|
+
### Desktop Mode Features
|
|
32
|
+
|
|
33
|
+
When running in the desktop app:
|
|
34
|
+
- **Transparent title bar**: The native title bar is hidden, creating a seamless look
|
|
35
|
+
- **Window control space**: The web UI header adds `pt-10` padding to accommodate macOS window buttons (close/minimize/maximize)
|
|
36
|
+
- **Native feel**: The app feels like a native macOS app with proper window controls
|
|
37
|
+
|
|
38
|
+
## Scripts
|
|
39
|
+
|
|
40
|
+
| Command | Description |
|
|
41
|
+
|---------|-------------|
|
|
42
|
+
| `bun run dev` | Start web server + desktop app together |
|
|
43
|
+
| `bun run dev:app` | Desktop app only |
|
|
44
|
+
| `bun run dev:web` | Web server only |
|
|
45
|
+
| `bun run build` | Build production app |
|
|
46
|
+
| `bun run build:release` | Build optimized release |
|
|
47
|
+
| `bun run package` | Package for distribution |
|
|
48
|
+
|
|
49
|
+
## App Icon
|
|
50
|
+
|
|
51
|
+
The app uses `resources/struktur-icon.png` from the root, converted to a macOS iconset at `assets/icon.iconset/`.
|
|
52
|
+
|
|
53
|
+
## Project Structure
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
packages/app/
|
|
57
|
+
├── electrobun.config.ts # Build configuration with icon
|
|
58
|
+
├── package.json # Scripts and dependencies
|
|
59
|
+
├── assets/
|
|
60
|
+
│ └── icon.iconset/ # macOS app icons
|
|
61
|
+
│ ├── icon_16x16.png
|
|
62
|
+
│ ├── icon_32x32.png
|
|
63
|
+
│ └── ... (all sizes)
|
|
64
|
+
├── src/
|
|
65
|
+
│ ├── bun/
|
|
66
|
+
│ │ └── index.ts # Main process entry (transparent title bar)
|
|
67
|
+
│ └── main/ # Production webview assets
|
|
68
|
+
│ ├── index.html # HTML shell
|
|
69
|
+
│ └── index.ts # Placeholder
|
|
70
|
+
└── build/ # Build output (generated)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Configuration
|
|
74
|
+
|
|
75
|
+
### Window Setup
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
const win = new BrowserWindow({
|
|
79
|
+
title: "Struktur",
|
|
80
|
+
url: isDev ? "http://localhost:3030?desktop=true" : "views://main/index.html",
|
|
81
|
+
titleBarStyle: "hiddenInset", // Transparent title bar on macOS
|
|
82
|
+
frame: { x: 0, y: 0, width: 1400, height: 900 },
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Desktop Mode Detection
|
|
87
|
+
|
|
88
|
+
The web app detects desktop mode via query parameter:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
const isDesktop = new URLSearchParams(window.location.search).get("desktop") === "true";
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
When in desktop mode, the header automatically adjusts:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
<header className={`... ${isDesktop ? 'pt-10' : 'py-0'}`}>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Platform Support
|
|
101
|
+
|
|
102
|
+
| Platform | Status | Notes |
|
|
103
|
+
|----------|--------|-------|
|
|
104
|
+
| macOS 14+ | ✅ Supported | Transparent title bar, native window controls |
|
|
105
|
+
| Windows 11+ | ✅ Supported | Uses WebView2 |
|
|
106
|
+
| Linux | ✅ Supported | Uses WebKitGTK |
|
|
107
|
+
|
|
108
|
+
## Troubleshooting
|
|
109
|
+
|
|
110
|
+
### Icon not showing
|
|
111
|
+
|
|
112
|
+
Make sure the iconset is properly created:
|
|
113
|
+
```bash
|
|
114
|
+
cd resources
|
|
115
|
+
sips -z 512 512 struktur-icon.png --out ../packages/app/assets/icon.iconset/icon_512x512.png
|
|
116
|
+
# ... create all sizes
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Dev server not found
|
|
120
|
+
|
|
121
|
+
If the desktop app shows a blank window:
|
|
122
|
+
1. Check that `@struktur/web` is running: `bun run --filter @struktur/web dev`
|
|
123
|
+
2. Verify port 3030 is available
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
FSL-1.1-MIT
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleExecutable</key>
|
|
6
|
+
<string>launcher</string>
|
|
7
|
+
<key>CFBundleIdentifier</key>
|
|
8
|
+
<string>com.struktur.app</string>
|
|
9
|
+
<key>CFBundleName</key>
|
|
10
|
+
<string>Struktur-dev</string>
|
|
11
|
+
<key>CFBundleVersion</key>
|
|
12
|
+
<string>1.0.0</string>
|
|
13
|
+
<key>CFBundlePackageType</key>
|
|
14
|
+
<string>APPL</string>
|
|
15
|
+
<key>CFBundleIconFile</key>
|
|
16
|
+
<string>AppIcon</string>
|
|
17
|
+
</dict>
|
|
18
|
+
</plist>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|