defuss-desktop 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aron Homberg
4
+ Copyright (c) 2020 Adam Hammad <adamham.dev>
5
+ Some work is based on 98.css by Jordan Scales <thatjdanisso.cool>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,208 @@
1
+ <h1 align="center">
2
+
3
+ <img src="assets/defuss_mascott.png" width="100px" />
4
+
5
+ <p align="center">
6
+ <code>defuss-desktop</code>
7
+ </p>
8
+
9
+ <sup align="center">
10
+
11
+ Themable Desktop Environment
12
+
13
+ </sup>
14
+
15
+ </h1>
16
+
17
+
18
+ > `defuss-desktop` is a comprehensive window manager/desktop environment that enables you to create desktop-like environments directly in the browser - like Windows XP. It provides a complete window system with resizable, movable windows, desktop management, task bars, and application launchers - perfect for building complex web applications that need a desktop-style interface.
19
+
20
+ <h3 align="center">
21
+
22
+ Features
23
+
24
+ </h3>
25
+
26
+ - 🪟 **Full Window Management**: Create, resize, move, minimize, maximize, and close windows
27
+ - 🖥️ **Desktop Environment**: Desktop icons, wallpaper support, and multi-workspace functionality
28
+ - 📊 **Task Management**: Task bar, system tray, and application launcher
29
+ - 🎨 **Customizable UI**: Themeable window decorations and desktop styling
30
+ - ⚡ **Performance Optimized**: Efficient DOM manipulation and memory management
31
+ - 📱 **Responsive Design**: Adapts to different screen sizes and orientations
32
+ - 🎯 **Event System**: Comprehensive window and desktop event handling
33
+ - 🔧 **Developer Friendly**: Simple API for creating window-based applications
34
+
35
+
36
+ <h3 align="center">
37
+
38
+ Basic Usage
39
+
40
+ </h3>
41
+
42
+ ```typescript
43
+ import { WindowManager, Window } from 'defuss-desktop';
44
+
45
+ // Initialize the window manager
46
+ const wm = new WindowManager({
47
+ container: document.body,
48
+ enableDesktop: true,
49
+ enableTaskbar: true
50
+ });
51
+
52
+ // Create a new window
53
+ const window = wm.createWindow({
54
+ title: 'My Application',
55
+ width: 800,
56
+ height: 600,
57
+ resizable: true,
58
+ minimizable: true,
59
+ maximizable: true,
60
+ content: '<div>Hello, Desktop World!</div>'
61
+ });
62
+
63
+ // Show the window
64
+ window.show();
65
+ ```
66
+
67
+ <h3 align="center">
68
+
69
+ Advanced Features
70
+
71
+ </h3>
72
+
73
+ - **Window States**: Normal, minimized, maximized, fullscreen
74
+ - **Desktop Management**: Multiple desktops/workspaces
75
+ - **Application Launcher**: Start menu and application grid
76
+ - **File Manager Integration**: Desktop file operations
77
+ - **System Tray**: Notification area and quick actions
78
+ - **Window Snapping**: Automatic window positioning and sizing
79
+ - **Keyboard Shortcuts**: Comprehensive keyboard navigation
80
+ - **Accessibility Support**: Screen reader and keyboard-only navigation
81
+
82
+
83
+ <h3 align="center">
84
+
85
+ Integrating `defuss-wm` in your project
86
+
87
+ </h3>
88
+
89
+ **🚀 Looking for a template to start from?** Check out our examples that demonstrate desktop environments and window management.
90
+
91
+ #### 1. Install `defuss-wm`:
92
+
93
+ ```bash
94
+ # install a decent package manager
95
+ npm i -g pnpm@^9.13.2
96
+
97
+ # from your project root folder, add defuss-wm to your dependencies
98
+ pnpm install defuss-wm
99
+ ```
100
+
101
+ #### 2. Set up your desktop environment:
102
+
103
+ ```typescript
104
+ import { WindowManager } from 'defuss-wm';
105
+
106
+ // Create a desktop environment
107
+ const wm = new WindowManager({
108
+ container: document.getElementById('desktop'),
109
+ theme: 'default',
110
+ enableDesktop: true,
111
+ enableTaskbar: true,
112
+ enableSystemTray: true
113
+ });
114
+
115
+ // Register an application
116
+ wm.registerApplication({
117
+ id: 'text-editor',
118
+ name: 'Text Editor',
119
+ icon: '/icons/text-editor.svg',
120
+ component: TextEditorComponent
121
+ });
122
+
123
+ // Create and show a window
124
+ const window = wm.createWindow({
125
+ appId: 'text-editor',
126
+ title: 'Untitled Document',
127
+ width: 800,
128
+ height: 600,
129
+ x: 100,
130
+ y: 100
131
+ });
132
+
133
+ window.show();
134
+ ```
135
+
136
+ #### 3. Handle window events:
137
+
138
+ ```typescript
139
+ // Listen for window events
140
+ window.on('resize', (event) => {
141
+ console.log('Window resized:', event.width, event.height);
142
+ });
143
+
144
+ window.on('move', (event) => {
145
+ console.log('Window moved:', event.x, event.y);
146
+ });
147
+
148
+ window.on('close', () => {
149
+ console.log('Window closed');
150
+ });
151
+
152
+ // Desktop events
153
+ wm.on('windowCreated', (window) => {
154
+ console.log('New window created:', window.id);
155
+ });
156
+
157
+ wm.on('desktopClick', (event) => {
158
+ console.log('Desktop clicked at:', event.x, event.y);
159
+ });
160
+ ```
161
+
162
+ <h3 align="center">
163
+
164
+ 🚀 How does `defuss-wm` work?
165
+
166
+ </h3>
167
+
168
+ `defuss-wm` provides a complete window management system built on top of the defuss framework. It manages window lifecycle, desktop interactions, and provides a familiar desktop environment experience within web applications.
169
+
170
+ - **Window Rendering**: Uses defuss's efficient rendering system for window contents
171
+ - **Event Management**: Comprehensive event system for window and desktop interactions
172
+ - **Layout Engine**: Automatic window positioning and snapping
173
+ - **Theme System**: Customizable window decorations and desktop styling
174
+ - **State Management**: Persistent window states and desktop configurations
175
+
176
+ Inside this package, you'll find the following relevant folders and files:
177
+
178
+ ```text
179
+ /
180
+ ├── src/
181
+ │ ├── WindowManager.ts
182
+ │ ├── Window.ts
183
+ │ ├── Desktop.ts
184
+ │ ├── Taskbar.ts
185
+ │ ├── ApplicationLauncher.ts
186
+ │ └── themes/
187
+ ├── dist/
188
+ ├── tsconfig.json
189
+ ├── LICENSE
190
+ ├── package.json
191
+ ```
192
+
193
+ The core `WindowManager` class orchestrates all window operations, while individual components handle specific aspects like the desktop, taskbar, and application management.
194
+
195
+ ## 🧞 Commands
196
+
197
+ All commands are run from the root of the project, from a terminal:
198
+
199
+ | Command | Action |
200
+ | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
201
+ | `pnpm build` | Build a new version of the window manager. |
202
+ | `pnpm test` | Run the test suite for `defuss-wm`. |
203
+
204
+ ---
205
+
206
+ <img src="https://raw.githubusercontent.com/kyr0/defuss/refs/heads/main/assets/defuss_comic.png" />
207
+
208
+ <caption><i><b>Come visit us on defuss island!</b></i></caption>