@bpmnkit/plugins 0.0.8

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.
Files changed (140) hide show
  1. package/README.md +153 -0
  2. package/dist/ai-bridge/css.d.ts +2 -0
  3. package/dist/ai-bridge/css.js +366 -0
  4. package/dist/ai-bridge/index.d.ts +44 -0
  5. package/dist/ai-bridge/index.js +132 -0
  6. package/dist/ai-bridge/panel.d.ts +27 -0
  7. package/dist/ai-bridge/panel.js +715 -0
  8. package/dist/ascii-view/css.d.ts +4 -0
  9. package/dist/ascii-view/css.js +83 -0
  10. package/dist/ascii-view/index.d.ts +25 -0
  11. package/dist/ascii-view/index.js +92 -0
  12. package/dist/command-palette/css.d.ts +4 -0
  13. package/dist/command-palette/css.js +157 -0
  14. package/dist/command-palette/index.d.ts +53 -0
  15. package/dist/command-palette/index.js +378 -0
  16. package/dist/command-palette-editor/index.d.ts +35 -0
  17. package/dist/command-palette-editor/index.js +60 -0
  18. package/dist/config-panel/css.d.ts +4 -0
  19. package/dist/config-panel/css.js +719 -0
  20. package/dist/config-panel/index.d.ts +36 -0
  21. package/dist/config-panel/index.js +73 -0
  22. package/dist/config-panel/renderer.d.ts +127 -0
  23. package/dist/config-panel/renderer.js +1162 -0
  24. package/dist/config-panel/types.d.ts +118 -0
  25. package/dist/config-panel/types.js +2 -0
  26. package/dist/config-panel-bpmn/index.d.ts +58 -0
  27. package/dist/config-panel-bpmn/index.js +1320 -0
  28. package/dist/config-panel-bpmn/template-engine.d.ts +17 -0
  29. package/dist/config-panel-bpmn/template-engine.js +307 -0
  30. package/dist/config-panel-bpmn/template-to-service-task.d.ts +30 -0
  31. package/dist/config-panel-bpmn/template-to-service-task.js +92 -0
  32. package/dist/config-panel-bpmn/template-types.d.ts +126 -0
  33. package/dist/config-panel-bpmn/template-types.js +6 -0
  34. package/dist/config-panel-bpmn/templates/generated.d.ts +3 -0
  35. package/dist/config-panel-bpmn/templates/generated.js +57865 -0
  36. package/dist/config-panel-bpmn/util.d.ts +46 -0
  37. package/dist/config-panel-bpmn/util.js +195 -0
  38. package/dist/dmn-editor/css.d.ts +3 -0
  39. package/dist/dmn-editor/css.js +667 -0
  40. package/dist/dmn-editor/dmn-editor.d.ts +34 -0
  41. package/dist/dmn-editor/dmn-editor.js +646 -0
  42. package/dist/dmn-editor/drd-canvas.d.ts +85 -0
  43. package/dist/dmn-editor/drd-canvas.js +1087 -0
  44. package/dist/dmn-editor/index.d.ts +3 -0
  45. package/dist/dmn-editor/index.js +2 -0
  46. package/dist/dmn-viewer/css.d.ts +3 -0
  47. package/dist/dmn-viewer/css.js +151 -0
  48. package/dist/dmn-viewer/dmn-viewer.d.ts +30 -0
  49. package/dist/dmn-viewer/dmn-viewer.js +160 -0
  50. package/dist/dmn-viewer/feel.d.ts +3 -0
  51. package/dist/dmn-viewer/feel.js +2 -0
  52. package/dist/dmn-viewer/index.d.ts +14 -0
  53. package/dist/dmn-viewer/index.js +12 -0
  54. package/dist/element-docs/content.d.ts +20 -0
  55. package/dist/element-docs/content.js +1032 -0
  56. package/dist/element-docs/index.d.ts +7 -0
  57. package/dist/element-docs/index.js +643 -0
  58. package/dist/feel-playground/css.d.ts +4 -0
  59. package/dist/feel-playground/css.js +292 -0
  60. package/dist/feel-playground/index.d.ts +4 -0
  61. package/dist/feel-playground/index.js +3 -0
  62. package/dist/feel-playground/playground-plugin.d.ts +14 -0
  63. package/dist/feel-playground/playground-plugin.js +292 -0
  64. package/dist/form-editor/css.d.ts +3 -0
  65. package/dist/form-editor/css.js +703 -0
  66. package/dist/form-editor/form-editor.d.ts +48 -0
  67. package/dist/form-editor/form-editor.js +1039 -0
  68. package/dist/form-editor/index.d.ts +3 -0
  69. package/dist/form-editor/index.js +2 -0
  70. package/dist/form-viewer/css.d.ts +3 -0
  71. package/dist/form-viewer/css.js +303 -0
  72. package/dist/form-viewer/form-viewer.d.ts +29 -0
  73. package/dist/form-viewer/form-viewer.js +376 -0
  74. package/dist/form-viewer/index.d.ts +12 -0
  75. package/dist/form-viewer/index.js +11 -0
  76. package/dist/history/checkpoint.d.ts +10 -0
  77. package/dist/history/checkpoint.js +92 -0
  78. package/dist/history/css.d.ts +2 -0
  79. package/dist/history/css.js +130 -0
  80. package/dist/history/history-panel.d.ts +12 -0
  81. package/dist/history/history-panel.js +142 -0
  82. package/dist/history/index.d.ts +5 -0
  83. package/dist/history/index.js +3 -0
  84. package/dist/main-menu/css.d.ts +4 -0
  85. package/dist/main-menu/css.js +272 -0
  86. package/dist/main-menu/index.d.ts +59 -0
  87. package/dist/main-menu/index.js +285 -0
  88. package/dist/minimap/css.d.ts +10 -0
  89. package/dist/minimap/css.js +54 -0
  90. package/dist/minimap/index.d.ts +38 -0
  91. package/dist/minimap/index.js +69 -0
  92. package/dist/minimap/minimap.d.ts +35 -0
  93. package/dist/minimap/minimap.js +166 -0
  94. package/dist/optimize/index.d.ts +21 -0
  95. package/dist/optimize/index.js +304 -0
  96. package/dist/process-runner/css.d.ts +2 -0
  97. package/dist/process-runner/css.js +467 -0
  98. package/dist/process-runner/index.d.ts +56 -0
  99. package/dist/process-runner/index.js +549 -0
  100. package/dist/storage/auto-save.d.ts +11 -0
  101. package/dist/storage/auto-save.js +44 -0
  102. package/dist/storage/css.d.ts +2 -0
  103. package/dist/storage/css.js +2 -0
  104. package/dist/storage/db.d.ts +99 -0
  105. package/dist/storage/db.js +116 -0
  106. package/dist/storage/dialog.d.ts +15 -0
  107. package/dist/storage/dialog.js +201 -0
  108. package/dist/storage/export.d.ts +3 -0
  109. package/dist/storage/export.js +137 -0
  110. package/dist/storage/index.d.ts +44 -0
  111. package/dist/storage/index.js +201 -0
  112. package/dist/storage/sidebar.d.ts +2 -0
  113. package/dist/storage/sidebar.js +2 -0
  114. package/dist/storage/storage-api.d.ts +76 -0
  115. package/dist/storage/storage-api.js +342 -0
  116. package/dist/storage/types.d.ts +44 -0
  117. package/dist/storage/types.js +2 -0
  118. package/dist/storage-tabs-bridge/index.d.ts +96 -0
  119. package/dist/storage-tabs-bridge/index.js +502 -0
  120. package/dist/tabs/css.d.ts +3 -0
  121. package/dist/tabs/css.js +642 -0
  122. package/dist/tabs/file-resolver.d.ts +71 -0
  123. package/dist/tabs/file-resolver.js +46 -0
  124. package/dist/tabs/index.d.ts +15 -0
  125. package/dist/tabs/index.js +13 -0
  126. package/dist/tabs/tabs-plugin.d.ts +250 -0
  127. package/dist/tabs/tabs-plugin.js +1119 -0
  128. package/dist/token-highlight/css.d.ts +2 -0
  129. package/dist/token-highlight/css.js +81 -0
  130. package/dist/token-highlight/index.d.ts +44 -0
  131. package/dist/token-highlight/index.js +164 -0
  132. package/dist/watermark/css.d.ts +10 -0
  133. package/dist/watermark/css.js +54 -0
  134. package/dist/watermark/index.d.ts +48 -0
  135. package/dist/watermark/index.js +64 -0
  136. package/dist/zoom-controls/css.d.ts +4 -0
  137. package/dist/zoom-controls/css.js +48 -0
  138. package/dist/zoom-controls/index.d.ts +36 -0
  139. package/dist/zoom-controls/index.js +111 -0
  140. package/package.json +121 -0
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/bpmn-sdk/monorepo/main/doc/logos/logo-2-gateway.svg" width="72" height="72" alt="BPMN Kit logo">
3
+ <h1>@bpmnkit/plugins</h1>
4
+ <p>22 composable canvas plugins — minimap, AI chat, process simulation, storage, and more</p>
5
+
6
+ [![npm](https://img.shields.io/npm/v/@bpmnkit/plugins?style=flat-square&color=6244d7)](https://www.npmjs.com/package/@bpmnkit/plugins)
7
+ [![license](https://img.shields.io/npm/l/@bpmnkit/plugins?style=flat-square)](https://github.com/bpmnkit/monorepo/blob/main/LICENSE)
8
+ [![typescript](https://img.shields.io/badge/TypeScript-strict-6244d7?style=flat-square&logo=typescript&logoColor=white)](https://github.com/bpmnkit/monorepo)
9
+
10
+ [Documentation](https://bpmn-sdk-docs.pages.dev) · [GitHub](https://github.com/bpmnkit/monorepo) · [Changelog](https://github.com/bpmnkit/monorepo/blob/main/packages/plugins/CHANGELOG.md)
11
+ </div>
12
+
13
+ ---
14
+
15
+ ## Overview
16
+
17
+ `@bpmnkit/plugins` is a single package containing 22 ready-made `CanvasPlugin` add-ons for `@bpmnkit/canvas` and `@bpmnkit/editor`. Each plugin is imported individually via subpath exports so you only bundle what you use.
18
+
19
+ ## Installation
20
+
21
+ ```sh
22
+ npm install @bpmnkit/plugins
23
+ ```
24
+
25
+ ## Plugins
26
+
27
+ ### Visualization
28
+
29
+ | Subpath | Factory | Description |
30
+ |---------|---------|-------------|
31
+ | `/minimap` | `createMinimapPlugin()` | Thumbnail navigation minimap |
32
+ | `/watermark` | `createWatermarkPlugin(text)` | Corner watermark overlay |
33
+ | `/ascii-view` | `createAsciiViewPlugin()` | Toggle ASCII art rendering |
34
+ | `/zoom-controls` | `createZoomControlsPlugin()` | On-canvas +/− zoom buttons |
35
+
36
+ ### File Management
37
+
38
+ | Subpath | Factory | Description |
39
+ |---------|---------|-------------|
40
+ | `/tabs` | `createTabsPlugin(options)` | Multi-file tab bar with welcome screen |
41
+ | `/storage` | `createStoragePlugin(options)` | IndexedDB workspaces/projects/files with auto-save |
42
+ | `/storage-tabs-bridge` | `createStorageTabsBridge(options)` | Wire tabs + storage + main menu together |
43
+
44
+ ### Editing
45
+
46
+ | Subpath | Factory | Description |
47
+ |---------|---------|-------------|
48
+ | `/command-palette` | `createCommandPalettePlugin()` | ⌘K command palette |
49
+ | `/command-palette-editor` | `createCommandPaletteEditorPlugin()` | Editor-specific commands |
50
+ | `/history` | `createHistoryPlugin()` | Visual undo/redo history panel |
51
+ | `/config-panel` | `createConfigPanelPlugin(options)` | Properties panel for selected elements |
52
+ | `/config-panel-bpmn` | `createConfigPanelBpmnPlugin(options)` | BPMN-specific properties panel |
53
+
54
+ ### DMN & Forms
55
+
56
+ | Subpath | Factory | Description |
57
+ |---------|---------|-------------|
58
+ | `/dmn-editor` | — | Embedded DMN decision table editor |
59
+ | `/dmn-viewer` | — | Read-only DMN viewer |
60
+ | `/form-editor` | — | Camunda Form schema editor |
61
+ | `/form-viewer` | — | Read-only form renderer |
62
+ | `/feel-playground` | — | Interactive FEEL expression tester |
63
+
64
+ ### Process Simulation
65
+
66
+ | Subpath | Factory | Description |
67
+ |---------|---------|-------------|
68
+ | `/process-runner` | `createProcessRunnerPlugin(options)` | Run BPMN instances with play/step/stop UI |
69
+ | `/token-highlight` | `createTokenHighlightPlugin()` | Highlight active/visited elements during execution |
70
+ | `/optimize` | `createOptimizePlugin()` | Show optimizer findings overlay |
71
+
72
+ ### AI & Navigation
73
+
74
+ | Subpath | Factory | Description |
75
+ |---------|---------|-------------|
76
+ | `/ai-bridge` | `createAiBridgePlugin(options)` | AI chat panel with diagram apply/checkpoint |
77
+ | `/element-docs` | `createElementDocsPlugin(options)` | Built-in BPMN element reference docs |
78
+ | `/main-menu` | `createMainMenuPlugin(options)` | File/Edit top-level menu |
79
+
80
+ ## Usage Examples
81
+
82
+ ### Minimap
83
+
84
+ ```typescript
85
+ import { BpmnCanvas } from "@bpmnkit/canvas"
86
+ import { createMinimapPlugin } from "@bpmnkit/plugins/minimap"
87
+
88
+ const canvas = new BpmnCanvas({
89
+ container: document.getElementById("canvas")!,
90
+ plugins: [createMinimapPlugin()],
91
+ })
92
+ ```
93
+
94
+ ### Storage + Tabs
95
+
96
+ ```typescript
97
+ import { createStoragePlugin } from "@bpmnkit/plugins/storage"
98
+ import { createTabsPlugin } from "@bpmnkit/plugins/tabs"
99
+ import { createStorageTabsBridge } from "@bpmnkit/plugins/storage-tabs-bridge"
100
+
101
+ const storage = createStoragePlugin({ editor })
102
+ const tabs = createTabsPlugin({ editor })
103
+ const bridge = createStorageTabsBridge({ storage, tabs, mainMenu })
104
+ ```
105
+
106
+ ### Process Simulation
107
+
108
+ ```typescript
109
+ import { Engine } from "@bpmnkit/engine"
110
+ import { createTokenHighlightPlugin } from "@bpmnkit/plugins/token-highlight"
111
+ import { createProcessRunnerPlugin } from "@bpmnkit/plugins/process-runner"
112
+
113
+ const engine = new Engine()
114
+ const tokenHighlight = createTokenHighlightPlugin()
115
+ const processRunner = createProcessRunnerPlugin({ engine, tokenHighlight })
116
+
117
+ const canvas = new BpmnCanvas({
118
+ container,
119
+ plugins: [tokenHighlight, processRunner],
120
+ })
121
+ ```
122
+
123
+ ### AI Chat Panel
124
+
125
+ ```typescript
126
+ import { createAiBridgePlugin } from "@bpmnkit/plugins/ai-bridge"
127
+
128
+ const ai = createAiBridgePlugin({
129
+ serverUrl: "http://localhost:3033",
130
+ container: dock.aiPane,
131
+ onOpen: () => dock.expand(),
132
+ })
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Related Packages
138
+
139
+ | Package | Description |
140
+ |---------|-------------|
141
+ | [`@bpmnkit/core`](https://www.npmjs.com/package/@bpmnkit/core) | BPMN/DMN/Form parser, builder, layout engine |
142
+ | [`@bpmnkit/canvas`](https://www.npmjs.com/package/@bpmnkit/canvas) | Zero-dependency SVG BPMN viewer |
143
+ | [`@bpmnkit/editor`](https://www.npmjs.com/package/@bpmnkit/editor) | Full-featured interactive BPMN editor |
144
+ | [`@bpmnkit/engine`](https://www.npmjs.com/package/@bpmnkit/engine) | Lightweight BPMN process execution engine |
145
+ | [`@bpmnkit/feel`](https://www.npmjs.com/package/@bpmnkit/feel) | FEEL expression language parser & evaluator |
146
+ | [`@bpmnkit/api`](https://www.npmjs.com/package/@bpmnkit/api) | Camunda 8 REST API TypeScript client |
147
+ | [`@bpmnkit/ascii`](https://www.npmjs.com/package/@bpmnkit/ascii) | Render BPMN diagrams as Unicode ASCII art |
148
+ | [`@bpmnkit/profiles`](https://www.npmjs.com/package/@bpmnkit/profiles) | Shared auth, profile storage, and client factories for CLI & proxy |
149
+ | [`@bpmnkit/operate`](https://www.npmjs.com/package/@bpmnkit/operate) | Monitoring & operations frontend for Camunda clusters |
150
+
151
+ ## License
152
+
153
+ [MIT](https://github.com/bpmnkit/monorepo/blob/main/LICENSE) © bpmn-sdk
@@ -0,0 +1,2 @@
1
+ export declare function injectAiBridgeStyles(): void;
2
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1,366 @@
1
+ const STYLE_ID = "ai-bridge-styles";
2
+ export function injectAiBridgeStyles() {
3
+ const existing = document.getElementById(STYLE_ID);
4
+ const style = existing instanceof HTMLStyleElement ? existing : document.createElement("style");
5
+ if (!existing) {
6
+ style.id = STYLE_ID;
7
+ document.head.appendChild(style);
8
+ }
9
+ style.textContent = `
10
+ .ai-panel {
11
+ position: fixed; top: 0; right: 0; bottom: 0;
12
+ width: 360px; z-index: 150;
13
+ display: flex; flex-direction: column;
14
+ background: var(--bpmnkit-panel-bg, rgba(13,13,22,0.92));
15
+ border-left: 1px solid var(--bpmnkit-panel-border, rgba(255,255,255,0.08));
16
+ color: rgba(255,255,255,0.85);
17
+ font-family: system-ui, -apple-system, sans-serif;
18
+ font-size: 13px;
19
+ transform: translateX(100%);
20
+ transition: transform 0.2s ease;
21
+ box-shadow: -8px 0 32px rgba(0,0,0,0.4);
22
+ }
23
+ .ai-panel.ai-panel-open { transform: translateX(0); }
24
+ .ai-panel-header {
25
+ display: flex; align-items: center; justify-content: space-between;
26
+ padding: 10px 14px;
27
+ border-bottom: 1px solid rgba(255,255,255,0.08);
28
+ flex-shrink: 0;
29
+ }
30
+ .ai-panel-title { font-weight: 600; font-size: 14px; color: rgba(255,255,255,0.92); }
31
+ .ai-panel-header-actions { display: flex; gap: 4px; align-items: center; }
32
+ .ai-panel-status {
33
+ padding: 6px 14px;
34
+ font-size: 11.5px;
35
+ border-bottom: 1px solid rgba(255,255,255,0.05);
36
+ flex-shrink: 0;
37
+ }
38
+ .ai-panel-status-ok { color: rgba(120,220,120,0.8); }
39
+ .ai-panel-status-err { color: rgba(220,100,80,0.9); }
40
+ .ai-panel-status-err code {
41
+ display: block; margin-top: 4px;
42
+ background: rgba(255,255,255,0.05); border-radius: 4px;
43
+ padding: 4px 8px; font-size: 11px; color: rgba(255,255,255,0.9);
44
+ user-select: all;
45
+ }
46
+ /* ── Messages ── */
47
+ .ai-messages {
48
+ flex: 1; overflow-y: auto; padding: 10px;
49
+ display: flex; flex-direction: column; gap: 8px;
50
+ }
51
+ .ai-msg {
52
+ border-radius: 8px; padding: 8px 12px;
53
+ line-height: 1.5; word-break: break-word;
54
+ }
55
+ .ai-msg-user {
56
+ background: rgba(60,120,220,0.25);
57
+ border: 1px solid rgba(60,120,220,0.35);
58
+ align-self: flex-end; max-width: 85%;
59
+ white-space: pre-wrap;
60
+ }
61
+ .ai-msg-ai {
62
+ background: rgba(255,255,255,0.05);
63
+ border: 1px solid rgba(255,255,255,0.08);
64
+ align-self: flex-start; max-width: 95%;
65
+ }
66
+ .ai-msg-cursor::after {
67
+ content: "▊"; animation: ai-blink 0.8s step-end infinite;
68
+ }
69
+ @keyframes ai-blink { 50% { opacity: 0; } }
70
+ /* ── Markdown elements ── */
71
+ .ai-md-h { font-size: 13.5px; font-weight: 600; margin: 6px 0 2px; }
72
+ .ai-md-h:first-child { margin-top: 0; }
73
+ .ai-md-p { margin: 0; }
74
+ .ai-md-p + .ai-md-p { margin-top: 5px; }
75
+ .ai-md-list { margin: 4px 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }
76
+ .ai-md-code {
77
+ background: rgba(0,0,0,0.28); border-radius: 3px;
78
+ padding: 1px 5px; font-family: monospace; font-size: 11.5px;
79
+ }
80
+ /* ── Diagram preview ── */
81
+ .ai-msg-preview {
82
+ position: relative; height: 200px; margin: 8px 0;
83
+ border-radius: 6px; overflow: hidden;
84
+ border: 1px solid var(--bpmnkit-panel-border, rgba(255,255,255,0.08));
85
+ }
86
+ .ai-msg-preview .bpmnkit-canvas { width: 100%; height: 100%; }
87
+ /* ── Message action row (copy + apply) ── */
88
+ .ai-msg-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
89
+ .ai-msg-copy {
90
+ padding: 3px 10px; border-radius: 5px;
91
+ background: none; border: 1px solid var(--bpmnkit-panel-border, rgba(255,255,255,0.08));
92
+ color: rgba(255,255,255,0.35); font-size: 11px; cursor: pointer;
93
+ font-family: inherit;
94
+ transition: color 0.15s, border-color 0.15s;
95
+ }
96
+ .ai-msg-copy:hover { color: rgba(255,255,255,0.75); border-color: rgba(255,255,255,0.2); }
97
+ .ai-msg-apply {
98
+ padding: 3px 12px;
99
+ background: rgba(60,180,100,0.25); border: 1px solid rgba(60,180,100,0.4);
100
+ border-radius: 5px; color: rgba(120,230,140,0.9);
101
+ font-size: 11px; cursor: pointer; font-weight: 500; font-family: inherit;
102
+ }
103
+ .ai-msg-apply:hover { background: rgba(60,180,100,0.38); }
104
+ .ai-msg-approve {
105
+ padding: 3px 12px;
106
+ background: rgba(200,150,30,0.25); border: 1px solid rgba(200,150,30,0.4);
107
+ border-radius: 5px; color: rgba(255,210,80,0.9);
108
+ font-size: 11px; cursor: pointer; font-weight: 500; font-family: inherit;
109
+ }
110
+ .ai-msg-approve:hover { background: rgba(200,150,30,0.38); }
111
+ .ai-msg-approve:disabled { opacity: 0.4; cursor: default; }
112
+ .ai-msg-code {
113
+ background: rgba(0,0,0,0.3); border-radius: 5px;
114
+ padding: 8px; margin: 6px 0;
115
+ font-family: monospace; font-size: 11.5px;
116
+ color: rgba(255,255,255,0.65);
117
+ overflow-x: auto; white-space: pre;
118
+ }
119
+ /* ── Welcome / empty state ── */
120
+ .ai-welcome {
121
+ flex: 1; display: flex; flex-direction: column;
122
+ align-items: center; justify-content: center;
123
+ padding: 16px; gap: 10px; text-align: center;
124
+ }
125
+ .ai-welcome-title {
126
+ font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.85);
127
+ }
128
+ .ai-welcome-sub {
129
+ font-size: 12px; color: rgba(255,255,255,0.38); margin-bottom: 6px;
130
+ }
131
+ .ai-welcome-examples { display: flex; flex-direction: column; gap: 6px; width: 100%; }
132
+ .ai-welcome-example {
133
+ padding: 8px 12px; border-radius: 8px; text-align: left;
134
+ background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.09);
135
+ color: rgba(255,255,255,0.6); font-size: 12px; cursor: pointer;
136
+ font-family: inherit; transition: background 0.15s, color 0.15s;
137
+ }
138
+ .ai-welcome-example:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.88); }
139
+ /* ── Quick actions ── */
140
+ .ai-quick-actions {
141
+ padding: 6px 10px;
142
+ display: flex; gap: 6px; flex-wrap: wrap;
143
+ border-top: 1px solid rgba(255,255,255,0.06);
144
+ flex-shrink: 0;
145
+ }
146
+ .ai-quick-btn {
147
+ padding: 4px 10px; border-radius: 14px;
148
+ background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
149
+ color: rgba(255,255,255,0.65); font-size: 12px; cursor: pointer;
150
+ font-family: inherit; white-space: nowrap;
151
+ max-width: 180px; overflow: hidden; text-overflow: ellipsis;
152
+ transition: background 0.15s, color 0.15s;
153
+ }
154
+ .ai-quick-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9); }
155
+ .ai-quick-btn:disabled { opacity: 0.3; cursor: default; }
156
+ /* ── Context badge strip ── */
157
+ .ai-context-refs {
158
+ padding: 6px 10px 4px;
159
+ display: flex; gap: 6px; flex-wrap: wrap;
160
+ border-top: 1px solid rgba(255,255,255,0.06);
161
+ flex-shrink: 0;
162
+ }
163
+ .ai-context-badge {
164
+ display: inline-flex; align-items: center; gap: 3px;
165
+ padding: 2px 4px 2px 8px;
166
+ background: rgba(60,120,220,0.15); border: 1px solid rgba(60,120,220,0.3);
167
+ border-radius: 4px; font-size: 11.5px;
168
+ color: rgba(160,190,255,0.9); max-width: 240px;
169
+ cursor: pointer; user-select: none;
170
+ }
171
+ .ai-context-badge__label {
172
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
173
+ font-style: italic; cursor: pointer;
174
+ }
175
+ .ai-context-badge--pinned .ai-context-badge__label { font-style: normal; }
176
+ .ai-context-badge__remove {
177
+ background: none; border: none; padding: 0 2px;
178
+ color: rgba(160,190,255,0.55); cursor: pointer;
179
+ font-size: 15px; line-height: 1; flex-shrink: 0;
180
+ }
181
+ .ai-context-badge__remove:hover { color: rgba(255,255,255,0.9); }
182
+ .ai-msg-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
183
+ .ai-msg-context-chip {
184
+ display: inline-block;
185
+ font-size: 11px; padding: 1px 6px;
186
+ background: rgba(60,120,220,0.2); border: 1px solid rgba(60,120,220,0.3);
187
+ border-radius: 3px; color: rgba(160,190,255,0.85);
188
+ }
189
+ /* ── Input area ── */
190
+ .ai-input-area {
191
+ padding: 10px 10px 6px; border-top: 1px solid rgba(255,255,255,0.08);
192
+ display: flex; gap: 8px; align-items: flex-end;
193
+ flex-shrink: 0;
194
+ }
195
+ .ai-textarea {
196
+ flex: 1; min-height: 36px; max-height: 200px;
197
+ background: rgba(255,255,255,0.05);
198
+ border: 1px solid rgba(255,255,255,0.12);
199
+ border-radius: 6px; color: rgba(255,255,255,0.85);
200
+ font-size: 13px; font-family: inherit;
201
+ padding: 7px 10px; resize: none; overflow-y: auto;
202
+ outline: none; line-height: 1.45;
203
+ }
204
+ .ai-textarea:focus { border-color: rgba(60,120,220,0.5); }
205
+ .ai-textarea::placeholder { color: rgba(255,255,255,0.3); }
206
+ .ai-send-btn {
207
+ padding: 7px 14px; border-radius: 6px;
208
+ background: rgba(60,120,220,0.5); border: 1px solid rgba(60,120,220,0.7);
209
+ color: #fff; font-size: 13px; font-weight: 500;
210
+ cursor: pointer; flex-shrink: 0; height: 36px;
211
+ }
212
+ .ai-send-btn:hover:not(:disabled) { background: rgba(60,120,220,0.65); }
213
+ .ai-send-btn:disabled { opacity: 0.4; cursor: default; }
214
+ .ai-stop-btn {
215
+ padding: 7px 14px; border-radius: 6px;
216
+ background: rgba(200,60,60,0.45); border: 1px solid rgba(200,60,60,0.65);
217
+ color: #fff; font-size: 13px; font-weight: 500;
218
+ cursor: pointer; flex-shrink: 0; height: 36px;
219
+ }
220
+ .ai-stop-btn:hover { background: rgba(200,60,60,0.65); }
221
+ .ai-input-hint {
222
+ padding: 0 10px 8px;
223
+ font-size: 10.5px; color: rgba(255,255,255,0.2);
224
+ flex-shrink: 0;
225
+ }
226
+ /* ── Header buttons ── */
227
+ .ai-hdr-btn {
228
+ padding: 3px 8px; border-radius: 5px;
229
+ background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
230
+ color: rgba(255,255,255,0.6); font-size: 12px; cursor: pointer;
231
+ display: flex; align-items: center; gap: 3px;
232
+ }
233
+ .ai-hdr-btn:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9); }
234
+ .ai-hdr-btn svg { width: 13px; height: 13px; }
235
+ .ai-backend-select {
236
+ padding: 3px 6px; border-radius: 5px;
237
+ background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
238
+ color: rgba(255,255,255,0.6); font-size: 12px; cursor: pointer;
239
+ font-family: inherit; outline: none;
240
+ }
241
+ .ai-backend-select:hover { background: rgba(255,255,255,0.1); }
242
+ /* ── Docked mode ── */
243
+ .ai-panel--docked {
244
+ position: static !important;
245
+ transform: none !important;
246
+ width: auto !important;
247
+ right: auto; top: auto; bottom: auto;
248
+ flex: 1; min-height: 0;
249
+ box-shadow: none; border-left: none;
250
+ }
251
+ .ai-panel--docked, .ai-panel--docked.ai-panel-open { display: flex; }
252
+ .ai-panel--docked .ai-hdr-btn[title="Close"] { display: none; }
253
+
254
+ /* ── Light theme ── */
255
+ [data-bpmnkit-hud-theme="light"] .ai-panel {
256
+ background: rgba(252,252,254,0.98);
257
+ border-left-color: var(--bpmnkit-panel-border, rgba(0,0,0,0.08));
258
+ color: rgba(0,0,0,0.8);
259
+ box-shadow: -4px 0 20px rgba(0,0,0,0.12);
260
+ }
261
+ [data-bpmnkit-hud-theme="light"] .ai-panel-header { border-bottom-color: var(--bpmnkit-panel-border, rgba(0,0,0,0.08)); }
262
+ [data-bpmnkit-hud-theme="light"] .ai-panel-title { color: rgba(0,0,0,0.88); }
263
+ [data-bpmnkit-hud-theme="light"] .ai-panel-status { border-bottom-color: rgba(0,0,0,0.06); }
264
+ [data-bpmnkit-hud-theme="light"] .ai-panel-status-err { color: rgba(180,40,20,0.9); }
265
+ [data-bpmnkit-hud-theme="light"] .ai-panel-status-err code {
266
+ background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.8);
267
+ }
268
+ [data-bpmnkit-hud-theme="light"] .ai-msg-user {
269
+ background: rgba(0,80,200,0.1); border-color: rgba(0,80,200,0.2);
270
+ }
271
+ [data-bpmnkit-hud-theme="light"] .ai-msg-ai {
272
+ background: rgba(0,0,0,0.03); border-color: var(--bpmnkit-panel-border, rgba(0,0,0,0.08));
273
+ }
274
+ [data-bpmnkit-hud-theme="light"] .ai-md-code { background: rgba(0,0,0,0.06); }
275
+ [data-bpmnkit-hud-theme="light"] .ai-msg-copy {
276
+ border-color: rgba(0,0,0,0.12); color: rgba(0,0,0,0.35);
277
+ }
278
+ [data-bpmnkit-hud-theme="light"] .ai-msg-copy:hover { color: rgba(0,0,0,0.7); border-color: rgba(0,0,0,0.2); }
279
+ [data-bpmnkit-hud-theme="light"] .ai-msg-apply {
280
+ background: rgba(0,150,60,0.1); border-color: rgba(0,150,60,0.25); color: #0a7030;
281
+ }
282
+ [data-bpmnkit-hud-theme="light"] .ai-msg-approve {
283
+ background: rgba(180,120,0,0.1); border-color: rgba(180,120,0,0.25); color: #7a5000;
284
+ }
285
+ [data-bpmnkit-hud-theme="light"] .ai-msg-code { background: rgba(0,0,0,0.05); color: rgba(0,0,0,0.65); }
286
+ [data-bpmnkit-hud-theme="light"] .ai-msg-preview { border-color: rgba(0,0,0,0.1); }
287
+ [data-bpmnkit-hud-theme="light"] .ai-welcome-title { color: rgba(0,0,0,0.85); }
288
+ [data-bpmnkit-hud-theme="light"] .ai-welcome-sub { color: rgba(0,0,0,0.4); }
289
+ [data-bpmnkit-hud-theme="light"] .ai-welcome-example {
290
+ background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.09); color: rgba(0,0,0,0.6);
291
+ }
292
+ [data-bpmnkit-hud-theme="light"] .ai-welcome-example:hover { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.88); }
293
+ [data-bpmnkit-hud-theme="light"] .ai-quick-actions { border-top-color: rgba(0,0,0,0.06); }
294
+ [data-bpmnkit-hud-theme="light"] .ai-quick-btn {
295
+ background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: rgba(0,0,0,0.55);
296
+ }
297
+ [data-bpmnkit-hud-theme="light"] .ai-quick-btn:hover:not(:disabled) { background: rgba(0,0,0,0.08); color: rgba(0,0,0,0.8); }
298
+ [data-bpmnkit-hud-theme="light"] .ai-context-refs { border-top-color: rgba(0,0,0,0.06); }
299
+ [data-bpmnkit-hud-theme="light"] .ai-context-badge {
300
+ background: rgba(0,80,200,0.08); border-color: rgba(0,80,200,0.2); color: rgba(0,60,180,0.85);
301
+ }
302
+ [data-bpmnkit-hud-theme="light"] .ai-context-badge__remove { color: rgba(0,60,180,0.45); }
303
+ [data-bpmnkit-hud-theme="light"] .ai-context-badge__remove:hover { color: rgba(0,0,0,0.8); }
304
+ [data-bpmnkit-hud-theme="light"] .ai-msg-context-chip {
305
+ background: rgba(0,80,200,0.08); border-color: rgba(0,80,200,0.2); color: rgba(0,60,180,0.85);
306
+ }
307
+ [data-bpmnkit-hud-theme="light"] .ai-input-area { border-top-color: var(--bpmnkit-panel-border, rgba(0,0,0,0.08)); }
308
+ [data-bpmnkit-hud-theme="light"] .ai-textarea {
309
+ background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.12); color: rgba(0,0,0,0.8);
310
+ }
311
+ [data-bpmnkit-hud-theme="light"] .ai-textarea:focus { border-color: rgba(0,80,200,0.4); }
312
+ [data-bpmnkit-hud-theme="light"] .ai-textarea::placeholder { color: rgba(0,0,0,0.3); }
313
+ [data-bpmnkit-hud-theme="light"] .ai-send-btn { background: rgba(0,80,200,0.85); border-color: rgba(0,80,200,0.9); }
314
+ [data-bpmnkit-hud-theme="light"] .ai-stop-btn { background: rgba(180,40,40,0.75); border-color: rgba(180,40,40,0.9); }
315
+ [data-bpmnkit-hud-theme="light"] .ai-input-hint { color: rgba(0,0,0,0.25); }
316
+ [data-bpmnkit-hud-theme="light"] .ai-hdr-btn {
317
+ background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: rgba(0,0,0,0.55);
318
+ }
319
+ [data-bpmnkit-hud-theme="light"] .ai-hdr-btn:hover { color: rgba(0,0,0,0.85); }
320
+ [data-bpmnkit-hud-theme="light"] .ai-backend-select {
321
+ background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: rgba(0,0,0,0.55);
322
+ }
323
+ [data-bpmnkit-hud-theme="light"] .ai-hist-panel { background: rgba(252,252,254,0.98); border-color: rgba(0,0,0,0.1); }
324
+ [data-bpmnkit-hud-theme="light"] .ai-hist-header { color: rgba(0,0,0,0.88); border-bottom-color: var(--bpmnkit-panel-border, rgba(0,0,0,0.08)); }
325
+ [data-bpmnkit-hud-theme="light"] .ai-hist-time { color: rgba(0,0,0,0.45); }
326
+ [data-bpmnkit-hud-theme="light"] .ai-hist-item { border-bottom-color: rgba(0,0,0,0.05); }
327
+ [data-bpmnkit-hud-theme="light"] .ai-hist-item:hover { background: rgba(0,0,0,0.03); }
328
+ [data-bpmnkit-hud-theme="light"] .ai-hist-empty { color: rgba(0,0,0,0.35); }
329
+ .ai-companion-offer {
330
+ margin-top: 10px; padding: 10px 12px;
331
+ border: 1px solid rgba(100,160,255,0.2);
332
+ border-radius: 6px; background: rgba(60,120,255,0.06);
333
+ }
334
+ .ai-companion-title {
335
+ font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
336
+ color: rgba(255,255,255,0.45); margin-bottom: 8px;
337
+ }
338
+ .ai-companion-row {
339
+ display: flex; align-items: center; justify-content: space-between;
340
+ gap: 8px; margin-bottom: 5px;
341
+ }
342
+ .ai-companion-row:last-child { margin-bottom: 0; }
343
+ .ai-companion-row span {
344
+ font-size: 12px; color: rgba(255,255,255,0.75); overflow: hidden;
345
+ text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;
346
+ }
347
+ .ai-companion-create {
348
+ flex-shrink: 0; padding: 3px 10px; border-radius: 4px; font-size: 11px; cursor: pointer;
349
+ border: 1px solid rgba(100,160,255,0.3); background: rgba(60,120,255,0.12);
350
+ color: rgba(140,190,255,0.9); transition: background 0.15s;
351
+ }
352
+ .ai-companion-create:hover:not(:disabled) { background: rgba(60,120,255,0.22); }
353
+ .ai-companion-create:disabled { opacity: 0.6; cursor: default; }
354
+ [data-bpmnkit-hud-theme="light"] .ai-companion-offer {
355
+ background: rgba(0,80,200,0.04); border-color: rgba(0,80,200,0.15);
356
+ }
357
+ [data-bpmnkit-hud-theme="light"] .ai-companion-title { color: rgba(0,0,0,0.4); }
358
+ [data-bpmnkit-hud-theme="light"] .ai-companion-row span { color: rgba(0,0,0,0.7); }
359
+ [data-bpmnkit-hud-theme="light"] .ai-companion-create {
360
+ border-color: rgba(0,80,200,0.25); background: rgba(0,80,200,0.07); color: rgba(0,60,180,0.85);
361
+ }
362
+ [data-bpmnkit-hud-theme="light"] .ai-companion-create:hover:not(:disabled) { background: rgba(0,80,200,0.13); }
363
+ `;
364
+ document.head.appendChild(style);
365
+ }
366
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1,44 @@
1
+ import type { BpmnDefinitions } from "@bpmnkit/core";
2
+ import type { NodeContext } from "./panel.js";
3
+ export type { NodeContext };
4
+ export interface AiBridgePluginOptions {
5
+ /** URL of the local AI server. Defaults to http://localhost:3033 */
6
+ serverUrl?: string;
7
+ /** Returns the current diagram definitions, or null if no diagram is loaded. */
8
+ getDefinitions(): BpmnDefinitions | null;
9
+ /** Loads the given XML into the editor. */
10
+ loadXml(xml: string): void;
11
+ /** Returns the current storage context for checkpoint saving, if available. */
12
+ getCurrentContext?(): {
13
+ projectId: string;
14
+ fileId: string;
15
+ } | null;
16
+ /** Dock AI pane to mount into instead of document.body. */
17
+ container?: HTMLElement;
18
+ /** Called when the button is clicked in docked mode. */
19
+ onOpen?: () => void;
20
+ /** Returns the current editor theme — used to match the diagram preview color scheme. */
21
+ getTheme?(): "dark" | "light";
22
+ /**
23
+ * Called when the user requests creation of a companion DMN or Form file.
24
+ * Receives a suggested file name, file type, and the serialized content.
25
+ */
26
+ createCompanionFile?(name: string, type: "dmn" | "form", content: string): Promise<void>;
27
+ }
28
+ /**
29
+ * Creates an AI bridge plugin that provides a chat panel for AI-assisted
30
+ * BPMN diagram creation and modification.
31
+ *
32
+ * The returned `button` should be passed to `initEditorHud` as `aiButton`.
33
+ * The panel is injected into `document.body` on first open.
34
+ */
35
+ export declare function createAiBridgePlugin(options: AiBridgePluginOptions): {
36
+ name: string;
37
+ install(api: unknown): void;
38
+ button: HTMLButtonElement;
39
+ /** Initialize the panel (if not yet created) and open it. */
40
+ openPanel(): void;
41
+ /** Set the node context shown as a badge above the chat input. Pass null to clear. */
42
+ setContext(node: NodeContext | null): void;
43
+ };
44
+ //# sourceMappingURL=index.d.ts.map