@zenuml/core 3.32.7 → 3.34.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/.kiro/hooks/README.md +38 -0
- package/.kiro/hooks/session-sound-notification.js +44 -0
- package/.kiro/hooks/session-sound-notification.json +23 -0
- package/DEPLOYMENT.md +62 -0
- package/README.md +1 -1
- package/TUTORIAL.md +116 -0
- package/dist/zenuml.esm.mjs +1679 -1671
- package/dist/zenuml.js +39 -39
- package/index.html +131 -42
- package/package.json +8 -3
- package/renderer.html +366 -0
- package/test-compression.html +274 -0
- package/test-url-params.html +192 -0
- package/vite.config.ts +1 -1
- package/wrangler.toml +12 -0
- package/docs/asciidoc/integration-guide.adoc +0 -121
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Kiro Agent Hooks
|
|
2
|
+
|
|
3
|
+
This directory contains custom hooks that automatically execute when specific events occur in Kiro.
|
|
4
|
+
|
|
5
|
+
## Session Sound Notification Hook
|
|
6
|
+
|
|
7
|
+
**File:** `session-sound-notification.json` and `session-sound-notification.js`
|
|
8
|
+
|
|
9
|
+
**Purpose:** Plays system sounds to notify you when:
|
|
10
|
+
|
|
11
|
+
- An AI session completes
|
|
12
|
+
- User input is required to continue
|
|
13
|
+
- An error occurs
|
|
14
|
+
|
|
15
|
+
**Sounds Used (macOS):**
|
|
16
|
+
|
|
17
|
+
- **Session Complete:** Glass.aiff - A pleasant chime when tasks finish
|
|
18
|
+
- **Input Required:** Sosumi.aiff - An attention-getting sound when you need to respond
|
|
19
|
+
- **Error:** Basso.aiff - A distinctive sound for errors
|
|
20
|
+
- **Default:** Ping.aiff - Fallback sound
|
|
21
|
+
|
|
22
|
+
**Configuration:**
|
|
23
|
+
The hook is enabled by default and will auto-execute. You can disable it by setting `"enabled": false` in the JSON configuration file.
|
|
24
|
+
|
|
25
|
+
**Platform Notes:**
|
|
26
|
+
|
|
27
|
+
- Currently optimized for macOS using the `afplay` command
|
|
28
|
+
- Uses built-in system sounds located in `/System/Library/Sounds/`
|
|
29
|
+
- For other platforms, the sound files and playback command would need to be adjusted
|
|
30
|
+
|
|
31
|
+
## Managing Hooks
|
|
32
|
+
|
|
33
|
+
You can:
|
|
34
|
+
|
|
35
|
+
1. View current hooks in the Kiro Explorer under "Agent Hooks"
|
|
36
|
+
2. Use Command Palette → "Open Kiro Hook UI" to create new hooks
|
|
37
|
+
3. Edit hook files directly in this directory
|
|
38
|
+
4. Enable/disable hooks by modifying the `enabled` property
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Sound Notification Hook
|
|
3
|
+
* Plays a sound when sessions end or user input is required
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const playSound = (soundType = 'default') => {
|
|
7
|
+
// For macOS, we can use the 'afplay' command to play system sounds
|
|
8
|
+
const sounds = {
|
|
9
|
+
default: '/System/Library/Sounds/Ping.aiff',
|
|
10
|
+
complete: '/System/Library/Sounds/Glass.aiff',
|
|
11
|
+
attention: '/System/Library/Sounds/Sosumi.aiff',
|
|
12
|
+
error: '/System/Library/Sounds/Basso.aiff'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const soundFile = sounds[soundType] || sounds.default;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
// Use afplay to play the sound on macOS
|
|
19
|
+
require('child_process').exec(`afplay "${soundFile}"`, (error) => {
|
|
20
|
+
if (error) {
|
|
21
|
+
console.log('Could not play sound:', error.message);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.log('Sound playback failed:', err.message);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
onSessionEnd: () => {
|
|
31
|
+
console.log('🔊 Session completed - playing completion sound');
|
|
32
|
+
playSound('complete');
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
onUserInputRequired: () => {
|
|
36
|
+
console.log('🔊 User input needed - playing attention sound');
|
|
37
|
+
playSound('attention');
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
onError: () => {
|
|
41
|
+
console.log('🔊 Error occurred - playing error sound');
|
|
42
|
+
playSound('error');
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Session Sound Notification",
|
|
3
|
+
"description": "Plays a sound when a session ends or user input is needed",
|
|
4
|
+
"triggers": [
|
|
5
|
+
{
|
|
6
|
+
"event": "session.end",
|
|
7
|
+
"description": "Triggered when an AI session completes"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"event": "user.input.required",
|
|
11
|
+
"description": "Triggered when the AI needs user input to continue"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"actions": [
|
|
15
|
+
{
|
|
16
|
+
"type": "system.sound",
|
|
17
|
+
"sound": "notification",
|
|
18
|
+
"description": "Play system notification sound"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"enabled": true,
|
|
22
|
+
"autoExecute": true
|
|
23
|
+
}
|
package/DEPLOYMENT.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# ZenUML Web Renderer Deployment
|
|
2
|
+
|
|
3
|
+
This document describes the deployment process for the ZenUML Web Renderer to Cloudflare Pages.
|
|
4
|
+
|
|
5
|
+
## Deployment Strategy
|
|
6
|
+
|
|
7
|
+
- **Production**: Deploys from `main` branch to `zenuml-web-renderer` project
|
|
8
|
+
- **Staging**: Deploys from any non-main branch to `zenuml-web-renderer-staging` project
|
|
9
|
+
|
|
10
|
+
## GitHub Actions Workflow
|
|
11
|
+
|
|
12
|
+
The deployment is automated through GitHub Actions (`.github/workflows/cloudflare-pages.yml`):
|
|
13
|
+
|
|
14
|
+
1. **Triggers**:
|
|
15
|
+
- Push to `main` or `feat/public-renderer` branches
|
|
16
|
+
- Pull requests to `main` branch
|
|
17
|
+
- Only when relevant files are changed (renderer.html, public/**, src/**, etc.)
|
|
18
|
+
|
|
19
|
+
2. **Build Process**:
|
|
20
|
+
- Install dependencies with pnpm
|
|
21
|
+
- Build the site using `pnpm build:site`
|
|
22
|
+
- Deploy to appropriate Cloudflare Pages project
|
|
23
|
+
|
|
24
|
+
## Required Secrets
|
|
25
|
+
|
|
26
|
+
Add these secrets to your GitHub repository settings:
|
|
27
|
+
|
|
28
|
+
- `CLOUDFLARE_API_TOKEN`: Cloudflare API token with Pages permissions
|
|
29
|
+
- `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID
|
|
30
|
+
|
|
31
|
+
## Manual Deployment
|
|
32
|
+
|
|
33
|
+
You can also deploy manually using wrangler:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Deploy to staging
|
|
37
|
+
pnpm pages:deploy:staging
|
|
38
|
+
|
|
39
|
+
# Deploy to production
|
|
40
|
+
pnpm pages:deploy
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Project Structure
|
|
44
|
+
|
|
45
|
+
- `renderer.html`: Main renderer page (root level)
|
|
46
|
+
- `public/renderer.html`: Copy of renderer page for static hosting
|
|
47
|
+
- `dist/`: Build output directory (created by `pnpm build:site`)
|
|
48
|
+
- `wrangler.toml`: Cloudflare configuration
|
|
49
|
+
|
|
50
|
+
## URLs
|
|
51
|
+
|
|
52
|
+
- **Production**: `https://zenuml-web-renderer.pages.dev`
|
|
53
|
+
- **Staging**: `https://zenuml-web-renderer-staging.pages.dev`
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
Once deployed, you can use the renderer by visiting:
|
|
58
|
+
- `https://your-domain.pages.dev/renderer.html`
|
|
59
|
+
- `https://your-domain.pages.dev/` (if configured as index)
|
|
60
|
+
|
|
61
|
+
Future URL parameter support will allow:
|
|
62
|
+
- `https://your-domain.pages.dev/renderer.html?code=<base64-encoded-zenuml>`
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ You can use it ZenUML on your favorite platforms and applications:
|
|
|
19
19
|
# Integrations
|
|
20
20
|
|
|
21
21
|
ZenUML can be integrated with your favorite tools and platforms as a library or an embeddable widget.
|
|
22
|
-
Please follow the [integration
|
|
22
|
+
Please follow the [integration tutorial](./TUTORIAL.md) for detailed steps.
|
|
23
23
|
|
|
24
24
|
# Development
|
|
25
25
|
|
package/TUTORIAL.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
|
|
2
|
+
# ZenUML Integration Tutorial
|
|
3
|
+
|
|
4
|
+
This tutorial provides a comprehensive guide on how to integrate ZenUML into your applications. There are two primary methods for integration: as a library or as an embedded iframe.
|
|
5
|
+
|
|
6
|
+
## 1. As a Library
|
|
7
|
+
|
|
8
|
+
This is the most flexible method, allowing for deep integration with your application.
|
|
9
|
+
|
|
10
|
+
### Installation
|
|
11
|
+
|
|
12
|
+
First, add the `@zenuml/core` package to your project:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @zenuml/core
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add @zenuml/core
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Usage
|
|
25
|
+
|
|
26
|
+
The main entry point of the library is the `ZenUml` class. Here's a basic example of how to use it:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import ZenUml from '@zenuml/core';
|
|
30
|
+
|
|
31
|
+
// 1. Get the container element
|
|
32
|
+
const el = document.getElementById('zenuml-container');
|
|
33
|
+
|
|
34
|
+
// 2. Create a new instance of ZenUml
|
|
35
|
+
const zenUml = new ZenUml(el);
|
|
36
|
+
|
|
37
|
+
// 3. Render a diagram
|
|
38
|
+
const code = 'A->B: message';
|
|
39
|
+
const config = {
|
|
40
|
+
theme: 'default',
|
|
41
|
+
};
|
|
42
|
+
zenUml.render(code, config);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Configuration
|
|
46
|
+
|
|
47
|
+
The `render` method accepts a configuration object with the following properties:
|
|
48
|
+
|
|
49
|
+
- `theme`: The name of the theme to use. A list of available themes can be found in the documentation.
|
|
50
|
+
- `enableScopedTheming`: A boolean that indicates whether to scope the theme to the container element. This is useful when you have multiple diagrams on the same page with different themes.
|
|
51
|
+
- `onThemeChange`: A callback function that is called when the theme is changed.
|
|
52
|
+
- `enableMultiTheme`: A boolean that indicates whether to enable multi-theme support.
|
|
53
|
+
- `stickyOffset`: A number that indicates the offset for the sticky header.
|
|
54
|
+
- `onContentChange`: A callback function that is called when the content of the diagram is changed.
|
|
55
|
+
- `onEventEmit`: A callback function that is called when an event is emitted from the diagram.
|
|
56
|
+
- `mode`: The rendering mode. Can be `RenderMode.Dynamic` or `RenderMode.Static`.
|
|
57
|
+
|
|
58
|
+
### Example
|
|
59
|
+
|
|
60
|
+
Here's a more advanced example that uses some of the configuration options:
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
import ZenUml from '@zenuml/core';
|
|
64
|
+
|
|
65
|
+
const el = document.getElementById('zenuml-container');
|
|
66
|
+
const zenUml = new ZenUml(el);
|
|
67
|
+
|
|
68
|
+
const code = `
|
|
69
|
+
// This is a comment
|
|
70
|
+
A->B: synchronous message
|
|
71
|
+
B-->A: asynchronous message
|
|
72
|
+
`;
|
|
73
|
+
|
|
74
|
+
const config = {
|
|
75
|
+
theme: 'blue',
|
|
76
|
+
enableScopedTheming: true,
|
|
77
|
+
onContentChange: (newCode) => {
|
|
78
|
+
console.log('Diagram code changed:', newCode);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
zenUml.render(code, config);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Exporting Diagrams
|
|
86
|
+
|
|
87
|
+
You can export diagrams to PNG and SVG formats. The `ZenUml` class provides the following methods for exporting:
|
|
88
|
+
|
|
89
|
+
- `getPng()`: Returns a promise that resolves to a PNG data URL.
|
|
90
|
+
- `getSvg()`: Returns a promise that resolves to an SVG data URL.
|
|
91
|
+
|
|
92
|
+
Here's an example of how to use these methods:
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
import ZenUml from '@zenuml/core';
|
|
96
|
+
|
|
97
|
+
const el = document.getElementById('zenuml-container');
|
|
98
|
+
const zenUml = new ZenUml(el);
|
|
99
|
+
|
|
100
|
+
const code = 'A->B: message';
|
|
101
|
+
|
|
102
|
+
async function exportDiagram() {
|
|
103
|
+
await zenUml.render(code, { theme: 'default' });
|
|
104
|
+
const png = await zenUml.getPng();
|
|
105
|
+
// Do something with the PNG data URL
|
|
106
|
+
console.log(png);
|
|
107
|
+
|
|
108
|
+
const svg = await zenUml.getSvg();
|
|
109
|
+
// Do something with the SVG data URL
|
|
110
|
+
console.log(svg);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exportDiagram();
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This tutorial should provide you with a solid foundation for integrating ZenUML into your applications. For more detailed information, please refer to the official documentation.
|