@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.
- package/README.md +153 -0
- package/dist/ai-bridge/css.d.ts +2 -0
- package/dist/ai-bridge/css.js +366 -0
- package/dist/ai-bridge/index.d.ts +44 -0
- package/dist/ai-bridge/index.js +132 -0
- package/dist/ai-bridge/panel.d.ts +27 -0
- package/dist/ai-bridge/panel.js +715 -0
- package/dist/ascii-view/css.d.ts +4 -0
- package/dist/ascii-view/css.js +83 -0
- package/dist/ascii-view/index.d.ts +25 -0
- package/dist/ascii-view/index.js +92 -0
- package/dist/command-palette/css.d.ts +4 -0
- package/dist/command-palette/css.js +157 -0
- package/dist/command-palette/index.d.ts +53 -0
- package/dist/command-palette/index.js +378 -0
- package/dist/command-palette-editor/index.d.ts +35 -0
- package/dist/command-palette-editor/index.js +60 -0
- package/dist/config-panel/css.d.ts +4 -0
- package/dist/config-panel/css.js +719 -0
- package/dist/config-panel/index.d.ts +36 -0
- package/dist/config-panel/index.js +73 -0
- package/dist/config-panel/renderer.d.ts +127 -0
- package/dist/config-panel/renderer.js +1162 -0
- package/dist/config-panel/types.d.ts +118 -0
- package/dist/config-panel/types.js +2 -0
- package/dist/config-panel-bpmn/index.d.ts +58 -0
- package/dist/config-panel-bpmn/index.js +1320 -0
- package/dist/config-panel-bpmn/template-engine.d.ts +17 -0
- package/dist/config-panel-bpmn/template-engine.js +307 -0
- package/dist/config-panel-bpmn/template-to-service-task.d.ts +30 -0
- package/dist/config-panel-bpmn/template-to-service-task.js +92 -0
- package/dist/config-panel-bpmn/template-types.d.ts +126 -0
- package/dist/config-panel-bpmn/template-types.js +6 -0
- package/dist/config-panel-bpmn/templates/generated.d.ts +3 -0
- package/dist/config-panel-bpmn/templates/generated.js +57865 -0
- package/dist/config-panel-bpmn/util.d.ts +46 -0
- package/dist/config-panel-bpmn/util.js +195 -0
- package/dist/dmn-editor/css.d.ts +3 -0
- package/dist/dmn-editor/css.js +667 -0
- package/dist/dmn-editor/dmn-editor.d.ts +34 -0
- package/dist/dmn-editor/dmn-editor.js +646 -0
- package/dist/dmn-editor/drd-canvas.d.ts +85 -0
- package/dist/dmn-editor/drd-canvas.js +1087 -0
- package/dist/dmn-editor/index.d.ts +3 -0
- package/dist/dmn-editor/index.js +2 -0
- package/dist/dmn-viewer/css.d.ts +3 -0
- package/dist/dmn-viewer/css.js +151 -0
- package/dist/dmn-viewer/dmn-viewer.d.ts +30 -0
- package/dist/dmn-viewer/dmn-viewer.js +160 -0
- package/dist/dmn-viewer/feel.d.ts +3 -0
- package/dist/dmn-viewer/feel.js +2 -0
- package/dist/dmn-viewer/index.d.ts +14 -0
- package/dist/dmn-viewer/index.js +12 -0
- package/dist/element-docs/content.d.ts +20 -0
- package/dist/element-docs/content.js +1032 -0
- package/dist/element-docs/index.d.ts +7 -0
- package/dist/element-docs/index.js +643 -0
- package/dist/feel-playground/css.d.ts +4 -0
- package/dist/feel-playground/css.js +292 -0
- package/dist/feel-playground/index.d.ts +4 -0
- package/dist/feel-playground/index.js +3 -0
- package/dist/feel-playground/playground-plugin.d.ts +14 -0
- package/dist/feel-playground/playground-plugin.js +292 -0
- package/dist/form-editor/css.d.ts +3 -0
- package/dist/form-editor/css.js +703 -0
- package/dist/form-editor/form-editor.d.ts +48 -0
- package/dist/form-editor/form-editor.js +1039 -0
- package/dist/form-editor/index.d.ts +3 -0
- package/dist/form-editor/index.js +2 -0
- package/dist/form-viewer/css.d.ts +3 -0
- package/dist/form-viewer/css.js +303 -0
- package/dist/form-viewer/form-viewer.d.ts +29 -0
- package/dist/form-viewer/form-viewer.js +376 -0
- package/dist/form-viewer/index.d.ts +12 -0
- package/dist/form-viewer/index.js +11 -0
- package/dist/history/checkpoint.d.ts +10 -0
- package/dist/history/checkpoint.js +92 -0
- package/dist/history/css.d.ts +2 -0
- package/dist/history/css.js +130 -0
- package/dist/history/history-panel.d.ts +12 -0
- package/dist/history/history-panel.js +142 -0
- package/dist/history/index.d.ts +5 -0
- package/dist/history/index.js +3 -0
- package/dist/main-menu/css.d.ts +4 -0
- package/dist/main-menu/css.js +272 -0
- package/dist/main-menu/index.d.ts +59 -0
- package/dist/main-menu/index.js +285 -0
- package/dist/minimap/css.d.ts +10 -0
- package/dist/minimap/css.js +54 -0
- package/dist/minimap/index.d.ts +38 -0
- package/dist/minimap/index.js +69 -0
- package/dist/minimap/minimap.d.ts +35 -0
- package/dist/minimap/minimap.js +166 -0
- package/dist/optimize/index.d.ts +21 -0
- package/dist/optimize/index.js +304 -0
- package/dist/process-runner/css.d.ts +2 -0
- package/dist/process-runner/css.js +467 -0
- package/dist/process-runner/index.d.ts +56 -0
- package/dist/process-runner/index.js +549 -0
- package/dist/storage/auto-save.d.ts +11 -0
- package/dist/storage/auto-save.js +44 -0
- package/dist/storage/css.d.ts +2 -0
- package/dist/storage/css.js +2 -0
- package/dist/storage/db.d.ts +99 -0
- package/dist/storage/db.js +116 -0
- package/dist/storage/dialog.d.ts +15 -0
- package/dist/storage/dialog.js +201 -0
- package/dist/storage/export.d.ts +3 -0
- package/dist/storage/export.js +137 -0
- package/dist/storage/index.d.ts +44 -0
- package/dist/storage/index.js +201 -0
- package/dist/storage/sidebar.d.ts +2 -0
- package/dist/storage/sidebar.js +2 -0
- package/dist/storage/storage-api.d.ts +76 -0
- package/dist/storage/storage-api.js +342 -0
- package/dist/storage/types.d.ts +44 -0
- package/dist/storage/types.js +2 -0
- package/dist/storage-tabs-bridge/index.d.ts +96 -0
- package/dist/storage-tabs-bridge/index.js +502 -0
- package/dist/tabs/css.d.ts +3 -0
- package/dist/tabs/css.js +642 -0
- package/dist/tabs/file-resolver.d.ts +71 -0
- package/dist/tabs/file-resolver.js +46 -0
- package/dist/tabs/index.d.ts +15 -0
- package/dist/tabs/index.js +13 -0
- package/dist/tabs/tabs-plugin.d.ts +250 -0
- package/dist/tabs/tabs-plugin.js +1119 -0
- package/dist/token-highlight/css.d.ts +2 -0
- package/dist/token-highlight/css.js +81 -0
- package/dist/token-highlight/index.d.ts +44 -0
- package/dist/token-highlight/index.js +164 -0
- package/dist/watermark/css.d.ts +10 -0
- package/dist/watermark/css.js +54 -0
- package/dist/watermark/index.d.ts +48 -0
- package/dist/watermark/index.js +64 -0
- package/dist/zoom-controls/css.d.ts +4 -0
- package/dist/zoom-controls/css.js +48 -0
- package/dist/zoom-controls/index.d.ts +36 -0
- package/dist/zoom-controls/index.js +111 -0
- package/package.json +121 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { listCheckpoints } from "./checkpoint.js";
|
|
2
|
+
import { injectHistoryStyles } from "./css.js";
|
|
3
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
4
|
+
function dayKey(ts) {
|
|
5
|
+
const d = new Date(ts);
|
|
6
|
+
return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
7
|
+
}
|
|
8
|
+
function dayLabel(ts) {
|
|
9
|
+
const todayKey = dayKey(Date.now());
|
|
10
|
+
const yesterdayKey = dayKey(Date.now() - 86_400_000);
|
|
11
|
+
const key = dayKey(ts);
|
|
12
|
+
if (key === todayKey)
|
|
13
|
+
return "Today";
|
|
14
|
+
if (key === yesterdayKey)
|
|
15
|
+
return "Yesterday";
|
|
16
|
+
return new Date(ts).toLocaleDateString(undefined, {
|
|
17
|
+
weekday: "long",
|
|
18
|
+
month: "long",
|
|
19
|
+
day: "numeric",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function timeLabel(ts) {
|
|
23
|
+
return new Date(ts).toLocaleTimeString(undefined, {
|
|
24
|
+
hour: "2-digit",
|
|
25
|
+
minute: "2-digit",
|
|
26
|
+
second: "2-digit",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// ── Custom confirm dialog ─────────────────────────────────────────────────────
|
|
30
|
+
function showConfirm(onConfirm) {
|
|
31
|
+
const overlay = document.createElement("div");
|
|
32
|
+
overlay.className = "bpmnkit-hist-confirm-overlay";
|
|
33
|
+
const panel = document.createElement("div");
|
|
34
|
+
panel.className = "bpmnkit-hist-confirm-panel";
|
|
35
|
+
const titleEl = document.createElement("div");
|
|
36
|
+
titleEl.className = "bpmnkit-hist-confirm-title";
|
|
37
|
+
titleEl.textContent = "Restore checkpoint?";
|
|
38
|
+
const bodyEl = document.createElement("div");
|
|
39
|
+
bodyEl.className = "bpmnkit-hist-confirm-body";
|
|
40
|
+
bodyEl.textContent =
|
|
41
|
+
"Your current changes will be replaced with this checkpoint. This cannot be undone.";
|
|
42
|
+
const actions = document.createElement("div");
|
|
43
|
+
actions.className = "bpmnkit-hist-confirm-actions";
|
|
44
|
+
const cancelBtn = document.createElement("button");
|
|
45
|
+
cancelBtn.className = "bpmnkit-hist-confirm-cancel";
|
|
46
|
+
cancelBtn.textContent = "Cancel";
|
|
47
|
+
cancelBtn.addEventListener("click", () => overlay.remove());
|
|
48
|
+
const okBtn = document.createElement("button");
|
|
49
|
+
okBtn.className = "bpmnkit-hist-confirm-ok";
|
|
50
|
+
okBtn.textContent = "Restore";
|
|
51
|
+
okBtn.addEventListener("click", () => {
|
|
52
|
+
overlay.remove();
|
|
53
|
+
onConfirm();
|
|
54
|
+
});
|
|
55
|
+
actions.append(cancelBtn, okBtn);
|
|
56
|
+
panel.append(titleEl, bodyEl, actions);
|
|
57
|
+
overlay.append(panel);
|
|
58
|
+
overlay.addEventListener("click", (e) => {
|
|
59
|
+
if (e.target === overlay)
|
|
60
|
+
overlay.remove();
|
|
61
|
+
});
|
|
62
|
+
document.body.append(overlay);
|
|
63
|
+
}
|
|
64
|
+
// ── Panel ─────────────────────────────────────────────────────────────────────
|
|
65
|
+
export function createHistoryPanel(options) {
|
|
66
|
+
injectHistoryStyles();
|
|
67
|
+
const el = document.createElement("div");
|
|
68
|
+
el.className = "bpmnkit-hist-pane";
|
|
69
|
+
// Header
|
|
70
|
+
const header = document.createElement("div");
|
|
71
|
+
header.className = "bpmnkit-hist-header";
|
|
72
|
+
const titleEl = document.createElement("span");
|
|
73
|
+
titleEl.className = "bpmnkit-hist-header-title";
|
|
74
|
+
titleEl.textContent = "Checkpoints";
|
|
75
|
+
const refreshBtn = document.createElement("button");
|
|
76
|
+
refreshBtn.className = "bpmnkit-hist-refresh";
|
|
77
|
+
refreshBtn.title = "Refresh";
|
|
78
|
+
refreshBtn.textContent = "↻";
|
|
79
|
+
header.append(titleEl, refreshBtn);
|
|
80
|
+
// List
|
|
81
|
+
const list = document.createElement("div");
|
|
82
|
+
list.className = "bpmnkit-hist-list";
|
|
83
|
+
el.append(header, list);
|
|
84
|
+
// ── Render ──
|
|
85
|
+
function render(checkpoints, hasContext) {
|
|
86
|
+
list.textContent = "";
|
|
87
|
+
if (!hasContext) {
|
|
88
|
+
const msg = document.createElement("div");
|
|
89
|
+
msg.className = "bpmnkit-hist-empty";
|
|
90
|
+
msg.textContent = "Open a saved file to view its checkpoint history.";
|
|
91
|
+
list.append(msg);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (checkpoints.length === 0) {
|
|
95
|
+
const msg = document.createElement("div");
|
|
96
|
+
msg.className = "bpmnkit-hist-empty";
|
|
97
|
+
msg.textContent = "No checkpoints yet. They are created automatically as you edit.";
|
|
98
|
+
list.append(msg);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
// Group by day (checkpoints already sorted newest-first)
|
|
102
|
+
let currentDay = "";
|
|
103
|
+
for (const cp of checkpoints) {
|
|
104
|
+
const day = dayKey(cp.timestamp);
|
|
105
|
+
if (day !== currentDay) {
|
|
106
|
+
currentDay = day;
|
|
107
|
+
const groupLabel = document.createElement("div");
|
|
108
|
+
groupLabel.className = "bpmnkit-hist-group-label";
|
|
109
|
+
groupLabel.textContent = dayLabel(cp.timestamp);
|
|
110
|
+
list.append(groupLabel);
|
|
111
|
+
}
|
|
112
|
+
const item = document.createElement("div");
|
|
113
|
+
item.className = "bpmnkit-hist-item";
|
|
114
|
+
const timeEl = document.createElement("span");
|
|
115
|
+
timeEl.className = "bpmnkit-hist-item-time";
|
|
116
|
+
timeEl.textContent = timeLabel(cp.timestamp);
|
|
117
|
+
const restoreBtn = document.createElement("button");
|
|
118
|
+
restoreBtn.className = "bpmnkit-hist-restore";
|
|
119
|
+
restoreBtn.textContent = "Restore";
|
|
120
|
+
restoreBtn.addEventListener("click", () => {
|
|
121
|
+
showConfirm(() => options.loadXml(cp.xml));
|
|
122
|
+
});
|
|
123
|
+
item.append(timeEl, restoreBtn);
|
|
124
|
+
list.append(item);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// ── Refresh ──
|
|
128
|
+
async function refresh() {
|
|
129
|
+
const ctx = options.getCurrentContext?.() ?? null;
|
|
130
|
+
if (!ctx) {
|
|
131
|
+
render([], false);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const checkpoints = await listCheckpoints(ctx.projectId, ctx.fileId);
|
|
135
|
+
render(checkpoints, true);
|
|
136
|
+
}
|
|
137
|
+
refreshBtn.addEventListener("click", () => {
|
|
138
|
+
void refresh();
|
|
139
|
+
});
|
|
140
|
+
return { el, refresh };
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=history-panel.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { saveCheckpoint, listCheckpoints } from "./checkpoint.js";
|
|
2
|
+
export type { Checkpoint } from "./checkpoint.js";
|
|
3
|
+
export { createHistoryPanel } from "./history-panel.js";
|
|
4
|
+
export type { HistoryPanelOptions } from "./history-panel.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const MAIN_MENU_STYLE_ID = "bpmnkit-main-menu-styles-v2";
|
|
2
|
+
export declare const MAIN_MENU_CSS = "\n.bpmnkit-main-menu-panel {\n position: absolute;\n top: 0;\n right: 0;\n height: 36px;\n display: flex;\n align-items: center;\n gap: 3px;\n padding: 0 6px;\n background: #f0f4f8;\n border: none;\n border-left: 1px solid #d0d0d0;\n border-radius: 0;\n box-shadow: none;\n z-index: 10000;\n}\n[data-theme=\"dark\"] .bpmnkit-main-menu-panel {\n background: var(--bpmnkit-surface-2, #1e1e2e);\n border-left-color: #313244;\n}\n.bpmnkit-canvas-host:has(.bpmnkit-main-menu-panel:not([style*=\"none\"])) .bpmnkit-tabs {\n padding-right: 160px;\n}\n.bpmnkit-main-menu-title {\n padding: 0 6px;\n font-size: 12px;\n font-weight: 600;\n font-family: system-ui, sans-serif;\n color: var(--bpmnkit-text, #333333);\n white-space: nowrap;\n user-select: none;\n opacity: 0.75;\n}\n.bpmnkit-main-menu-sep {\n width: 1px;\n height: 16px;\n background: var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));\n flex-shrink: 0;\n}\n.bpmnkit-menu-btn {\n width: 28px;\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: 1px solid transparent;\n border-radius: 4px;\n color: var(--bpmnkit-text, #333333);\n cursor: pointer;\n padding: 0;\n flex-shrink: 0;\n transition: background 0.1s;\n}\n.bpmnkit-menu-btn:hover {\n background: var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));\n}\n.bpmnkit-menu-btn svg {\n width: 16px;\n height: 16px;\n pointer-events: none;\n}\n.bpmnkit-menu-dropdown {\n position: fixed;\n display: none;\n flex-direction: column;\n background: var(--bpmnkit-overlay-bg, rgba(248, 249, 250, 0.96));\n border: 1px solid var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);\n z-index: 10001;\n min-width: 220px;\n overflow: hidden;\n}\n.bpmnkit-menu-dropdown.open { display: flex; }\n.bpmnkit-menu-level {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: 4px;\n position: relative;\n z-index: 1;\n}\n@keyframes bpmnkit-menu-in-right {\n from { opacity: 0; transform: translateX(20px); }\n to { opacity: 1; transform: translateX(0); }\n}\n@keyframes bpmnkit-menu-in-left {\n from { opacity: 0; transform: translateX(-20px); }\n to { opacity: 1; transform: translateX(0); }\n}\n@keyframes bpmnkit-menu-out-left {\n from { opacity: 1; transform: translateX(0); }\n to { opacity: 0; transform: translateX(-20px); }\n}\n@keyframes bpmnkit-menu-out-right {\n from { opacity: 1; transform: translateX(0); }\n to { opacity: 0; transform: translateX(20px); }\n}\n.bpmnkit-menu-level--in-right { animation: bpmnkit-menu-in-right 180ms ease-out forwards; }\n.bpmnkit-menu-level--in-left { animation: bpmnkit-menu-in-left 180ms ease-out forwards; }\n.bpmnkit-menu-level--out-left { animation: bpmnkit-menu-out-left 150ms ease-in forwards; }\n.bpmnkit-menu-level--out-right { animation: bpmnkit-menu-out-right 150ms ease-in forwards; }\n.bpmnkit-menu-drop-label {\n padding: 3px 8px 1px;\n font-size: 10px;\n font-weight: 600;\n font-family: system-ui, sans-serif;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--bpmnkit-text, #333333);\n opacity: 0.45;\n}\n.bpmnkit-menu-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 8px;\n background: transparent;\n border: none;\n border-radius: 5px;\n color: var(--bpmnkit-text, #333333);\n cursor: pointer;\n font-family: system-ui, sans-serif;\n font-size: 12px;\n text-align: left;\n width: 100%;\n transition: background 0.1s;\n}\n.bpmnkit-menu-item:hover {\n background: var(--bpmnkit-overlay-border, rgba(0, 0, 0, 0.06));\n}\n.bpmnkit-menu-item-check {\n width: 12px;\n height: 12px;\n flex-shrink: 0;\n color: var(--bpmnkit-highlight, var(--bpmnkit-accent, #1a56db));\n}\n.bpmnkit-menu-item-icon {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n opacity: 0.65;\n}\n.bpmnkit-menu-item-label {\n flex: 1;\n}\n.bpmnkit-menu-item-arrow {\n width: 12px;\n height: 12px;\n flex-shrink: 0;\n opacity: 0.45;\n}\n.bpmnkit-menu-item-icon svg,\n.bpmnkit-menu-item-check svg,\n.bpmnkit-menu-item-arrow svg {\n width: 100%;\n height: 100%;\n}\n.bpmnkit-menu-back-row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 2px 4px;\n}\n.bpmnkit-menu-back-btn {\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: none;\n border-radius: 4px;\n color: var(--bpmnkit-text, #333333);\n cursor: pointer;\n padding: 0;\n flex-shrink: 0;\n transition: background 0.1s;\n}\n.bpmnkit-menu-back-btn:hover {\n background: var(--bpmnkit-overlay-border, rgba(0, 0, 0, 0.06));\n}\n.bpmnkit-menu-back-btn svg {\n width: 12px;\n height: 12px;\n pointer-events: none;\n}\n.bpmnkit-menu-level-title {\n font-size: 12px;\n font-weight: 600;\n font-family: system-ui, sans-serif;\n color: var(--bpmnkit-text, #333333);\n flex: 1;\n}\n.bpmnkit-menu-info-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 5px 8px;\n font-family: system-ui, sans-serif;\n font-size: 12px;\n color: var(--bpmnkit-text, #333333);\n opacity: 0.75;\n}\n.bpmnkit-menu-info-text {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.bpmnkit-menu-info-action {\n flex-shrink: 0;\n border: 1px solid var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));\n border-radius: 4px;\n background: transparent;\n color: var(--bpmnkit-text, #333333);\n cursor: pointer;\n padding: 2px 7px;\n font-size: 11px;\n font-family: system-ui, sans-serif;\n transition: background 0.1s;\n}\n.bpmnkit-menu-info-action:hover {\n background: var(--bpmnkit-overlay-border, rgba(0, 0, 0, 0.06));\n}\n.bpmnkit-menu-drop-sep {\n height: 1px;\n background: var(--bpmnkit-overlay-border, rgba(0,0,0,0.1));\n margin: 3px 4px;\n}\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-dropdown {\n background: var(--bpmnkit-panel-bg, rgba(13,13,22,0.92));\n border-color: var(--bpmnkit-panel-border, rgba(255, 255, 255, 0.08));\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);\n}\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-item,\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-back-btn,\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-level-title,\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-info-row,\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-info-action,\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-drop-label {\n color: rgba(205, 214, 244, 0.9);\n}\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-item:hover,\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-back-btn:hover,\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-info-action:hover {\n background: rgba(255, 255, 255, 0.08);\n}\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-info-action {\n border-color: rgba(255, 255, 255, 0.15);\n}\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-drop-sep {\n background: var(--bpmnkit-panel-border, rgba(255, 255, 255, 0.08));\n}\n[data-bpmnkit-hud-theme=\"dark\"] .bpmnkit-menu-item-check {\n color: var(--bpmnkit-accent-bright, #89b4fa);\n}\n";
|
|
3
|
+
export declare function injectMainMenuStyles(): void;
|
|
4
|
+
//# sourceMappingURL=css.d.ts.map
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
export const MAIN_MENU_STYLE_ID = "bpmnkit-main-menu-styles-v2";
|
|
2
|
+
export const MAIN_MENU_CSS = `
|
|
3
|
+
.bpmnkit-main-menu-panel {
|
|
4
|
+
position: absolute;
|
|
5
|
+
top: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
height: 36px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 3px;
|
|
11
|
+
padding: 0 6px;
|
|
12
|
+
background: #f0f4f8;
|
|
13
|
+
border: none;
|
|
14
|
+
border-left: 1px solid #d0d0d0;
|
|
15
|
+
border-radius: 0;
|
|
16
|
+
box-shadow: none;
|
|
17
|
+
z-index: 10000;
|
|
18
|
+
}
|
|
19
|
+
[data-theme="dark"] .bpmnkit-main-menu-panel {
|
|
20
|
+
background: var(--bpmnkit-surface-2, #1e1e2e);
|
|
21
|
+
border-left-color: #313244;
|
|
22
|
+
}
|
|
23
|
+
.bpmnkit-canvas-host:has(.bpmnkit-main-menu-panel:not([style*="none"])) .bpmnkit-tabs {
|
|
24
|
+
padding-right: 160px;
|
|
25
|
+
}
|
|
26
|
+
.bpmnkit-main-menu-title {
|
|
27
|
+
padding: 0 6px;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
font-family: system-ui, sans-serif;
|
|
31
|
+
color: var(--bpmnkit-text, #333333);
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
user-select: none;
|
|
34
|
+
opacity: 0.75;
|
|
35
|
+
}
|
|
36
|
+
.bpmnkit-main-menu-sep {
|
|
37
|
+
width: 1px;
|
|
38
|
+
height: 16px;
|
|
39
|
+
background: var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
}
|
|
42
|
+
.bpmnkit-menu-btn {
|
|
43
|
+
width: 28px;
|
|
44
|
+
height: 28px;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
background: transparent;
|
|
49
|
+
border: 1px solid transparent;
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
color: var(--bpmnkit-text, #333333);
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
padding: 0;
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
transition: background 0.1s;
|
|
56
|
+
}
|
|
57
|
+
.bpmnkit-menu-btn:hover {
|
|
58
|
+
background: var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));
|
|
59
|
+
}
|
|
60
|
+
.bpmnkit-menu-btn svg {
|
|
61
|
+
width: 16px;
|
|
62
|
+
height: 16px;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
}
|
|
65
|
+
.bpmnkit-menu-dropdown {
|
|
66
|
+
position: fixed;
|
|
67
|
+
display: none;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
background: var(--bpmnkit-overlay-bg, rgba(248, 249, 250, 0.96));
|
|
70
|
+
border: 1px solid var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));
|
|
71
|
+
border-radius: 8px;
|
|
72
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
|
73
|
+
z-index: 10001;
|
|
74
|
+
min-width: 220px;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
}
|
|
77
|
+
.bpmnkit-menu-dropdown.open { display: flex; }
|
|
78
|
+
.bpmnkit-menu-level {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: 1px;
|
|
82
|
+
padding: 4px;
|
|
83
|
+
position: relative;
|
|
84
|
+
z-index: 1;
|
|
85
|
+
}
|
|
86
|
+
@keyframes bpmnkit-menu-in-right {
|
|
87
|
+
from { opacity: 0; transform: translateX(20px); }
|
|
88
|
+
to { opacity: 1; transform: translateX(0); }
|
|
89
|
+
}
|
|
90
|
+
@keyframes bpmnkit-menu-in-left {
|
|
91
|
+
from { opacity: 0; transform: translateX(-20px); }
|
|
92
|
+
to { opacity: 1; transform: translateX(0); }
|
|
93
|
+
}
|
|
94
|
+
@keyframes bpmnkit-menu-out-left {
|
|
95
|
+
from { opacity: 1; transform: translateX(0); }
|
|
96
|
+
to { opacity: 0; transform: translateX(-20px); }
|
|
97
|
+
}
|
|
98
|
+
@keyframes bpmnkit-menu-out-right {
|
|
99
|
+
from { opacity: 1; transform: translateX(0); }
|
|
100
|
+
to { opacity: 0; transform: translateX(20px); }
|
|
101
|
+
}
|
|
102
|
+
.bpmnkit-menu-level--in-right { animation: bpmnkit-menu-in-right 180ms ease-out forwards; }
|
|
103
|
+
.bpmnkit-menu-level--in-left { animation: bpmnkit-menu-in-left 180ms ease-out forwards; }
|
|
104
|
+
.bpmnkit-menu-level--out-left { animation: bpmnkit-menu-out-left 150ms ease-in forwards; }
|
|
105
|
+
.bpmnkit-menu-level--out-right { animation: bpmnkit-menu-out-right 150ms ease-in forwards; }
|
|
106
|
+
.bpmnkit-menu-drop-label {
|
|
107
|
+
padding: 3px 8px 1px;
|
|
108
|
+
font-size: 10px;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
font-family: system-ui, sans-serif;
|
|
111
|
+
letter-spacing: 0.06em;
|
|
112
|
+
text-transform: uppercase;
|
|
113
|
+
color: var(--bpmnkit-text, #333333);
|
|
114
|
+
opacity: 0.45;
|
|
115
|
+
}
|
|
116
|
+
.bpmnkit-menu-item {
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
gap: 8px;
|
|
120
|
+
padding: 6px 8px;
|
|
121
|
+
background: transparent;
|
|
122
|
+
border: none;
|
|
123
|
+
border-radius: 5px;
|
|
124
|
+
color: var(--bpmnkit-text, #333333);
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
font-family: system-ui, sans-serif;
|
|
127
|
+
font-size: 12px;
|
|
128
|
+
text-align: left;
|
|
129
|
+
width: 100%;
|
|
130
|
+
transition: background 0.1s;
|
|
131
|
+
}
|
|
132
|
+
.bpmnkit-menu-item:hover {
|
|
133
|
+
background: var(--bpmnkit-overlay-border, rgba(0, 0, 0, 0.06));
|
|
134
|
+
}
|
|
135
|
+
.bpmnkit-menu-item-check {
|
|
136
|
+
width: 12px;
|
|
137
|
+
height: 12px;
|
|
138
|
+
flex-shrink: 0;
|
|
139
|
+
color: var(--bpmnkit-highlight, var(--bpmnkit-accent, #1a56db));
|
|
140
|
+
}
|
|
141
|
+
.bpmnkit-menu-item-icon {
|
|
142
|
+
width: 14px;
|
|
143
|
+
height: 14px;
|
|
144
|
+
flex-shrink: 0;
|
|
145
|
+
opacity: 0.65;
|
|
146
|
+
}
|
|
147
|
+
.bpmnkit-menu-item-label {
|
|
148
|
+
flex: 1;
|
|
149
|
+
}
|
|
150
|
+
.bpmnkit-menu-item-arrow {
|
|
151
|
+
width: 12px;
|
|
152
|
+
height: 12px;
|
|
153
|
+
flex-shrink: 0;
|
|
154
|
+
opacity: 0.45;
|
|
155
|
+
}
|
|
156
|
+
.bpmnkit-menu-item-icon svg,
|
|
157
|
+
.bpmnkit-menu-item-check svg,
|
|
158
|
+
.bpmnkit-menu-item-arrow svg {
|
|
159
|
+
width: 100%;
|
|
160
|
+
height: 100%;
|
|
161
|
+
}
|
|
162
|
+
.bpmnkit-menu-back-row {
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
gap: 4px;
|
|
166
|
+
padding: 2px 4px;
|
|
167
|
+
}
|
|
168
|
+
.bpmnkit-menu-back-btn {
|
|
169
|
+
width: 24px;
|
|
170
|
+
height: 24px;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
background: transparent;
|
|
175
|
+
border: none;
|
|
176
|
+
border-radius: 4px;
|
|
177
|
+
color: var(--bpmnkit-text, #333333);
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
padding: 0;
|
|
180
|
+
flex-shrink: 0;
|
|
181
|
+
transition: background 0.1s;
|
|
182
|
+
}
|
|
183
|
+
.bpmnkit-menu-back-btn:hover {
|
|
184
|
+
background: var(--bpmnkit-overlay-border, rgba(0, 0, 0, 0.06));
|
|
185
|
+
}
|
|
186
|
+
.bpmnkit-menu-back-btn svg {
|
|
187
|
+
width: 12px;
|
|
188
|
+
height: 12px;
|
|
189
|
+
pointer-events: none;
|
|
190
|
+
}
|
|
191
|
+
.bpmnkit-menu-level-title {
|
|
192
|
+
font-size: 12px;
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
font-family: system-ui, sans-serif;
|
|
195
|
+
color: var(--bpmnkit-text, #333333);
|
|
196
|
+
flex: 1;
|
|
197
|
+
}
|
|
198
|
+
.bpmnkit-menu-info-row {
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
gap: 8px;
|
|
202
|
+
padding: 5px 8px;
|
|
203
|
+
font-family: system-ui, sans-serif;
|
|
204
|
+
font-size: 12px;
|
|
205
|
+
color: var(--bpmnkit-text, #333333);
|
|
206
|
+
opacity: 0.75;
|
|
207
|
+
}
|
|
208
|
+
.bpmnkit-menu-info-text {
|
|
209
|
+
flex: 1;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
text-overflow: ellipsis;
|
|
212
|
+
white-space: nowrap;
|
|
213
|
+
}
|
|
214
|
+
.bpmnkit-menu-info-action {
|
|
215
|
+
flex-shrink: 0;
|
|
216
|
+
border: 1px solid var(--bpmnkit-overlay-border, var(--bpmnkit-panel-border, rgba(0, 0, 0, 0.08)));
|
|
217
|
+
border-radius: 4px;
|
|
218
|
+
background: transparent;
|
|
219
|
+
color: var(--bpmnkit-text, #333333);
|
|
220
|
+
cursor: pointer;
|
|
221
|
+
padding: 2px 7px;
|
|
222
|
+
font-size: 11px;
|
|
223
|
+
font-family: system-ui, sans-serif;
|
|
224
|
+
transition: background 0.1s;
|
|
225
|
+
}
|
|
226
|
+
.bpmnkit-menu-info-action:hover {
|
|
227
|
+
background: var(--bpmnkit-overlay-border, rgba(0, 0, 0, 0.06));
|
|
228
|
+
}
|
|
229
|
+
.bpmnkit-menu-drop-sep {
|
|
230
|
+
height: 1px;
|
|
231
|
+
background: var(--bpmnkit-overlay-border, rgba(0,0,0,0.1));
|
|
232
|
+
margin: 3px 4px;
|
|
233
|
+
}
|
|
234
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-dropdown {
|
|
235
|
+
background: var(--bpmnkit-panel-bg, rgba(13,13,22,0.92));
|
|
236
|
+
border-color: var(--bpmnkit-panel-border, rgba(255, 255, 255, 0.08));
|
|
237
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
238
|
+
}
|
|
239
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-item,
|
|
240
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-back-btn,
|
|
241
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-level-title,
|
|
242
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-info-row,
|
|
243
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-info-action,
|
|
244
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-drop-label {
|
|
245
|
+
color: rgba(205, 214, 244, 0.9);
|
|
246
|
+
}
|
|
247
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-item:hover,
|
|
248
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-back-btn:hover,
|
|
249
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-info-action:hover {
|
|
250
|
+
background: rgba(255, 255, 255, 0.08);
|
|
251
|
+
}
|
|
252
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-info-action {
|
|
253
|
+
border-color: rgba(255, 255, 255, 0.15);
|
|
254
|
+
}
|
|
255
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-drop-sep {
|
|
256
|
+
background: var(--bpmnkit-panel-border, rgba(255, 255, 255, 0.08));
|
|
257
|
+
}
|
|
258
|
+
[data-bpmnkit-hud-theme="dark"] .bpmnkit-menu-item-check {
|
|
259
|
+
color: var(--bpmnkit-accent-bright, #89b4fa);
|
|
260
|
+
}
|
|
261
|
+
`;
|
|
262
|
+
export function injectMainMenuStyles() {
|
|
263
|
+
if (typeof document === "undefined")
|
|
264
|
+
return;
|
|
265
|
+
if (document.getElementById(MAIN_MENU_STYLE_ID))
|
|
266
|
+
return;
|
|
267
|
+
const style = document.createElement("style");
|
|
268
|
+
style.id = MAIN_MENU_STYLE_ID;
|
|
269
|
+
style.textContent = MAIN_MENU_CSS;
|
|
270
|
+
document.head.appendChild(style);
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @bpmnkit/canvas-plugin-main-menu — main menu plugin for `@bpmnkit/canvas`.
|
|
3
|
+
*
|
|
4
|
+
* Adds a panel in the top-right corner of the canvas with an optional title
|
|
5
|
+
* and a menu button. The menu lets users switch between light, dark, and
|
|
6
|
+
* automatic (OS-preference) color themes. Supports drill-down navigation,
|
|
7
|
+
* dynamic items, and a programmatic API for title/items injection.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
import type { CanvasPlugin } from "@bpmnkit/canvas";
|
|
12
|
+
export { MAIN_MENU_CSS, MAIN_MENU_STYLE_ID, injectMainMenuStyles } from "./css.js";
|
|
13
|
+
/** A clickable action item in the main menu dropdown. */
|
|
14
|
+
export interface MenuAction {
|
|
15
|
+
label: string;
|
|
16
|
+
icon?: string;
|
|
17
|
+
onClick: () => void;
|
|
18
|
+
}
|
|
19
|
+
/** A visual separator between groups of menu items. */
|
|
20
|
+
export interface MenuSeparator {
|
|
21
|
+
type: "separator";
|
|
22
|
+
}
|
|
23
|
+
/** A drill-down item — clicking replaces dropdown content with a sub-menu. */
|
|
24
|
+
export interface MenuDrill {
|
|
25
|
+
type: "drill";
|
|
26
|
+
label: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
items: MenuItem[] | (() => MenuItem[]);
|
|
29
|
+
}
|
|
30
|
+
/** A passive info row with optional inline action button. */
|
|
31
|
+
export interface MenuInfo {
|
|
32
|
+
type: "info";
|
|
33
|
+
text: string;
|
|
34
|
+
actionLabel?: string;
|
|
35
|
+
onAction?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export type MenuItem = MenuAction | MenuSeparator | MenuDrill | MenuInfo;
|
|
38
|
+
export interface MainMenuOptions {
|
|
39
|
+
/** Optional title text shown to the left of the menu button. */
|
|
40
|
+
title?: string;
|
|
41
|
+
/** Extra items rendered above the Theme section in the dropdown. */
|
|
42
|
+
menuItems?: MenuItem[];
|
|
43
|
+
}
|
|
44
|
+
/** Programmatic API returned alongside the plugin. */
|
|
45
|
+
export interface MainMenuApi {
|
|
46
|
+
/** Overwrite the title span text. */
|
|
47
|
+
setTitle(text: string): void;
|
|
48
|
+
/** Supply items prepended to the dropdown (above static menuItems) on each open. */
|
|
49
|
+
setDynamicItems(fn: () => MenuItem[]): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Creates a main menu plugin instance.
|
|
53
|
+
*
|
|
54
|
+
* Each call returns a fresh plugin — pass one instance per canvas.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createMainMenuPlugin(options?: MainMenuOptions): CanvasPlugin & {
|
|
57
|
+
api: MainMenuApi;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.d.ts.map
|