@leejungkiin/awkit 1.5.5 → 1.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/README.md +6 -4
- package/bin/awk.js +196 -8
- package/core/GEMINI.md +24 -8
- package/core/work-modes.json +45 -0
- package/package.json +3 -3
- package/skill-packs/cocos2d/pack.json +8 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/LICENSE.txt +8 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/SKILL.md +168 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/action.md +278 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/animation.md +220 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/event.md +133 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/input.md +291 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/label.md +184 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/node-scene.md +212 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/scene.md +228 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/sprite.md +206 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/core/texture.md +186 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/about-engine.md +53 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/installation.md +203 -0
- package/skill-packs/cocos2d/skills/cocos2d-x/examples/getting-started/quick-start.md +134 -0
- package/skill-packs/electron/pack.json +9 -0
- package/skill-packs/electron/skills/electron/LICENSE.txt +202 -0
- package/skill-packs/electron/skills/electron/SKILL.md +160 -0
- package/skill-packs/electron/skills/electron/api/app.md +83 -0
- package/skill-packs/electron/skills/electron/api/browser-window.md +84 -0
- package/skill-packs/electron/skills/electron/examples/advanced/packaging.md +140 -0
- package/skill-packs/electron/skills/electron/examples/api/browser-window.md +182 -0
- package/skill-packs/electron/skills/electron/examples/api/menu.md +187 -0
- package/skill-packs/electron/skills/electron/examples/getting-started/installation.md +88 -0
- package/skill-packs/electron/skills/electron/examples/getting-started/quick-start.md +104 -0
- package/skill-packs/electron/skills/electron/examples/processes/ipc-communication.md +140 -0
- package/skill-packs/electron/skills/electron/examples/processes/main-process.md +121 -0
- package/skill-packs/electron/skills/electron/templates/main-process.md +105 -0
- package/skill-packs/electron/skills/electron/templates/preload-script.md +84 -0
- package/skill-packs/electron/skills/electron-egg/LICENSE.txt +202 -0
- package/skill-packs/electron/skills/electron-egg/SKILL.md +154 -0
- package/skill-packs/electron/skills/electron-egg/api/config-api.md +62 -0
- package/skill-packs/electron/skills/electron-egg/api/ipc-api.md +55 -0
- package/skill-packs/electron/skills/electron-egg/api/main-api.md +54 -0
- package/skill-packs/electron/skills/electron-egg/api/renderer-api.md +62 -0
- package/skill-packs/electron/skills/electron-egg/api/window-api.md +64 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/ipc-communication.md +84 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/main-process.md +89 -0
- package/skill-packs/electron/skills/electron-egg/examples/features/renderer-process.md +74 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/build.md +77 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/configuration.md +88 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/installation.md +66 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/intro.md +47 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/project-structure.md +73 -0
- package/skill-packs/electron/skills/electron-egg/examples/guide/quick-start.md +78 -0
- package/skill-packs/electron/skills/electron-egg/templates/configuration.md +63 -0
- package/skill-packs/electron/skills/electron-egg/templates/installation.md +42 -0
- package/skill-packs/electron/skills/electron-egg/templates/project-setup.md +75 -0
- package/skill-packs/flutter/pack.json +9 -0
- package/skill-packs/flutter/skills/flutter/LICENSE.txt +202 -0
- package/skill-packs/flutter/skills/flutter/SKILL.md +127 -0
- package/skill-packs/flutter/skills/flutter-project-creater/LICENSE.txt +202 -0
- package/skill-packs/flutter/skills/flutter-project-creater/SKILL.md +106 -0
- package/skill-packs/threejs/pack.json +25 -0
- package/skill-packs/threejs/skills/README.md +95 -0
- package/skill-packs/threejs/skills/threejs-animation/SKILL.md +86 -0
- package/skill-packs/threejs/skills/threejs-animation/examples/workflow-mixer-action.md +20 -0
- package/skill-packs/threejs/skills/threejs-animation/references/official-sections.md +19 -0
- package/skill-packs/threejs/skills/threejs-audio/SKILL.md +112 -0
- package/skill-packs/threejs/skills/threejs-audio/examples/workflow-positional-audio.md +15 -0
- package/skill-packs/threejs/skills/threejs-audio/references/official-sections.md +16 -0
- package/skill-packs/threejs/skills/threejs-camera/SKILL.md +96 -0
- package/skill-packs/threejs/skills/threejs-camera/examples/workflow-perspective-resize.md +13 -0
- package/skill-packs/threejs/skills/threejs-controls/SKILL.md +101 -0
- package/skill-packs/threejs/skills/threejs-controls/examples/workflow-orbit-damping.md +15 -0
- package/skill-packs/threejs/skills/threejs-dev-setup/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-dev-setup/examples/workflow-scaffold.md +24 -0
- package/skill-packs/threejs/skills/threejs-geometries/SKILL.md +108 -0
- package/skill-packs/threejs/skills/threejs-geometries/examples/workflow-extrude-shape.md +13 -0
- package/skill-packs/threejs/skills/threejs-helpers/SKILL.md +103 -0
- package/skill-packs/threejs/skills/threejs-helpers/examples/workflow-light-camera-helpers.md +13 -0
- package/skill-packs/threejs/skills/threejs-lights/SKILL.md +103 -0
- package/skill-packs/threejs/skills/threejs-lights/examples/workflow-directional-shadow.md +17 -0
- package/skill-packs/threejs/skills/threejs-loaders/SKILL.md +89 -0
- package/skill-packs/threejs/skills/threejs-loaders/examples/workflow-gltf-draco.md +22 -0
- package/skill-packs/threejs/skills/threejs-loaders/references/official-sections.md +27 -0
- package/skill-packs/threejs/skills/threejs-materials/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-materials/examples/workflow-pbr-transparent.md +15 -0
- package/skill-packs/threejs/skills/threejs-math/SKILL.md +102 -0
- package/skill-packs/threejs/skills/threejs-math/examples/workflow-ray-aabb.md +11 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/SKILL.md +83 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/examples/workflow-tsl-entry.md +13 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/references/official-links.md +8 -0
- package/skill-packs/threejs/skills/threejs-node-tsl/references/tsl-vs-classic.md +23 -0
- package/skill-packs/threejs/skills/threejs-objects/SKILL.md +111 -0
- package/skill-packs/threejs/skills/threejs-objects/examples/workflow-raycaster-pick.md +17 -0
- package/skill-packs/threejs/skills/threejs-postprocessing/SKILL.md +116 -0
- package/skill-packs/threejs/skills/threejs-postprocessing/examples/workflow-composer-bloom.md +15 -0
- package/skill-packs/threejs/skills/threejs-renderers/SKILL.md +91 -0
- package/skill-packs/threejs/skills/threejs-renderers/examples/workflow-renderer-resize.md +21 -0
- package/skill-packs/threejs/skills/threejs-renderers/references/official-sections.md +14 -0
- package/skill-packs/threejs/skills/threejs-scenes/SKILL.md +90 -0
- package/skill-packs/threejs/skills/threejs-scenes/examples/workflow-fog-background.md +13 -0
- package/skill-packs/threejs/skills/threejs-textures/SKILL.md +83 -0
- package/skill-packs/threejs/skills/threejs-textures/examples/workflow-pmrem-env.md +19 -0
- package/skill-packs/threejs/skills/threejs-webxr/SKILL.md +104 -0
- package/skill-packs/threejs/skills/threejs-webxr/examples/workflow-xr-button.md +15 -0
- package/skills/CATALOG.md +44 -49
- package/skills/TRIGGER_INDEX.md +30 -0
- package/skills/awf-session-restore/SKILL.md +19 -2
- package/skills/brainstorm-agent/SKILL.md +2 -0
- package/skills/code-review/SKILL.md +2 -0
- package/skills/code-review-system-principles/SKILL.md +154 -0
- package/skills/codex-conductor/SKILL.md +6 -4
- package/skills/gemini-conductor/SKILL.md +4 -3
- package/skills/gitnexus-intelligence/SKILL.md +2 -0
- package/skills/module-spec-writer/SKILL.md +2 -0
- package/skills/nm-memory-sync/SKILL.md +10 -0
- package/skills/skill-creator/SKILL.md +2 -0
- package/skills/spec-gate/SKILL.md +2 -0
- package/skills/symphony-enforcer/SKILL.md +9 -0
- package/skills/symphony-enforcer/examples/mindful-stop.md +141 -0
- package/skills/symphony-enforcer/examples/task-completion.md +11 -2
- package/skills/symphony-enforcer/examples/trigger-points.md +7 -0
- package/skills/symphony-orchestrator/SKILL.md +2 -0
- package/skills/telegram-notify/SKILL.md +1 -0
- package/skills/trello-sync/SKILL.md +7 -0
- package/skills/verification-gate/SKILL.md +2 -0
- package/skills/visual-design-gate/SKILL.md +2 -0
- package/templates/project-identity/android.json +26 -1
- package/templates/project-identity/backend-nestjs.json +26 -1
- package/templates/project-identity/expo.json +26 -1
- package/templates/project-identity/ios.json +26 -1
- package/templates/project-identity/web-nextjs.json +26 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Main Process API
|
|
2
|
+
|
|
3
|
+
## API Reference
|
|
4
|
+
|
|
5
|
+
Electron EGG main process API.
|
|
6
|
+
|
|
7
|
+
### Application Class
|
|
8
|
+
|
|
9
|
+
**new Application(options)**
|
|
10
|
+
- Create new application instance
|
|
11
|
+
|
|
12
|
+
**app.start()**
|
|
13
|
+
- Start the application
|
|
14
|
+
|
|
15
|
+
**app.on(event, callback)**
|
|
16
|
+
- Listen to application events
|
|
17
|
+
|
|
18
|
+
### BrowserWindow
|
|
19
|
+
|
|
20
|
+
**new BrowserWindow(options)**
|
|
21
|
+
- Create new browser window
|
|
22
|
+
|
|
23
|
+
**window.loadFile(path)**
|
|
24
|
+
- Load HTML file
|
|
25
|
+
|
|
26
|
+
**window.loadURL(url)**
|
|
27
|
+
- Load URL
|
|
28
|
+
|
|
29
|
+
**window.webContents.send(channel, ...args)**
|
|
30
|
+
- Send message to renderer
|
|
31
|
+
|
|
32
|
+
### ipcMain
|
|
33
|
+
|
|
34
|
+
**ipcMain.on(channel, listener)**
|
|
35
|
+
- Listen for IPC messages
|
|
36
|
+
|
|
37
|
+
**ipcMain.handle(channel, listener)**
|
|
38
|
+
- Handle IPC requests
|
|
39
|
+
|
|
40
|
+
**ipcMain.removeListener(channel, listener)**
|
|
41
|
+
- Remove IPC listener
|
|
42
|
+
|
|
43
|
+
### app
|
|
44
|
+
|
|
45
|
+
**app.quit()**
|
|
46
|
+
- Quit the application
|
|
47
|
+
|
|
48
|
+
**app.getPath(name)**
|
|
49
|
+
- Get application path
|
|
50
|
+
|
|
51
|
+
**app.on(event, callback)**
|
|
52
|
+
- Listen to app events
|
|
53
|
+
|
|
54
|
+
**See also:** `examples/features/main-process.md` for detailed examples
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Renderer Process API
|
|
2
|
+
|
|
3
|
+
## API Reference
|
|
4
|
+
|
|
5
|
+
Electron EGG renderer process API.
|
|
6
|
+
|
|
7
|
+
### ipcRenderer
|
|
8
|
+
|
|
9
|
+
**ipcRenderer.send(channel, ...args)**
|
|
10
|
+
- Send message to main process
|
|
11
|
+
|
|
12
|
+
**ipcRenderer.sendSync(channel, ...args)**
|
|
13
|
+
- Send synchronous message to main process
|
|
14
|
+
|
|
15
|
+
**ipcRenderer.on(channel, listener)**
|
|
16
|
+
- Listen for IPC messages from main
|
|
17
|
+
|
|
18
|
+
**ipcRenderer.once(channel, listener)**
|
|
19
|
+
- Listen for IPC message once
|
|
20
|
+
|
|
21
|
+
**ipcRenderer.invoke(channel, ...args)**
|
|
22
|
+
- Invoke handler in main process (async)
|
|
23
|
+
|
|
24
|
+
**ipcRenderer.removeListener(channel, listener)**
|
|
25
|
+
- Remove IPC listener
|
|
26
|
+
|
|
27
|
+
**ipcRenderer.removeAllListeners(channel)**
|
|
28
|
+
- Remove all listeners for channel
|
|
29
|
+
|
|
30
|
+
### remote (deprecated)
|
|
31
|
+
|
|
32
|
+
**remote.require(module)**
|
|
33
|
+
- Require module from main process (deprecated in Electron 12+)
|
|
34
|
+
|
|
35
|
+
**remote.getCurrentWindow()**
|
|
36
|
+
- Get current window (deprecated)
|
|
37
|
+
|
|
38
|
+
### contextBridge (Electron 12+)
|
|
39
|
+
|
|
40
|
+
**contextBridge.exposeInMainWorld(apiKey, api)**
|
|
41
|
+
- Expose API to renderer process securely
|
|
42
|
+
|
|
43
|
+
**Example:**
|
|
44
|
+
```javascript
|
|
45
|
+
// Main process
|
|
46
|
+
const { contextBridge } = require('electron')
|
|
47
|
+
|
|
48
|
+
contextBridge.exposeInMainWorld('electronAPI', {
|
|
49
|
+
send: (channel, data) => ipcRenderer.send(channel, data),
|
|
50
|
+
on: (channel, callback) => ipcRenderer.on(channel, callback)
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### DOM APIs
|
|
55
|
+
|
|
56
|
+
Renderer process has access to all standard DOM APIs:
|
|
57
|
+
- `document` - Document object
|
|
58
|
+
- `window` - Window object
|
|
59
|
+
- `localStorage` - Local storage
|
|
60
|
+
- `sessionStorage` - Session storage
|
|
61
|
+
|
|
62
|
+
**See also:** `examples/features/renderer-process.md` for detailed examples
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Window API
|
|
2
|
+
|
|
3
|
+
## API Reference
|
|
4
|
+
|
|
5
|
+
Electron EGG window management API.
|
|
6
|
+
|
|
7
|
+
### BrowserWindow
|
|
8
|
+
|
|
9
|
+
**new BrowserWindow(options)**
|
|
10
|
+
- Create new browser window
|
|
11
|
+
|
|
12
|
+
**Options:**
|
|
13
|
+
- `width` - Window width
|
|
14
|
+
- `height` - Window height
|
|
15
|
+
- `minWidth` - Minimum width
|
|
16
|
+
- `minHeight` - Minimum height
|
|
17
|
+
- `title` - Window title
|
|
18
|
+
- `frame` - Show window frame
|
|
19
|
+
- `transparent` - Transparent window
|
|
20
|
+
- `resizable` - Resizable window
|
|
21
|
+
- `maximizable` - Maximizable window
|
|
22
|
+
- `minimizable` - Minimizable window
|
|
23
|
+
|
|
24
|
+
### Window Methods
|
|
25
|
+
|
|
26
|
+
**window.loadFile(path)**
|
|
27
|
+
- Load HTML file
|
|
28
|
+
|
|
29
|
+
**window.loadURL(url)**
|
|
30
|
+
- Load URL
|
|
31
|
+
|
|
32
|
+
**window.show()**
|
|
33
|
+
- Show window
|
|
34
|
+
|
|
35
|
+
**window.hide()**
|
|
36
|
+
- Hide window
|
|
37
|
+
|
|
38
|
+
**window.close()**
|
|
39
|
+
- Close window
|
|
40
|
+
|
|
41
|
+
**window.minimize()**
|
|
42
|
+
- Minimize window
|
|
43
|
+
|
|
44
|
+
**window.maximize()**
|
|
45
|
+
- Maximize window
|
|
46
|
+
|
|
47
|
+
**window.restore()**
|
|
48
|
+
- Restore window
|
|
49
|
+
|
|
50
|
+
### Window Events
|
|
51
|
+
|
|
52
|
+
**window.on('closed', callback)**
|
|
53
|
+
- Window closed event
|
|
54
|
+
|
|
55
|
+
**window.on('ready-to-show', callback)**
|
|
56
|
+
- Window ready to show event
|
|
57
|
+
|
|
58
|
+
**window.on('maximize', callback)**
|
|
59
|
+
- Window maximized event
|
|
60
|
+
|
|
61
|
+
**window.on('unmaximize', callback)**
|
|
62
|
+
- Window unmaximized event
|
|
63
|
+
|
|
64
|
+
**See also:** `examples/features/window-management.md` for detailed examples
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# IPC Communication
|
|
2
|
+
|
|
3
|
+
**官方文档**: https://www.kaka996.com/,
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Instructions
|
|
7
|
+
|
|
8
|
+
This example demonstrates IPC communication in Electron EGG.
|
|
9
|
+
|
|
10
|
+
### Key Concepts
|
|
11
|
+
|
|
12
|
+
- IPC channels
|
|
13
|
+
- Message sending
|
|
14
|
+
- Message receiving
|
|
15
|
+
- Event handling
|
|
16
|
+
|
|
17
|
+
### Example: Main Process IPC
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
// main/index.js
|
|
21
|
+
const { ipcMain } = require('electron')
|
|
22
|
+
|
|
23
|
+
// Listen for messages
|
|
24
|
+
ipcMain.on('message', (event, data) => {
|
|
25
|
+
console.log('Received:', data)
|
|
26
|
+
|
|
27
|
+
// Reply to renderer
|
|
28
|
+
event.reply('reply', { status: 'success' })
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Handle synchronous messages
|
|
32
|
+
ipcMain.on('sync-message', (event, data) => {
|
|
33
|
+
event.returnValue = 'Response'
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Example: Renderer Process IPC
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
// renderer/src/index.js
|
|
41
|
+
const { ipcRenderer } = require('electron')
|
|
42
|
+
|
|
43
|
+
// Send message to main process
|
|
44
|
+
ipcRenderer.send('message', { data: 'Hello' })
|
|
45
|
+
|
|
46
|
+
// Listen for reply
|
|
47
|
+
ipcRenderer.on('reply', (event, data) => {
|
|
48
|
+
console.log('Received:', data)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// Send synchronous message
|
|
52
|
+
const result = ipcRenderer.sendSync('sync-message', { data: 'Hello' })
|
|
53
|
+
console.log('Result:', result)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Example: IPC Channels
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
// Define IPC channels
|
|
60
|
+
const IPC_CHANNELS = {
|
|
61
|
+
GET_DATA: 'get-data',
|
|
62
|
+
SET_DATA: 'set-data',
|
|
63
|
+
NOTIFY: 'notify'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Main process
|
|
67
|
+
ipcMain.on(IPC_CHANNELS.GET_DATA, (event) => {
|
|
68
|
+
event.reply(IPC_CHANNELS.GET_DATA, { data: 'value' })
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// Renderer process
|
|
72
|
+
ipcRenderer.send(IPC_CHANNELS.GET_DATA)
|
|
73
|
+
ipcRenderer.on(IPC_CHANNELS.GET_DATA, (event, data) => {
|
|
74
|
+
console.log('Data:', data)
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Key Points
|
|
79
|
+
|
|
80
|
+
- Use ipcMain in main process
|
|
81
|
+
- Use ipcRenderer in renderer process
|
|
82
|
+
- Define IPC channels
|
|
83
|
+
- Handle async and sync messages
|
|
84
|
+
- Proper error handling
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Main Process
|
|
2
|
+
|
|
3
|
+
**官方文档**: https://www.kaka996.com/,
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Instructions
|
|
7
|
+
|
|
8
|
+
This example demonstrates main process usage in Electron EGG.
|
|
9
|
+
|
|
10
|
+
### Key Concepts
|
|
11
|
+
|
|
12
|
+
- Main process entry
|
|
13
|
+
- Application lifecycle
|
|
14
|
+
- Window management
|
|
15
|
+
- IPC handling
|
|
16
|
+
|
|
17
|
+
### Example: Main Process Entry
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
// main/index.js
|
|
21
|
+
const { Application } = require('electron-egg')
|
|
22
|
+
|
|
23
|
+
const app = new Application({
|
|
24
|
+
// Configuration
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
app.start()
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Example: Application Lifecycle
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
// main/index.js
|
|
34
|
+
const { Application } = require('electron-egg')
|
|
35
|
+
|
|
36
|
+
const app = new Application()
|
|
37
|
+
|
|
38
|
+
app.on('ready', () => {
|
|
39
|
+
console.log('Application ready')
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
app.on('window-all-closed', () => {
|
|
43
|
+
if (process.platform !== 'darwin') {
|
|
44
|
+
app.quit()
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
app.start()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example: Window Management
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
// main/window/main.js
|
|
55
|
+
const { BrowserWindow } = require('electron')
|
|
56
|
+
|
|
57
|
+
function createWindow() {
|
|
58
|
+
const win = new BrowserWindow({
|
|
59
|
+
width: 1200,
|
|
60
|
+
height: 800
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
win.loadFile('renderer/index.html')
|
|
64
|
+
|
|
65
|
+
return win
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = { createWindow }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Example: IPC Handling
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// main/index.js
|
|
75
|
+
const { ipcMain } = require('electron')
|
|
76
|
+
|
|
77
|
+
ipcMain.on('message', (event, data) => {
|
|
78
|
+
console.log('Received:', data)
|
|
79
|
+
event.reply('reply', 'Response')
|
|
80
|
+
})
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Key Points
|
|
84
|
+
|
|
85
|
+
- Main process runs in Node.js
|
|
86
|
+
- Handle application lifecycle
|
|
87
|
+
- Manage windows
|
|
88
|
+
- Handle IPC communication
|
|
89
|
+
- Access Node.js APIs
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Renderer Process
|
|
2
|
+
|
|
3
|
+
**官方文档**: https://www.kaka996.com/,
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Instructions
|
|
7
|
+
|
|
8
|
+
This example demonstrates renderer process usage in Electron EGG.
|
|
9
|
+
|
|
10
|
+
### Key Concepts
|
|
11
|
+
|
|
12
|
+
- Renderer process entry
|
|
13
|
+
- UI rendering
|
|
14
|
+
- IPC communication
|
|
15
|
+
- DOM manipulation
|
|
16
|
+
|
|
17
|
+
### Example: Renderer Process Entry
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<!-- renderer/index.html -->
|
|
21
|
+
<!DOCTYPE html>
|
|
22
|
+
<html>
|
|
23
|
+
<head>
|
|
24
|
+
<title>My App</title>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<div id="app"></div>
|
|
28
|
+
<script src="./src/index.js"></script>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Example: UI Rendering
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
// renderer/src/index.js
|
|
37
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
38
|
+
const app = document.getElementById('app')
|
|
39
|
+
app.innerHTML = '<h1>Hello Electron EGG</h1>'
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Example: IPC Communication
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
// renderer/src/index.js
|
|
47
|
+
const { ipcRenderer } = require('electron')
|
|
48
|
+
|
|
49
|
+
// Send message to main process
|
|
50
|
+
ipcRenderer.send('message', { data: 'Hello' })
|
|
51
|
+
|
|
52
|
+
// Listen for reply
|
|
53
|
+
ipcRenderer.on('reply', (event, data) => {
|
|
54
|
+
console.log('Received:', data)
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Example: DOM Manipulation
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
// renderer/src/index.js
|
|
62
|
+
const button = document.getElementById('button')
|
|
63
|
+
button.addEventListener('click', () => {
|
|
64
|
+
console.log('Button clicked')
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Key Points
|
|
69
|
+
|
|
70
|
+
- Renderer process runs in browser
|
|
71
|
+
- Use HTML/CSS/JavaScript
|
|
72
|
+
- Communicate via IPC
|
|
73
|
+
- Access DOM APIs
|
|
74
|
+
- Limited Node.js access
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Build and Package
|
|
2
|
+
|
|
3
|
+
**官方文档**: https://www.kaka996.com/,
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Instructions
|
|
7
|
+
|
|
8
|
+
This example demonstrates how to build and package Electron EGG applications.
|
|
9
|
+
|
|
10
|
+
### Key Concepts
|
|
11
|
+
|
|
12
|
+
- Build process
|
|
13
|
+
- Package configuration
|
|
14
|
+
- Platform-specific builds
|
|
15
|
+
- Distribution
|
|
16
|
+
|
|
17
|
+
### Example: Build Process
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Build for production
|
|
21
|
+
npm run build
|
|
22
|
+
|
|
23
|
+
# Build for specific platform
|
|
24
|
+
npm run build:win
|
|
25
|
+
npm run build:mac
|
|
26
|
+
npm run build:linux
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Example: Package Configuration
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"build": {
|
|
34
|
+
"appId": "com.example.myapp",
|
|
35
|
+
"productName": "My App",
|
|
36
|
+
"directories": {
|
|
37
|
+
"output": "dist"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"main/**/*",
|
|
41
|
+
"renderer/**/*",
|
|
42
|
+
"config/**/*"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Example: Platform-Specific Builds
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Windows
|
|
52
|
+
npm run build:win
|
|
53
|
+
|
|
54
|
+
# macOS
|
|
55
|
+
npm run build:mac
|
|
56
|
+
|
|
57
|
+
# Linux
|
|
58
|
+
npm run build:linux
|
|
59
|
+
|
|
60
|
+
# All platforms
|
|
61
|
+
npm run build:all
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Example: Distribution
|
|
65
|
+
|
|
66
|
+
After building, distribution files are in the `dist` directory:
|
|
67
|
+
- Windows: `.exe` installer
|
|
68
|
+
- macOS: `.dmg` or `.pkg`
|
|
69
|
+
- Linux: `.AppImage` or `.deb`
|
|
70
|
+
|
|
71
|
+
### Key Points
|
|
72
|
+
|
|
73
|
+
- Use npm run build for production
|
|
74
|
+
- Configure build options
|
|
75
|
+
- Support multiple platforms
|
|
76
|
+
- Output to dist directory
|
|
77
|
+
- Follow platform conventions
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
**官方文档**: https://www.kaka996.com/,
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Instructions
|
|
7
|
+
|
|
8
|
+
This example demonstrates how to configure Electron EGG.
|
|
9
|
+
|
|
10
|
+
### Key Concepts
|
|
11
|
+
|
|
12
|
+
- Configuration files
|
|
13
|
+
- App info configuration
|
|
14
|
+
- Window configuration
|
|
15
|
+
- Plugin configuration
|
|
16
|
+
|
|
17
|
+
### Example: Configuration Files
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
// config/config.default.js
|
|
21
|
+
module.exports = {
|
|
22
|
+
appInfo: {
|
|
23
|
+
name: 'my-app',
|
|
24
|
+
baseDir: __dirname,
|
|
25
|
+
env: 'local',
|
|
26
|
+
home: process.env.HOME,
|
|
27
|
+
root: process.cwd(),
|
|
28
|
+
appUserDataDir: ''
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Example: App Info Configuration
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
module.exports = {
|
|
37
|
+
appInfo: {
|
|
38
|
+
name: 'my-app', // App name
|
|
39
|
+
baseDir: __dirname, // Base directory
|
|
40
|
+
env: 'local', // Environment
|
|
41
|
+
home: process.env.HOME, // Home directory
|
|
42
|
+
root: process.cwd(), // Root directory
|
|
43
|
+
appUserDataDir: '' // User data directory
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Example: Window Configuration
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
module.exports = {
|
|
52
|
+
mainWindow: {
|
|
53
|
+
width: 1200,
|
|
54
|
+
height: 800,
|
|
55
|
+
minWidth: 800,
|
|
56
|
+
minHeight: 600,
|
|
57
|
+
title: 'My App',
|
|
58
|
+
frame: true,
|
|
59
|
+
transparent: false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Example: Plugin Configuration
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
module.exports = {
|
|
68
|
+
addons: {
|
|
69
|
+
tray: {
|
|
70
|
+
enable: true
|
|
71
|
+
},
|
|
72
|
+
security: {
|
|
73
|
+
enable: true
|
|
74
|
+
},
|
|
75
|
+
autoUpdater: {
|
|
76
|
+
enable: false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Key Points
|
|
83
|
+
|
|
84
|
+
- Configure in config files
|
|
85
|
+
- Support multiple environments
|
|
86
|
+
- Window configuration options
|
|
87
|
+
- Plugin enable/disable
|
|
88
|
+
- Environment-specific configs
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Installation
|
|
2
|
+
|
|
3
|
+
**官方文档**: https://www.kaka996.com/,
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Instructions
|
|
7
|
+
|
|
8
|
+
This example demonstrates how to install Electron EGG.
|
|
9
|
+
|
|
10
|
+
### Key Concepts
|
|
11
|
+
|
|
12
|
+
- Environment requirements
|
|
13
|
+
- Package installation
|
|
14
|
+
- Project initialization
|
|
15
|
+
- Dependencies
|
|
16
|
+
|
|
17
|
+
### Example: Environment Requirements
|
|
18
|
+
|
|
19
|
+
- Node.js >= 14.x
|
|
20
|
+
- npm or yarn or pnpm
|
|
21
|
+
- Go (optional, for Go business process)
|
|
22
|
+
|
|
23
|
+
### Example: Package Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Using npm
|
|
27
|
+
npm install electron-egg
|
|
28
|
+
|
|
29
|
+
# Using yarn
|
|
30
|
+
yarn add electron-egg
|
|
31
|
+
|
|
32
|
+
# Using pnpm
|
|
33
|
+
pnpm add electron-egg
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Example: Project Initialization
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Clone demo repository
|
|
40
|
+
git clone https://gitee.com/dromara/electron-egg.git
|
|
41
|
+
|
|
42
|
+
# Install dependencies
|
|
43
|
+
cd electron-egg
|
|
44
|
+
npm install
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Example: Install Dependencies
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Install all dependencies
|
|
51
|
+
npm install
|
|
52
|
+
|
|
53
|
+
# Or using yarn
|
|
54
|
+
yarn install
|
|
55
|
+
|
|
56
|
+
# Or using pnpm
|
|
57
|
+
pnpm install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Key Points
|
|
61
|
+
|
|
62
|
+
- Check Node.js version
|
|
63
|
+
- Install dependencies properly
|
|
64
|
+
- Use demo repository for quick start
|
|
65
|
+
- Support npm, yarn, pnpm
|
|
66
|
+
- Optional Go support
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
|
|
3
|
+
**官方文档**: https://www.kaka996.com/,
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Instructions
|
|
7
|
+
|
|
8
|
+
This example provides an introduction to Electron EGG.
|
|
9
|
+
|
|
10
|
+
### Key Concepts
|
|
11
|
+
|
|
12
|
+
- What is Electron EGG
|
|
13
|
+
- Framework architecture
|
|
14
|
+
- Core features
|
|
15
|
+
- Version information
|
|
16
|
+
|
|
17
|
+
### Example: What is Electron EGG
|
|
18
|
+
|
|
19
|
+
Electron EGG is a desktop application development framework based on Electron and Egg.js, providing a complete development toolchain and best practices.
|
|
20
|
+
|
|
21
|
+
### Example: Framework Architecture
|
|
22
|
+
|
|
23
|
+
Electron EGG uses a multi-process architecture:
|
|
24
|
+
- **Main Process**: Main application process
|
|
25
|
+
- **Renderer Process**: UI rendering process
|
|
26
|
+
- **Business Process**: Optional business logic process (Python/Go)
|
|
27
|
+
|
|
28
|
+
### Example: Core Features
|
|
29
|
+
|
|
30
|
+
- **Multi-process Architecture**: Main, renderer, and business processes
|
|
31
|
+
- **IPC Communication**: Inter-process communication
|
|
32
|
+
- **Plugin System**: Extensible plugin architecture
|
|
33
|
+
- **Hot Reload**: Development hot reload
|
|
34
|
+
- **Build Tools**: Complete build and package tools
|
|
35
|
+
- **Cross-platform**: Support Windows, macOS, Linux
|
|
36
|
+
|
|
37
|
+
### Example: Version Information
|
|
38
|
+
|
|
39
|
+
Electron EGG v4.x is the current stable version.
|
|
40
|
+
|
|
41
|
+
### Key Points
|
|
42
|
+
|
|
43
|
+
- Based on Electron and Egg.js
|
|
44
|
+
- Multi-process architecture
|
|
45
|
+
- Rich development tools
|
|
46
|
+
- Plugin system support
|
|
47
|
+
- Active development and maintenance
|