@bpmnkit/plugins 0.0.15 → 0.0.17

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.
@@ -0,0 +1,412 @@
1
+ import { optimize } from "@bpmnkit/core";
2
+ import { DEPLOY_CSS, DEPLOY_STYLE_ID, injectDeployStyles } from "./css.js";
3
+ export { DEPLOY_CSS, DEPLOY_STYLE_ID, injectDeployStyles };
4
+ function el(tag, cls, text) {
5
+ const e = document.createElement(tag);
6
+ e.className = cls;
7
+ if (text !== undefined)
8
+ e.textContent = text;
9
+ return e;
10
+ }
11
+ function statusEl(kind, text) {
12
+ const wrap = el("div", `dp-status dp-status-${kind}`);
13
+ const dot = el("span", `dp-dot dp-dot-${kind}`);
14
+ const msg = el("span", "");
15
+ msg.textContent = text;
16
+ wrap.appendChild(dot);
17
+ wrap.appendChild(msg);
18
+ return wrap;
19
+ }
20
+ // ── Plugin factory ─────────────────────────────────────────────────────────────
21
+ export function createDeployPlugin(options) {
22
+ const proxyUrl = (options.proxyUrl ?? "http://localhost:3033").replace(/\/$/, "");
23
+ const operateUrl = options.operateUrl?.replace(/\/$/, "") ?? null;
24
+ // Per-profile deploy results (processDefinitionKey from last deploy)
25
+ let _lastDeployedKey = null;
26
+ let _selectedProfile = null;
27
+ // ── Proxy helpers ──────────────────────────────────────────────────────────
28
+ async function proxyGet(path) {
29
+ const headers = { accept: "application/json" };
30
+ if (_selectedProfile)
31
+ headers["x-profile"] = _selectedProfile;
32
+ const res = await fetch(`${proxyUrl}${path}`, { headers });
33
+ if (!res.ok)
34
+ throw new Error(`HTTP ${res.status}`);
35
+ return res.json();
36
+ }
37
+ async function proxyPost(path, body) {
38
+ const headers = {
39
+ "content-type": "application/json",
40
+ accept: "application/json",
41
+ };
42
+ if (_selectedProfile)
43
+ headers["x-profile"] = _selectedProfile;
44
+ const res = await fetch(`${proxyUrl}${path}`, {
45
+ method: "POST",
46
+ headers,
47
+ body: JSON.stringify(body),
48
+ });
49
+ if (!res.ok) {
50
+ const text = await res.text();
51
+ throw new Error(`HTTP ${res.status}: ${text}`);
52
+ }
53
+ return res.json();
54
+ }
55
+ async function proxyPostMultipart(path, form) {
56
+ const headers = { accept: "application/json" };
57
+ if (_selectedProfile)
58
+ headers["x-profile"] = _selectedProfile;
59
+ const res = await fetch(`${proxyUrl}${path}`, {
60
+ method: "POST",
61
+ headers,
62
+ body: form,
63
+ });
64
+ if (!res.ok) {
65
+ const text = await res.text();
66
+ throw new Error(`HTTP ${res.status}: ${text}`);
67
+ }
68
+ return res.json();
69
+ }
70
+ // ── Panel render ───────────────────────────────────────────────────────────
71
+ let _root = null;
72
+ async function render() {
73
+ if (!_root)
74
+ return;
75
+ _root.innerHTML = "";
76
+ const container = _root;
77
+ try {
78
+ await fetch(`${proxyUrl}/status`, { signal: AbortSignal.timeout(2000) });
79
+ renderPanel(container);
80
+ }
81
+ catch {
82
+ renderOffline(container);
83
+ }
84
+ }
85
+ function renderOffline(container) {
86
+ const wrap = el("div", "dp-offline");
87
+ const icon = el("div", "dp-offline-icon");
88
+ icon.textContent = "⚙";
89
+ const title = el("div", "dp-offline-title", "Proxy server not running");
90
+ const hint = el("div", "dp-offline-hint", "Start the proxy server to deploy processes and manage instances:");
91
+ const code = el("pre", "dp-offline-code", "casen proxy start");
92
+ wrap.appendChild(icon);
93
+ wrap.appendChild(title);
94
+ wrap.appendChild(hint);
95
+ wrap.appendChild(code);
96
+ container.appendChild(wrap);
97
+ }
98
+ function renderPanel(container) {
99
+ const root = el("div", "dp-root");
100
+ container.appendChild(root);
101
+ // ── Profile section ────────────────────────────────────────────────────
102
+ const profileSection = el("div", "dp-section");
103
+ const profileTitle = el("div", "dp-section-title", "Profile");
104
+ const profileRow = el("div", "dp-row");
105
+ const profileSelect = el("select", "dp-select");
106
+ const refreshBtn = el("button", "dp-btn dp-btn-secondary");
107
+ refreshBtn.textContent = "↻";
108
+ refreshBtn.title = "Refresh";
109
+ refreshBtn.style.width = "32px";
110
+ refreshBtn.style.flexShrink = "0";
111
+ profileRow.appendChild(profileSelect);
112
+ profileRow.appendChild(refreshBtn);
113
+ profileSection.appendChild(profileTitle);
114
+ profileSection.appendChild(profileRow);
115
+ root.appendChild(profileSection);
116
+ // ── Cluster health section ─────────────────────────────────────────────
117
+ const clusterSection = el("div", "dp-section");
118
+ const clusterTitle = el("div", "dp-section-title", "Cluster");
119
+ const clusterStatus = el("div", "");
120
+ clusterStatus.appendChild(statusEl("info", "Select a profile to check cluster health"));
121
+ clusterSection.appendChild(clusterTitle);
122
+ clusterSection.appendChild(clusterStatus);
123
+ root.appendChild(clusterSection);
124
+ root.appendChild(el("hr", "dp-divider"));
125
+ // ── Optimizer section ──────────────────────────────────────────────────
126
+ const optSection = el("div", "dp-section");
127
+ const optTitle = el("div", "dp-section-title", "Process Validation");
128
+ const optStatus = el("div", "");
129
+ optStatus.appendChild(statusEl("info", "Loading…"));
130
+ optSection.appendChild(optTitle);
131
+ optSection.appendChild(optStatus);
132
+ root.appendChild(optSection);
133
+ // ── Deploy section ─────────────────────────────────────────────────────
134
+ const deploySection = el("div", "dp-section");
135
+ const deployBtn = el("button", "dp-btn dp-btn-primary", "Deploy Process");
136
+ deployBtn.disabled = true;
137
+ const deployStatus = el("div", "");
138
+ deploySection.appendChild(deployBtn);
139
+ deploySection.appendChild(deployStatus);
140
+ root.appendChild(deploySection);
141
+ // ── Start instance section (shown after deploy or if already deployed) ──
142
+ const startSection = el("div", "dp-section");
143
+ startSection.style.display = "none";
144
+ root.appendChild(el("hr", "dp-divider"));
145
+ const startTitle = el("div", "dp-section-title", "Start Process Instance");
146
+ const varLabel = el("div", "dp-section-title");
147
+ varLabel.style.textTransform = "none";
148
+ varLabel.style.fontSize = "11px";
149
+ varLabel.style.color = "rgba(255,255,255,0.4)";
150
+ varLabel.textContent = "Variables (JSON, optional)";
151
+ const varInput = el("textarea", "dp-textarea");
152
+ varInput.placeholder = '{\n "key": "value"\n}';
153
+ const startBtn = el("button", "dp-btn dp-btn-secondary", "Start Instance");
154
+ const startStatus = el("div", "");
155
+ startSection.appendChild(startTitle);
156
+ startSection.appendChild(varLabel);
157
+ startSection.appendChild(varInput);
158
+ startSection.appendChild(startBtn);
159
+ startSection.appendChild(startStatus);
160
+ root.appendChild(startSection);
161
+ // ── State ──────────────────────────────────────────────────────────────
162
+ let _topologyOk = false;
163
+ let _optimizerOk = false;
164
+ let _deployedKey = _lastDeployedKey;
165
+ function updateDeployBtn() {
166
+ deployBtn.disabled = !_topologyOk || !_optimizerOk;
167
+ }
168
+ // ── Profile loading ────────────────────────────────────────────────────
169
+ async function loadProfiles() {
170
+ try {
171
+ const profiles = await proxyGet("/profiles");
172
+ profileSelect.innerHTML = "";
173
+ for (const p of profiles) {
174
+ const opt = document.createElement("option");
175
+ opt.value = p.name;
176
+ opt.textContent = `${p.name}${p.active ? " ✓" : ""}`;
177
+ if (p.active && _selectedProfile === null) {
178
+ _selectedProfile = p.name;
179
+ opt.selected = true;
180
+ }
181
+ else if (p.name === _selectedProfile) {
182
+ opt.selected = true;
183
+ }
184
+ profileSelect.appendChild(opt);
185
+ }
186
+ if (profiles.length > 0 && _selectedProfile === null) {
187
+ const first = profiles[0];
188
+ if (first) {
189
+ _selectedProfile = first.name;
190
+ profileSelect.value = first.name;
191
+ }
192
+ }
193
+ await checkTopology();
194
+ }
195
+ catch {
196
+ profileSelect.innerHTML = '<option value="">No profiles found</option>';
197
+ }
198
+ }
199
+ profileSelect.addEventListener("change", () => {
200
+ _selectedProfile = profileSelect.value || null;
201
+ void checkTopology();
202
+ });
203
+ refreshBtn.addEventListener("click", () => {
204
+ void loadProfiles();
205
+ });
206
+ // ── Topology check ─────────────────────────────────────────────────────
207
+ async function checkTopology() {
208
+ clusterStatus.innerHTML = "";
209
+ clusterStatus.appendChild(statusEl("info", "Checking…"));
210
+ try {
211
+ const topo = await proxyGet("/api/topology");
212
+ _topologyOk = true;
213
+ const brokers = topo.brokers?.length ?? 0;
214
+ const version = topo.gatewayVersion ?? "unknown";
215
+ clusterStatus.innerHTML = "";
216
+ clusterStatus.appendChild(statusEl("ok", `Connected — ${brokers} broker${brokers === 1 ? "" : "s"}, gateway ${version}`));
217
+ }
218
+ catch (err) {
219
+ _topologyOk = false;
220
+ clusterStatus.innerHTML = "";
221
+ clusterStatus.appendChild(statusEl("err", `Cluster unreachable: ${String(err)}`));
222
+ }
223
+ updateDeployBtn();
224
+ await checkExistingDeployment();
225
+ }
226
+ // ── Optimizer check ────────────────────────────────────────────────────
227
+ function runOptimizerCheck() {
228
+ const defs = options.getDefinitions();
229
+ if (!defs) {
230
+ optStatus.innerHTML = "";
231
+ optStatus.appendChild(statusEl("info", "No process loaded"));
232
+ _optimizerOk = false;
233
+ updateDeployBtn();
234
+ return;
235
+ }
236
+ const report = optimize(defs);
237
+ const errors = report.findings.filter((f) => f.severity === "error");
238
+ const warnings = report.findings.filter((f) => f.severity === "warning");
239
+ optStatus.innerHTML = "";
240
+ if (errors.length > 0) {
241
+ _optimizerOk = false;
242
+ optStatus.appendChild(statusEl("err", `${errors.length} error${errors.length === 1 ? "" : "s"} — fix before deploying`));
243
+ const list = el("div", "dp-finding-list");
244
+ for (const f of errors) {
245
+ const item = el("div", "dp-finding");
246
+ const badge = el("span", "dp-finding-badge", "error");
247
+ const msg = el("span", "");
248
+ msg.textContent = f.message;
249
+ item.appendChild(badge);
250
+ item.appendChild(msg);
251
+ list.appendChild(item);
252
+ }
253
+ optStatus.appendChild(list);
254
+ }
255
+ else if (warnings.length > 0) {
256
+ _optimizerOk = true;
257
+ optStatus.appendChild(statusEl("warn", `${warnings.length} warning${warnings.length === 1 ? "" : "s"} — deploy allowed`));
258
+ }
259
+ else {
260
+ _optimizerOk = true;
261
+ optStatus.appendChild(statusEl("ok", "No issues found"));
262
+ }
263
+ updateDeployBtn();
264
+ }
265
+ // ── Check if already deployed ──────────────────────────────────────────
266
+ async function checkExistingDeployment() {
267
+ const defs = options.getDefinitions();
268
+ const processId = defs?.processes?.[0]?.id;
269
+ if (!processId || !_topologyOk)
270
+ return;
271
+ try {
272
+ const result = await proxyPost("/api/process-definitions/search", { filter: { bpmnProcessId: processId }, page: { from: 0, limit: 1 } });
273
+ const item = result.items?.[0];
274
+ if (item?.processDefinitionKey) {
275
+ _deployedKey = item.processDefinitionKey;
276
+ _lastDeployedKey = _deployedKey;
277
+ showStartSection();
278
+ }
279
+ }
280
+ catch {
281
+ // not yet deployed — no action needed
282
+ }
283
+ }
284
+ function showStartSection() {
285
+ startSection.style.display = "";
286
+ }
287
+ // ── Deploy ─────────────────────────────────────────────────────────────
288
+ deployBtn.addEventListener("click", () => {
289
+ void doDeploy();
290
+ });
291
+ async function doDeploy() {
292
+ const xml = options.getXml();
293
+ if (!xml) {
294
+ deployStatus.innerHTML = "";
295
+ deployStatus.appendChild(statusEl("err", "No process XML available"));
296
+ return;
297
+ }
298
+ const fileName = options.getFileName?.() ?? "process.bpmn";
299
+ deployBtn.disabled = true;
300
+ deployBtn.textContent = "Deploying…";
301
+ deployStatus.innerHTML = "";
302
+ try {
303
+ const form = new FormData();
304
+ const blob = new Blob([xml], { type: "application/xml" });
305
+ form.append("resources", blob, fileName);
306
+ const result = await proxyPostMultipart("/api/deployments", form);
307
+ const process = result.processes?.[0];
308
+ _deployedKey = process?.processDefinitionKey ?? null;
309
+ _lastDeployedKey = _deployedKey;
310
+ deployStatus.innerHTML = "";
311
+ const box = el("div", "dp-result-box");
312
+ const keyLine = document.createElement("div");
313
+ keyLine.textContent = "Deployment key: ";
314
+ const keySpan = el("span", "dp-result-key", result.deploymentKey ?? "—");
315
+ keyLine.appendChild(keySpan);
316
+ const defLine = document.createElement("div");
317
+ defLine.textContent = `Process: ${process?.bpmnProcessId ?? "—"} v${process?.version ?? "?"}`;
318
+ box.appendChild(keyLine);
319
+ box.appendChild(defLine);
320
+ deployStatus.appendChild(box);
321
+ showStartSection();
322
+ }
323
+ catch (err) {
324
+ deployStatus.innerHTML = "";
325
+ deployStatus.appendChild(statusEl("err", `Deploy failed: ${String(err)}`));
326
+ }
327
+ finally {
328
+ deployBtn.disabled = false;
329
+ deployBtn.textContent = "Deploy Process";
330
+ updateDeployBtn();
331
+ }
332
+ }
333
+ // ── Start instance ─────────────────────────────────────────────────────
334
+ startBtn.addEventListener("click", () => {
335
+ void doStartInstance();
336
+ });
337
+ async function doStartInstance() {
338
+ if (!_deployedKey) {
339
+ startStatus.innerHTML = "";
340
+ startStatus.appendChild(statusEl("err", "No deployed process key available"));
341
+ return;
342
+ }
343
+ let variables = {};
344
+ const raw = varInput.value.trim();
345
+ if (raw) {
346
+ try {
347
+ variables = JSON.parse(raw);
348
+ }
349
+ catch {
350
+ startStatus.innerHTML = "";
351
+ startStatus.appendChild(statusEl("err", "Variables must be valid JSON"));
352
+ return;
353
+ }
354
+ }
355
+ startBtn.disabled = true;
356
+ startBtn.textContent = "Starting…";
357
+ startStatus.innerHTML = "";
358
+ try {
359
+ const result = await proxyPost("/api/process-instances", {
360
+ processDefinitionKey: _deployedKey,
361
+ variables,
362
+ });
363
+ const instanceKey = result.processInstanceKey;
364
+ startStatus.innerHTML = "";
365
+ const box = el("div", "dp-result-box");
366
+ const keyLine = document.createElement("div");
367
+ keyLine.textContent = "Instance key: ";
368
+ const keySpan = el("span", "dp-result-key", instanceKey ?? "—");
369
+ keyLine.appendChild(keySpan);
370
+ box.appendChild(keyLine);
371
+ if (operateUrl && instanceKey) {
372
+ const linkLine = document.createElement("div");
373
+ linkLine.style.marginTop = "6px";
374
+ const link = el("a", "dp-link", "View in Operate →");
375
+ link.setAttribute("href", `${operateUrl}#/instances/${instanceKey}`);
376
+ link.setAttribute("target", "_blank");
377
+ link.setAttribute("rel", "noopener noreferrer");
378
+ linkLine.appendChild(link);
379
+ box.appendChild(linkLine);
380
+ }
381
+ startStatus.appendChild(box);
382
+ }
383
+ catch (err) {
384
+ startStatus.innerHTML = "";
385
+ startStatus.appendChild(statusEl("err", `Start failed: ${String(err)}`));
386
+ }
387
+ finally {
388
+ startBtn.disabled = false;
389
+ startBtn.textContent = "Start Instance";
390
+ }
391
+ }
392
+ // ── Initial load ───────────────────────────────────────────────────────
393
+ runOptimizerCheck();
394
+ void loadProfiles();
395
+ }
396
+ // ── CanvasPlugin interface ─────────────────────────────────────────────────
397
+ return {
398
+ name: "deploy",
399
+ install() {
400
+ injectDeployStyles();
401
+ },
402
+ mount(container) {
403
+ _root = container;
404
+ void render();
405
+ },
406
+ onTabActivated() {
407
+ // Re-render to get fresh proxy status and optimizer state
408
+ void render();
409
+ },
410
+ };
411
+ }
412
+ //# sourceMappingURL=index.js.map
@@ -153,6 +153,60 @@ const CSS = `
153
153
  [data-bpmnkit-hud-theme="light"] .bpmnkit-edocs__md hr { border-top-color: rgba(0,0,0,0.08); }
154
154
  [data-bpmnkit-hud-theme="light"] .bpmnkit-edocs__detail-header { border-bottom-color: rgba(0,0,0,0.07); }
155
155
  [data-bpmnkit-hud-theme="light"] .bpmnkit-edocs__shape-icon { color: rgba(0,0,0,0.55); }
156
+ /* Neon theme */
157
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs { color: oklch(73% 0.16 280); }
158
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__search input {
159
+ background: oklch(65% 0.28 280 / 0.05); border-color: oklch(65% 0.28 280 / 0.15);
160
+ color: oklch(73% 0.16 280);
161
+ }
162
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__search input::placeholder { color: oklch(45% 0.08 280); }
163
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__search input:focus {
164
+ border-color: oklch(65% 0.28 280 / 0.5); background: oklch(65% 0.28 280 / 0.08);
165
+ }
166
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__cat-label {
167
+ color: oklch(45% 0.08 280); background: oklch(6% 0.04 280 / 0.98);
168
+ }
169
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__item:hover {
170
+ background: oklch(65% 0.28 280 / 0.06); border-left-color: oklch(72% 0.18 185);
171
+ }
172
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__item.active {
173
+ background: oklch(65% 0.28 280 / 0.1); border-left-color: oklch(72% 0.18 185);
174
+ }
175
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__item-title { color: oklch(80% 0.14 280); }
176
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__item-brief { color: oklch(45% 0.08 280); }
177
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__back { color: oklch(72% 0.18 185); }
178
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__back:hover { color: oklch(82% 0.14 185); }
179
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__detail-title { color: oklch(85% 0.1 280); }
180
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__detail-subtitle { color: oklch(45% 0.08 280); }
181
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__detail-header { border-bottom-color: oklch(65% 0.28 280 / 0.1); }
182
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__shape-icon { color: oklch(60% 0.14 280); }
183
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md h2 { color: oklch(45% 0.08 280); }
184
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md h3 { color: oklch(65% 0.12 280); }
185
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md p,
186
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md ul,
187
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md ol,
188
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md li { color: oklch(70% 0.12 280); }
189
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md code {
190
+ background: oklch(65% 0.28 280 / 0.08); color: oklch(72% 0.18 185);
191
+ }
192
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md pre {
193
+ background: oklch(3% 0.02 270 / 0.7); border-color: oklch(65% 0.28 280 / 0.1);
194
+ }
195
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md pre code { color: oklch(73% 0.16 280); background: none; }
196
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md blockquote {
197
+ border-left-color: oklch(72% 0.18 185); background: oklch(72% 0.18 185 / 0.06);
198
+ color: oklch(65% 0.12 280);
199
+ }
200
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md th {
201
+ background: oklch(65% 0.28 280 / 0.07); color: oklch(55% 0.1 280);
202
+ border-bottom-color: oklch(65% 0.28 280 / 0.12);
203
+ }
204
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md td {
205
+ color: oklch(70% 0.12 280); border-bottom-color: oklch(65% 0.28 280 / 0.07);
206
+ }
207
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md strong { color: oklch(85% 0.1 280); }
208
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md em { color: oklch(68% 0.12 280); }
209
+ [data-bpmnkit-hud-theme="neon"] .bpmnkit-edocs__md hr { border-top-color: oklch(65% 0.28 280 / 0.1); }
156
210
  `;
157
211
  function injectStyles() {
158
212
  if (document.getElementById(STYLE_ID))
@@ -0,0 +1,4 @@
1
+ export declare const STYLE_ID = "bpmnkit-live-mode-v1";
2
+ export declare const CSS = "\n/* \u2500\u2500 Toggle button \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpmnkit-live-toggle {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 4px 12px;\n border-radius: 6px;\n border: 1px solid var(--bpmnkit-border, #d0d0e8);\n background: var(--bpmnkit-surface-2, #eeeef8);\n color: var(--bpmnkit-fg, #1a1a2e);\n font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;\n}\n.bpmnkit-live-toggle:hover {\n border-color: var(--bpmnkit-accent, #1a56db);\n color: var(--bpmnkit-accent, #1a56db);\n}\n.bpmnkit-live-toggle--on {\n border-color: var(--bpmnkit-success, #16a34a);\n color: var(--bpmnkit-success, #16a34a);\n box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);\n}\n.bpmnkit-live-toggle--blocked {\n border-color: var(--bpmnkit-danger, #dc2626);\n color: var(--bpmnkit-danger, #dc2626);\n background: rgba(220, 38, 38, 0.07);\n}\n\n/* \u2500\u2500 Status pill \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpmnkit-live-status {\n display: inline-block;\n font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);\n font-size: 10px;\n font-weight: 700;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n padding: 2px 7px;\n border-radius: 20px;\n background: var(--bpmnkit-surface-2, #eeeef8);\n color: var(--bpmnkit-fg-muted, #6666a0);\n border: 1px solid var(--bpmnkit-border, #d0d0e8);\n}\n.bpmnkit-live-status--off {\n background: var(--bpmnkit-surface-2, #eeeef8);\n color: var(--bpmnkit-fg-muted, #6666a0);\n}\n.bpmnkit-live-status--connecting {\n background: rgba(217, 119, 6, 0.12);\n color: var(--bpmnkit-warn, #d97706);\n border-color: var(--bpmnkit-warn, #d97706);\n}\n.bpmnkit-live-status--live {\n background: rgba(22, 163, 74, 0.12);\n color: var(--bpmnkit-success, #16a34a);\n border-color: var(--bpmnkit-success, #16a34a);\n}\n.bpmnkit-live-status--error {\n background: rgba(220, 38, 38, 0.12);\n color: var(--bpmnkit-danger, #dc2626);\n border-color: var(--bpmnkit-danger, #dc2626);\n}\n.bpmnkit-live-status--blocked {\n background: rgba(220, 38, 38, 0.07);\n color: var(--bpmnkit-danger, #dc2626);\n border-color: var(--bpmnkit-danger, #dc2626);\n}\n\n/* \u2500\u2500 Conflict banner \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpmnkit-live-conflict {\n font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);\n background: rgba(220, 38, 38, 0.07);\n border: 1px solid var(--bpmnkit-danger, #dc2626);\n border-radius: 8px;\n padding: 10px 14px;\n margin: 8px 0;\n font-size: 12px;\n color: var(--bpmnkit-fg, #1a1a2e);\n}\n.bpmnkit-live-conflict-title {\n font-weight: 700;\n color: var(--bpmnkit-danger, #dc2626);\n margin-bottom: 6px;\n}\n.bpmnkit-live-conflict-list {\n list-style: disc;\n padding-left: 18px;\n margin-bottom: 8px;\n}\n.bpmnkit-live-conflict-item {\n font-size: 11px;\n color: var(--bpmnkit-fg-muted, #6666a0);\n font-family: ui-monospace, \"Cascadia Code\", \"JetBrains Mono\", monospace;\n margin-bottom: 2px;\n}\n.bpmnkit-live-btn {\n font-size: 11px;\n padding: 3px 10px;\n border-radius: 5px;\n border: 1px solid var(--bpmnkit-border, #d0d0e8);\n background: var(--bpmnkit-surface, #ffffff);\n color: var(--bpmnkit-fg, #1a1a2e);\n cursor: pointer;\n font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);\n font-weight: 600;\n}\n.bpmnkit-live-btn:hover {\n background: var(--bpmnkit-accent-subtle, rgba(26,86,219,0.12));\n border-color: var(--bpmnkit-accent, #1a56db);\n color: var(--bpmnkit-accent, #1a56db);\n}\n\n/* \u2500\u2500 Variable inspector tooltip \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpmnkit-live-vars-tooltip {\n position: fixed;\n z-index: 9999;\n background: var(--bpmnkit-panel-bg, rgba(255,255,255,0.96));\n border: 1px solid var(--bpmnkit-panel-border, rgba(0,0,0,0.1));\n border-radius: 8px;\n box-shadow: 0 4px 16px rgba(0,0,0,0.14);\n padding: 8px 12px;\n font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);\n font-size: 12px;\n min-width: 160px;\n max-width: 300px;\n pointer-events: none;\n}\n.bpmnkit-live-vars-row {\n display: flex;\n gap: 8px;\n align-items: baseline;\n padding: 2px 0;\n border-bottom: 1px solid var(--bpmnkit-border, #d0d0e8);\n}\n.bpmnkit-live-vars-row:last-child {\n border-bottom: none;\n}\n.bpmnkit-live-vars-name {\n font-weight: 600;\n color: var(--bpmnkit-fg, #1a1a2e);\n flex-shrink: 0;\n}\n.bpmnkit-live-vars-value {\n color: var(--bpmnkit-fg-muted, #6666a0);\n font-family: ui-monospace, \"Cascadia Code\", \"JetBrains Mono\", monospace;\n font-size: 11px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n/* \u2500\u2500 Light theme overrides \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n[data-bpmnkit-hud-theme=\"light\"] .bpmnkit-live-vars-tooltip {\n background: rgba(255,255,255,0.96);\n border-color: rgba(0,0,0,0.1);\n}\n";
3
+ export declare function injectLiveModeStyles(): void;
4
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1,170 @@
1
+ export const STYLE_ID = "bpmnkit-live-mode-v1";
2
+ export const CSS = `
3
+ /* ── Toggle button ─────────────────────────────────────────────────────────── */
4
+ .bpmnkit-live-toggle {
5
+ display: inline-flex;
6
+ align-items: center;
7
+ gap: 6px;
8
+ padding: 4px 12px;
9
+ border-radius: 6px;
10
+ border: 1px solid var(--bpmnkit-border, #d0d0e8);
11
+ background: var(--bpmnkit-surface-2, #eeeef8);
12
+ color: var(--bpmnkit-fg, #1a1a2e);
13
+ font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);
14
+ font-size: 12px;
15
+ font-weight: 600;
16
+ cursor: pointer;
17
+ transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
18
+ }
19
+ .bpmnkit-live-toggle:hover {
20
+ border-color: var(--bpmnkit-accent, #1a56db);
21
+ color: var(--bpmnkit-accent, #1a56db);
22
+ }
23
+ .bpmnkit-live-toggle--on {
24
+ border-color: var(--bpmnkit-success, #16a34a);
25
+ color: var(--bpmnkit-success, #16a34a);
26
+ box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
27
+ }
28
+ .bpmnkit-live-toggle--blocked {
29
+ border-color: var(--bpmnkit-danger, #dc2626);
30
+ color: var(--bpmnkit-danger, #dc2626);
31
+ background: rgba(220, 38, 38, 0.07);
32
+ }
33
+
34
+ /* ── Status pill ───────────────────────────────────────────────────────────── */
35
+ .bpmnkit-live-status {
36
+ display: inline-block;
37
+ font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);
38
+ font-size: 10px;
39
+ font-weight: 700;
40
+ letter-spacing: 0.05em;
41
+ text-transform: uppercase;
42
+ padding: 2px 7px;
43
+ border-radius: 20px;
44
+ background: var(--bpmnkit-surface-2, #eeeef8);
45
+ color: var(--bpmnkit-fg-muted, #6666a0);
46
+ border: 1px solid var(--bpmnkit-border, #d0d0e8);
47
+ }
48
+ .bpmnkit-live-status--off {
49
+ background: var(--bpmnkit-surface-2, #eeeef8);
50
+ color: var(--bpmnkit-fg-muted, #6666a0);
51
+ }
52
+ .bpmnkit-live-status--connecting {
53
+ background: rgba(217, 119, 6, 0.12);
54
+ color: var(--bpmnkit-warn, #d97706);
55
+ border-color: var(--bpmnkit-warn, #d97706);
56
+ }
57
+ .bpmnkit-live-status--live {
58
+ background: rgba(22, 163, 74, 0.12);
59
+ color: var(--bpmnkit-success, #16a34a);
60
+ border-color: var(--bpmnkit-success, #16a34a);
61
+ }
62
+ .bpmnkit-live-status--error {
63
+ background: rgba(220, 38, 38, 0.12);
64
+ color: var(--bpmnkit-danger, #dc2626);
65
+ border-color: var(--bpmnkit-danger, #dc2626);
66
+ }
67
+ .bpmnkit-live-status--blocked {
68
+ background: rgba(220, 38, 38, 0.07);
69
+ color: var(--bpmnkit-danger, #dc2626);
70
+ border-color: var(--bpmnkit-danger, #dc2626);
71
+ }
72
+
73
+ /* ── Conflict banner ───────────────────────────────────────────────────────── */
74
+ .bpmnkit-live-conflict {
75
+ font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);
76
+ background: rgba(220, 38, 38, 0.07);
77
+ border: 1px solid var(--bpmnkit-danger, #dc2626);
78
+ border-radius: 8px;
79
+ padding: 10px 14px;
80
+ margin: 8px 0;
81
+ font-size: 12px;
82
+ color: var(--bpmnkit-fg, #1a1a2e);
83
+ }
84
+ .bpmnkit-live-conflict-title {
85
+ font-weight: 700;
86
+ color: var(--bpmnkit-danger, #dc2626);
87
+ margin-bottom: 6px;
88
+ }
89
+ .bpmnkit-live-conflict-list {
90
+ list-style: disc;
91
+ padding-left: 18px;
92
+ margin-bottom: 8px;
93
+ }
94
+ .bpmnkit-live-conflict-item {
95
+ font-size: 11px;
96
+ color: var(--bpmnkit-fg-muted, #6666a0);
97
+ font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
98
+ margin-bottom: 2px;
99
+ }
100
+ .bpmnkit-live-btn {
101
+ font-size: 11px;
102
+ padding: 3px 10px;
103
+ border-radius: 5px;
104
+ border: 1px solid var(--bpmnkit-border, #d0d0e8);
105
+ background: var(--bpmnkit-surface, #ffffff);
106
+ color: var(--bpmnkit-fg, #1a1a2e);
107
+ cursor: pointer;
108
+ font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);
109
+ font-weight: 600;
110
+ }
111
+ .bpmnkit-live-btn:hover {
112
+ background: var(--bpmnkit-accent-subtle, rgba(26,86,219,0.12));
113
+ border-color: var(--bpmnkit-accent, #1a56db);
114
+ color: var(--bpmnkit-accent, #1a56db);
115
+ }
116
+
117
+ /* ── Variable inspector tooltip ────────────────────────────────────────────── */
118
+ .bpmnkit-live-vars-tooltip {
119
+ position: fixed;
120
+ z-index: 9999;
121
+ background: var(--bpmnkit-panel-bg, rgba(255,255,255,0.96));
122
+ border: 1px solid var(--bpmnkit-panel-border, rgba(0,0,0,0.1));
123
+ border-radius: 8px;
124
+ box-shadow: 0 4px 16px rgba(0,0,0,0.14);
125
+ padding: 8px 12px;
126
+ font-family: var(--bpmnkit-font, system-ui, -apple-system, sans-serif);
127
+ font-size: 12px;
128
+ min-width: 160px;
129
+ max-width: 300px;
130
+ pointer-events: none;
131
+ }
132
+ .bpmnkit-live-vars-row {
133
+ display: flex;
134
+ gap: 8px;
135
+ align-items: baseline;
136
+ padding: 2px 0;
137
+ border-bottom: 1px solid var(--bpmnkit-border, #d0d0e8);
138
+ }
139
+ .bpmnkit-live-vars-row:last-child {
140
+ border-bottom: none;
141
+ }
142
+ .bpmnkit-live-vars-name {
143
+ font-weight: 600;
144
+ color: var(--bpmnkit-fg, #1a1a2e);
145
+ flex-shrink: 0;
146
+ }
147
+ .bpmnkit-live-vars-value {
148
+ color: var(--bpmnkit-fg-muted, #6666a0);
149
+ font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
150
+ font-size: 11px;
151
+ overflow: hidden;
152
+ text-overflow: ellipsis;
153
+ white-space: nowrap;
154
+ }
155
+
156
+ /* ── Light theme overrides ─────────────────────────────────────────────────── */
157
+ [data-bpmnkit-hud-theme="light"] .bpmnkit-live-vars-tooltip {
158
+ background: rgba(255,255,255,0.96);
159
+ border-color: rgba(0,0,0,0.1);
160
+ }
161
+ `;
162
+ export function injectLiveModeStyles() {
163
+ if (document.getElementById(STYLE_ID) !== null)
164
+ return;
165
+ const style = document.createElement("style");
166
+ style.id = STYLE_ID;
167
+ style.textContent = CSS;
168
+ document.head.appendChild(style);
169
+ }
170
+ //# sourceMappingURL=css.js.map