@miragon/modeler-shell 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +2869 -0
- package/LICENSE +21 -0
- package/README.md +566 -2
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/appearance-BBaM_4bD.d.ts +323 -0
- package/dist/appearance-D3FUcbu6.d.cts +53 -0
- package/dist/appearance-D3FUcbu6.d.ts +53 -0
- package/dist/appearance-XX3JC3pI.d.cts +323 -0
- package/dist/chunk-66HCSJNY.js +2792 -0
- package/dist/chunk-66HCSJNY.js.map +1 -0
- package/dist/chunk-KYDG5DMX.js +136 -0
- package/dist/chunk-KYDG5DMX.js.map +1 -0
- package/dist/chunk-N4QXFF3A.js +23 -0
- package/dist/chunk-N4QXFF3A.js.map +1 -0
- package/dist/chunk-OADW3GPA.js +785 -0
- package/dist/chunk-OADW3GPA.js.map +1 -0
- package/dist/core.cjs +873 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +246 -0
- package/dist/core.d.ts +246 -0
- package/dist/core.js +131 -0
- package/dist/core.js.map +1 -0
- package/dist/diagram-js.cjs +1147 -0
- package/dist/diagram-js.cjs.map +1 -0
- package/dist/diagram-js.d.cts +170 -0
- package/dist/diagram-js.d.ts +170 -0
- package/dist/diagram-js.js +879 -0
- package/dist/diagram-js.js.map +1 -0
- package/dist/index.cjs +3632 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +143 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol-DhYBakWL.d.cts +15 -0
- package/dist/protocol-IeW8bf4f.d.ts +15 -0
- package/dist/shell.css +1603 -0
- package/dist/testing-vscode-stub.cjs +332 -0
- package/dist/testing-vscode-stub.cjs.map +1 -0
- package/dist/testing-vscode-stub.d.cts +65 -0
- package/dist/testing-vscode-stub.d.ts +65 -0
- package/dist/testing-vscode-stub.js +154 -0
- package/dist/testing-vscode-stub.js.map +1 -0
- package/dist/testing.cjs +4663 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +231 -0
- package/dist/testing.d.ts +231 -0
- package/dist/testing.js +4483 -0
- package/dist/testing.js.map +1 -0
- package/dist/toasts-Bp0REqdq.d.cts +142 -0
- package/dist/toasts-Bp0REqdq.d.ts +142 -0
- package/dist/types-CnRrINRs.d.cts +445 -0
- package/dist/types-PuDZczzy.d.ts +445 -0
- package/dist/vscode-extension.cjs +215 -0
- package/dist/vscode-extension.cjs.map +1 -0
- package/dist/vscode-extension.d.cts +103 -0
- package/dist/vscode-extension.d.ts +103 -0
- package/dist/vscode-extension.js +24 -0
- package/dist/vscode-extension.js.map +1 -0
- package/dist/vscode-webview.cjs +3561 -0
- package/dist/vscode-webview.cjs.map +1 -0
- package/dist/vscode-webview.d.cts +84 -0
- package/dist/vscode-webview.d.ts +84 -0
- package/dist/vscode-webview.js +259 -0
- package/dist/vscode-webview.js.map +1 -0
- package/package.json +145 -4
- package/src/core/appearance.ts +104 -0
- package/src/core/feedback/appearance.ts +141 -0
- package/src/core/feedback/problems.ts +23 -0
- package/src/core/feedback/toasts.ts +118 -0
- package/src/core/fit.ts +220 -0
- package/src/core/index.ts +127 -0
- package/src/core/keymap.ts +295 -0
- package/src/core/layout.ts +69 -0
- package/src/core/messages.ts +159 -0
- package/src/core/sizes.ts +85 -0
- package/src/core/types.ts +106 -0
- package/src/core/web-chrome/bottom-row.ts +37 -0
- package/src/core/web-chrome/drop.ts +78 -0
- package/src/core/web-chrome/top-row.ts +66 -0
- package/src/core/zoom.ts +74 -0
- package/src/core.ts +2 -0
- package/src/diagram-js/connect.ts +75 -0
- package/src/diagram-js/index.ts +16 -0
- package/src/diagram-js/module.ts +20 -0
- package/src/diagram-js/palette-skin.ts +267 -0
- package/src/diagram-js/palette.css +269 -0
- package/src/diagram-js/service.ts +243 -0
- package/src/diagram-js/types.ts +67 -0
- package/src/diagram-js/viewport.ts +583 -0
- package/src/diagram-js.ts +2 -0
- package/src/dom/buttons.css +124 -0
- package/src/dom/element.ts +51 -0
- package/src/dom/feedback/appearance.ts +184 -0
- package/src/dom/feedback/feedback.css +435 -0
- package/src/dom/feedback/problems-popover.ts +287 -0
- package/src/dom/feedback/toasts.ts +431 -0
- package/src/dom/hint.ts +51 -0
- package/src/dom/icons.ts +309 -0
- package/src/dom/index.ts +42 -0
- package/src/dom/inspector.ts +35 -0
- package/src/dom/keys.ts +67 -0
- package/src/dom/ledger.ts +87 -0
- package/src/dom/legend.ts +85 -0
- package/src/dom/menu.ts +404 -0
- package/src/dom/mount.ts +731 -0
- package/src/dom/problems.ts +73 -0
- package/src/dom/shell-dom.css +969 -0
- package/src/dom/status.ts +72 -0
- package/src/dom/tooltip.ts +237 -0
- package/src/dom/types.ts +459 -0
- package/src/dom/web/drop-zone.ts +181 -0
- package/src/dom/web/empty-state.ts +144 -0
- package/src/dom/web/legal.ts +75 -0
- package/src/dom/web/menu-groups.ts +69 -0
- package/src/dom/web/primary.ts +124 -0
- package/src/dom/web/web.css +386 -0
- package/src/dom/zoom-panel.ts +154 -0
- package/src/index.ts +3 -0
- package/src/shell.css +9 -0
- package/src/testing/case-tools.ts +164 -0
- package/src/testing/cases.ts +1077 -0
- package/src/testing/checks.ts +868 -0
- package/src/testing/facts.ts +641 -0
- package/src/testing/geometry.ts +652 -0
- package/src/testing/harness.ts +187 -0
- package/src/testing/index.ts +19 -0
- package/src/testing/page-tools.ts +457 -0
- package/src/testing/page.ts +27 -0
- package/src/testing/vscode-stub.ts +237 -0
- package/src/testing/web-cases.ts +913 -0
- package/src/testing/web-checks.ts +1049 -0
- package/src/testing/web-facts.ts +713 -0
- package/src/testing-vscode-stub.ts +2 -0
- package/src/testing.ts +2 -0
- package/src/vscode/extension/html.ts +107 -0
- package/src/vscode/extension/index.ts +8 -0
- package/src/vscode/extension/reveal.ts +9 -0
- package/src/vscode/extension/theme-bridge.ts +85 -0
- package/src/vscode/extension/types.ts +36 -0
- package/src/vscode/protocol.ts +31 -0
- package/src/vscode/webview/appearance.ts +141 -0
- package/src/vscode/webview/index.ts +8 -0
- package/src/vscode/webview/mount.ts +88 -0
- package/src/vscode/webview/state.ts +116 -0
- package/src/vscode-extension.ts +2 -0
- package/src/vscode-webview.ts +2 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { d as ShellHost, Z as ZoomTarget, I as Insets, h as ToastRequest } from './toasts-Bp0REqdq.cjs';
|
|
2
|
+
import { P as Platform, k as ShellMessages, a as AppearanceChoice, i as ProblemItem, S as ShellMessageOverrides, l as ThemeColors } from './appearance-XX3JC3pI.cjs';
|
|
3
|
+
import { T as Theme } from './appearance-D3FUcbu6.cjs';
|
|
4
|
+
|
|
5
|
+
/*! @miragon/modeler-shell icon geometry
|
|
6
|
+
* Lucide (lucide-static 1.59.0) @license ISC
|
|
7
|
+
* Copyright (c) 2026 Lucide Icons and Contributors
|
|
8
|
+
* Derived from Feather, as Lucide's LICENSE lists them: check, circle-x (x-circle), maximize,
|
|
9
|
+
* minus, plus, triangle-alert (alert-triangle) and x. Feather @license MIT
|
|
10
|
+
* Copyright (c) 2013-present Cole Bemis
|
|
11
|
+
* Full notices: THIRD_PARTY_NOTICES.md of @miragon/modeler-shell */
|
|
12
|
+
/** One Lucide icon: its SVG child elements on the 24 × 24 grid. */
|
|
13
|
+
type IconNode = ReadonlyArray<readonly [tag: string, attributes: Readonly<Record<string, string>>]>;
|
|
14
|
+
type ShellIconName = "menu" | "minus" | "plus" | "maximize" | "check" | "x" | "file-plus" | "folder-open" | "import" | "file-image" | "file-code-corner" | "keyboard" | "share-2" | "circle-x" | "triangle-alert" | "square-dashed-mouse-pointer" | "hand" | "line-segment" | "unfold-horizontal" | "workflow";
|
|
15
|
+
declare const ICONS: Readonly<Record<ShellIconName, IconNode>>;
|
|
16
|
+
interface IconOptions {
|
|
17
|
+
/** Rendered width and height in px; default 16 (chrome). */
|
|
18
|
+
size?: number;
|
|
19
|
+
/** Stroke width on the 24 grid; default 2.5. */
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Palette tool icons: 20px with stroke 2 (guide §5.5), as heavy as the 16px chrome icons. */
|
|
24
|
+
declare const PALETTE_TOOL_ICON: Readonly<IconOptions>;
|
|
25
|
+
/**
|
|
26
|
+
* Decorative inline SVG markup (`aria-hidden="true"`, `focusable="false"`, `fill="none"`,
|
|
27
|
+
* `stroke="currentColor"`, round caps and joins). Only Lucide's elements and geometry attributes
|
|
28
|
+
* pass, so the result is safe for `innerHTML` (palette entry `html`).
|
|
29
|
+
*/
|
|
30
|
+
declare function iconMarkup(icon: ShellIconName | IconNode, options?: IconOptions): string;
|
|
31
|
+
/** The same icon as an `SVGSVGElement`. */
|
|
32
|
+
declare function iconElement(icon: ShellIconName | IconNode, options?: IconOptions): SVGSVGElement;
|
|
33
|
+
|
|
34
|
+
interface ShellOptions {
|
|
35
|
+
/** The host column of guide §5.2. */
|
|
36
|
+
host: ShellHost;
|
|
37
|
+
/**
|
|
38
|
+
* The element diagram-js renders into (for example a renderer's `modeler.container`). The shell
|
|
39
|
+
* moves it into its canvas slot and adds `cd-shell-canvas`. Omitted: the shell creates the slot,
|
|
40
|
+
* and the modeler is constructed with `container: handle.canvas`.
|
|
41
|
+
*/
|
|
42
|
+
canvas?: HTMLElement | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The tool's UI language (BCP 47) for `Intl` and `<html lang>` (guide §2: one language per tool).
|
|
45
|
+
* Default in an own document (`ide`, `web`): the closest `[lang]` of the root, else `"en"`. In the
|
|
46
|
+
* `embedded` host the page's language is not the tool's, so the default is the root's own `lang`
|
|
47
|
+
* attribute, else `"en"`, and the root carries `lang` itself.
|
|
48
|
+
*/
|
|
49
|
+
lang?: string | undefined;
|
|
50
|
+
messages?: ShellMessageOverrides | undefined;
|
|
51
|
+
/** Platform of the shortcut labels; default `detectPlatform(navigator)`. */
|
|
52
|
+
platform?: Platform | undefined;
|
|
53
|
+
/** Where the one `keydown` listener sits; default `document`, `root` in the `embedded` host. */
|
|
54
|
+
keyScope?: "document" | "root" | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The modes the modeler can show (a static value of the modeler package), default `["light"]`.
|
|
57
|
+
* Read in the `embedded` and `web` hosts. Embedded: the root carries `data-cd-theme="<themes[0]>"`
|
|
58
|
+
* itself (until the contract's `appearance` surface an embedded modeler stays in its first mode,
|
|
59
|
+
* whatever the page shows) and mirrors the host's `data-cd-kontrast` (guide §13.3). Web: with
|
|
60
|
+
* `"dark"` the shell renders the Appearance group and applies the choice on `<html>` (needs
|
|
61
|
+
* `appearance`); light-only it renders no group. In the `ide` host the host writes the mode.
|
|
62
|
+
*/
|
|
63
|
+
themes?: readonly Theme[] | undefined;
|
|
64
|
+
/** The fixed menu groups this modeler fills (guide §5.4); omitted groups and empty ones collapse. */
|
|
65
|
+
menu?: MenuGroups | undefined;
|
|
66
|
+
/** The problems pill; omitted = the modeler has no diagnostics. */
|
|
67
|
+
problems?: ProblemsOptions | undefined;
|
|
68
|
+
/** The legend card; omitted = the notation has no legend. */
|
|
69
|
+
legend?: LegendOptions | undefined;
|
|
70
|
+
/** The inspector slot; omitted = the modeler has no inspector. */
|
|
71
|
+
inspector?: InspectorOptions | undefined;
|
|
72
|
+
/** The empty-file hint of IDE and embedded hosts (guide §13.5); omitted = no hint. */
|
|
73
|
+
emptyHint?: EmptyHintOptions | undefined;
|
|
74
|
+
/** The primary action at the top right (guide §5.7); omitted = the top right stays empty. */
|
|
75
|
+
primary?: PrimaryActionOptions | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* The legal line at the bottom left (guide §5.10), always rendered in the web host: copyright,
|
|
78
|
+
* Impressum and Datenschutz (`lang="de"`), then `links`.
|
|
79
|
+
*/
|
|
80
|
+
legal?: LegalLineOptions | undefined;
|
|
81
|
+
/** The File group, first in the menu (guide §5.4); omitted = no File group. */
|
|
82
|
+
file?: FileMenuOptions | undefined;
|
|
83
|
+
/** The mode choice of a dark-capable modeler (guide §13.3); required when `themes` includes `"dark"`. */
|
|
84
|
+
appearance?: WebAppearanceOptions | undefined;
|
|
85
|
+
/** The start screen (guide §8 Empty State); omitted = none. Shown by `setEmptyState(true)`. */
|
|
86
|
+
emptyState?: EmptyStateOptions | undefined;
|
|
87
|
+
/** Files dropped anywhere on the page (guide §9 Drag-over, Drop forbidden); omitted = none. */
|
|
88
|
+
dropZone?: DropZoneOptions | undefined;
|
|
89
|
+
}
|
|
90
|
+
/** Rendered in this order, separated by separators: Model, Export, Help (guide §5.4). */
|
|
91
|
+
interface MenuGroups {
|
|
92
|
+
model?: readonly MenuEntry[] | undefined;
|
|
93
|
+
export?: readonly MenuEntry[] | undefined;
|
|
94
|
+
help?: readonly MenuEntry[] | undefined;
|
|
95
|
+
}
|
|
96
|
+
type MenuEntry = MenuActionEntry | MenuDialogEntry | MenuCheckboxEntry | MenuRadioGroup;
|
|
97
|
+
interface MenuItemBase {
|
|
98
|
+
/** Stable id, rendered as `data-menu-id`. */
|
|
99
|
+
id: string;
|
|
100
|
+
label: string;
|
|
101
|
+
/** Only the entries the guide gives an icon (the common set, guide §5.14). */
|
|
102
|
+
icon?: ShellIconName | undefined;
|
|
103
|
+
/** Read whenever the menu opens or `refresh()` runs; disabled entries stay focusable. */
|
|
104
|
+
disabled?: (() => boolean) | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* A Model entry that stays enabled on a read-only canvas: a view-only toggle that never touches
|
|
107
|
+
* the document (Legend, Type captions). Default `false`: the entry is aria-disabled while the
|
|
108
|
+
* canvas is read-only (guide §13.5). The shell's own Legend checkbox sets it.
|
|
109
|
+
*/
|
|
110
|
+
keepEnabledWhenReadOnly?: boolean | undefined;
|
|
111
|
+
}
|
|
112
|
+
/** `menuitem`: closes the menu, returns focus to the trigger, then runs `onSelect`. */
|
|
113
|
+
interface MenuActionEntry extends MenuItemBase {
|
|
114
|
+
kind: "action";
|
|
115
|
+
/** Shortcut chip text shown on the right, verbatim. */
|
|
116
|
+
shortcut?: string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* `aria-keyshortcuts` (WAI-ARIA names, guide §5.6); default `ariaKeyShortcutsFromLabel(shortcut)`.
|
|
119
|
+
* An empty string sets none.
|
|
120
|
+
*/
|
|
121
|
+
ariaKeyShortcuts?: string | undefined;
|
|
122
|
+
/** Destructive: icon in `--cd-ui-danger` (confirm per guide §9 in `onSelect`). */
|
|
123
|
+
danger?: boolean | undefined;
|
|
124
|
+
onSelect(): void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* `menuitem` with `aria-haspopup="dialog"`; its label ends with "…" (U+2026). Behaves like an
|
|
128
|
+
* action: the menu closes and focus returns to the trigger before `onSelect` opens the dialog.
|
|
129
|
+
*/
|
|
130
|
+
interface MenuDialogEntry extends MenuItemBase {
|
|
131
|
+
kind: "dialog";
|
|
132
|
+
/** Shortcut chip text shown on the right, verbatim ("?" for "Keyboard shortcuts…"). */
|
|
133
|
+
shortcut?: string | undefined;
|
|
134
|
+
/** As for `MenuActionEntry`: default `ariaKeyShortcutsFromLabel(shortcut)`, `""` sets none. */
|
|
135
|
+
ariaKeyShortcuts?: string | undefined;
|
|
136
|
+
onSelect(): void;
|
|
137
|
+
}
|
|
138
|
+
/** `menuitemcheckbox`: toggles and keeps the menu open; the check mark carries the state. */
|
|
139
|
+
interface MenuCheckboxEntry extends MenuItemBase {
|
|
140
|
+
kind: "checkbox";
|
|
141
|
+
checked(): boolean;
|
|
142
|
+
onToggle(checked: boolean): void;
|
|
143
|
+
}
|
|
144
|
+
/** A `role="group"` with a heading and `menuitemradio` entries; keeps the menu open. */
|
|
145
|
+
interface MenuRadioGroup {
|
|
146
|
+
kind: "radio";
|
|
147
|
+
id: string;
|
|
148
|
+
/** Heading and group `aria-label`. */
|
|
149
|
+
label: string;
|
|
150
|
+
options: readonly MenuRadioOption[];
|
|
151
|
+
value(): string | undefined;
|
|
152
|
+
onSelect(value: string): void;
|
|
153
|
+
disabled?: (() => boolean) | undefined;
|
|
154
|
+
/** As `MenuItemBase.keepEnabledWhenReadOnly`. */
|
|
155
|
+
keepEnabledWhenReadOnly?: boolean | undefined;
|
|
156
|
+
}
|
|
157
|
+
interface MenuRadioOption {
|
|
158
|
+
value: string;
|
|
159
|
+
label: string;
|
|
160
|
+
}
|
|
161
|
+
interface ProblemsOptions {
|
|
162
|
+
/**
|
|
163
|
+
* A click on the pill where the host has a problems view of its own: the IDE host opens its
|
|
164
|
+
* Problems view (give it there), an embedding host its own list. Ignored in the web host, where
|
|
165
|
+
* the pill opens the problems popover; an embedded shell without it opens the popover as well.
|
|
166
|
+
*/
|
|
167
|
+
onActivate?: (() => void) | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* A click on a row of the problems popover, after the popover closed (guide §5.10): select the
|
|
170
|
+
* element the item names, where there is one.
|
|
171
|
+
*/
|
|
172
|
+
onSelectItem?: ((item: ProblemItem) => void) | undefined;
|
|
173
|
+
}
|
|
174
|
+
interface LegendOptions {
|
|
175
|
+
/** Renders the legend rows into `body` once (classes `cd-shell-legend-*`, see API.md). */
|
|
176
|
+
render(body: HTMLElement): void;
|
|
177
|
+
/** Start state the host remembered; default (also `undefined`) `legendStartsOpen(container height)`. */
|
|
178
|
+
open?: boolean | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Every change of the open state (close button, menu checkbox, `setOpen`, `toggle`), so the host
|
|
181
|
+
* can persist it; not the automatic start decision.
|
|
182
|
+
*/
|
|
183
|
+
onToggle?: ((open: boolean) => void) | undefined;
|
|
184
|
+
/** Append the "Legend" checkbox to the Model group; default `true`. */
|
|
185
|
+
menuEntry?: boolean | undefined;
|
|
186
|
+
}
|
|
187
|
+
interface InspectorOptions {
|
|
188
|
+
/** `aria-label` of the inspector `<aside>`. */
|
|
189
|
+
label: string;
|
|
190
|
+
}
|
|
191
|
+
interface EmptyHintOptions {
|
|
192
|
+
/** Shows the "Insert example" button; the modeler writes the example as one document change. */
|
|
193
|
+
onInsertExample?: (() => void) | undefined;
|
|
194
|
+
}
|
|
195
|
+
interface ShellHandle {
|
|
196
|
+
/** The element passed to `mountShell`, now `.cd-shell`. */
|
|
197
|
+
readonly root: HTMLElement;
|
|
198
|
+
/** The canvas slot (`.cd-shell-canvas`), diagram-js's container. */
|
|
199
|
+
readonly canvas: HTMLElement;
|
|
200
|
+
readonly host: ShellHost;
|
|
201
|
+
readonly lang: string;
|
|
202
|
+
readonly platform: Platform;
|
|
203
|
+
/** The resolved messages table. */
|
|
204
|
+
readonly messages: ShellMessages;
|
|
205
|
+
readonly menu: MenuHandle;
|
|
206
|
+
readonly tooltip: TooltipHandle;
|
|
207
|
+
readonly legend: LegendHandle | undefined;
|
|
208
|
+
readonly inspector: InspectorHandle | undefined;
|
|
209
|
+
/** The web app's primary action; `undefined` without `primary` and outside the web host. */
|
|
210
|
+
readonly primary: PrimaryActionHandle | undefined;
|
|
211
|
+
/** The web app's mode choice; `undefined` outside the web host and for a light-only modeler. */
|
|
212
|
+
readonly appearance: AppearanceHandle | undefined;
|
|
213
|
+
/** Binds zoom panel, readout and chrome keys; `null` unbinds (buttons disabled). */
|
|
214
|
+
setZoomTarget(target: ZoomTarget | null): void;
|
|
215
|
+
/** The fit insets for what is open right now (palette row, legend, inspector, pill). */
|
|
216
|
+
fitInsets(): Insets;
|
|
217
|
+
/** Adapter API: the diagram-js palette island; returns the unregister function. */
|
|
218
|
+
registerPalette(palette: PaletteRegistration): () => void;
|
|
219
|
+
/** Shows the pill for `count > 0`, hides it at 0. */
|
|
220
|
+
setProblems(summary: ProblemSummary): void;
|
|
221
|
+
/** Shows (after `delayMs`, default 0) or hides (at once) the status box under the palette. */
|
|
222
|
+
setStatus(status: StatusMessage | null, options?: {
|
|
223
|
+
delayMs?: number | undefined;
|
|
224
|
+
}): void;
|
|
225
|
+
/**
|
|
226
|
+
* Shows or hides the empty-file hint. `connectDiagramJs` keeps it in sync with the diagram
|
|
227
|
+
* (`ConnectOptions.isEmpty`). Hiding it while it holds the focus moves the focus to the canvas.
|
|
228
|
+
*/
|
|
229
|
+
setEmptyHint(visible: boolean): void;
|
|
230
|
+
/**
|
|
231
|
+
* Read-only canvas (invalid file, guide §13.5). `true` locks at once: `isReadOnly()`, the palette
|
|
232
|
+
* veto (every entry but Lasso and Hand) and the Model entries of the menu without
|
|
233
|
+
* `keepEnabledWhenReadOnly`; the legend and its Legend checkbox stay usable. `data-readonly` and the
|
|
234
|
+
* `aria-disabled` palette entries show after `delayMs` (default 0; an invalid file passes
|
|
235
|
+
* `INVALID_STATUS_DELAY_MS`, as for `setStatus`), so typing in the text editor does not flicker.
|
|
236
|
+
* Repeated calls while the delay runs keep the first timer; `false` unlocks and hides at once.
|
|
237
|
+
*/
|
|
238
|
+
setReadOnly(readOnly: boolean, options?: {
|
|
239
|
+
delayMs?: number | undefined;
|
|
240
|
+
}): void;
|
|
241
|
+
/** The lock, true from the first `setReadOnly(true)` on, also while its marks are still delayed. */
|
|
242
|
+
isReadOnly(): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Shows or hides the web app's start screen (guide §8): while it shows, menu trigger, primary
|
|
245
|
+
* action, palette, zoom panel, pill, legend, status box, hint and inspector are hidden, the canvas
|
|
246
|
+
* slot is `inert` and the chrome keys do nothing; the legal line, toasts and the drop zone stay.
|
|
247
|
+
* A no-op without `emptyState`. Hiding it while it holds the focus moves the focus to the canvas.
|
|
248
|
+
*/
|
|
249
|
+
setEmptyState(shown: boolean): void;
|
|
250
|
+
isEmptyStateShown(): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Shows a toast (guide §8, §9) in the web and embedded hosts: bottom centre, at most three, the
|
|
253
|
+
* newest at the bottom, closing by itself after `toastLifetime` unless hovered or focused. In the
|
|
254
|
+
* `ide` host it shows nothing and returns an inert handle: there the extension shows the host's
|
|
255
|
+
* notification (§13.5).
|
|
256
|
+
*/
|
|
257
|
+
toast(request: ToastRequest): ToastHandle;
|
|
258
|
+
/** Removes every element, attribute, listener, observer and timer the shell added. Idempotent. */
|
|
259
|
+
destroy(): void;
|
|
260
|
+
}
|
|
261
|
+
interface MenuHandle {
|
|
262
|
+
readonly trigger: HTMLButtonElement;
|
|
263
|
+
readonly dropdown: HTMLElement;
|
|
264
|
+
isOpen(): boolean;
|
|
265
|
+
/** Opens on the first (default) or last entry. */
|
|
266
|
+
open(focus?: "first" | "last"): void;
|
|
267
|
+
/** Closes; `restoreFocus` moves focus back to the trigger (default `false`). */
|
|
268
|
+
close(options?: {
|
|
269
|
+
restoreFocus?: boolean | undefined;
|
|
270
|
+
}): void;
|
|
271
|
+
/** Re-reads `checked`, `value` and `disabled` (call after an external state change). */
|
|
272
|
+
refresh(): void;
|
|
273
|
+
setGroups(groups: MenuGroups): void;
|
|
274
|
+
}
|
|
275
|
+
interface TooltipContent {
|
|
276
|
+
label: string;
|
|
277
|
+
/** Shortcut chip text, verbatim (`⌘+`). */
|
|
278
|
+
shortcut?: string | undefined;
|
|
279
|
+
}
|
|
280
|
+
interface TooltipHandle {
|
|
281
|
+
/**
|
|
282
|
+
* The chrome tooltip for `control`: after `TOOLTIP_DELAY_MS` hover, at once on keyboard focus,
|
|
283
|
+
* hidden on click, Escape, leave and menu open. Returns the detach function.
|
|
284
|
+
*/
|
|
285
|
+
attach(control: HTMLElement, content: TooltipContent | (() => TooltipContent | null)): () => void;
|
|
286
|
+
hide(): void;
|
|
287
|
+
}
|
|
288
|
+
interface LegendHandle {
|
|
289
|
+
/** The legend card (`[data-chrome="legend"]`). */
|
|
290
|
+
readonly element: HTMLElement;
|
|
291
|
+
/** Where `render` put the rows. */
|
|
292
|
+
readonly body: HTMLElement;
|
|
293
|
+
isOpen(): boolean;
|
|
294
|
+
setOpen(open: boolean): void;
|
|
295
|
+
toggle(): void;
|
|
296
|
+
}
|
|
297
|
+
interface InspectorHandle {
|
|
298
|
+
/** The `<aside data-chrome="inspector">`; the modeler renders its fields into it. */
|
|
299
|
+
readonly element: HTMLElement;
|
|
300
|
+
isOpen(): boolean;
|
|
301
|
+
open(): void;
|
|
302
|
+
/** Closes; a focus inside it moves to the canvas. */
|
|
303
|
+
close(): void;
|
|
304
|
+
}
|
|
305
|
+
/** What the diagram-js adapter hands the shell about the palette. */
|
|
306
|
+
interface PaletteRegistration {
|
|
307
|
+
/** The `.djs-palette` element (already carrying `data-chrome="palette"`). */
|
|
308
|
+
element: HTMLElement;
|
|
309
|
+
/** Tooltip of an entry element (`.entry`), from `palette.getEntries()` title and shortcut. */
|
|
310
|
+
entryTooltip(entry: HTMLElement): TooltipContent | null;
|
|
311
|
+
/** The read-only state, on registration and on every `setReadOnly` and its delayed marks. */
|
|
312
|
+
setReadOnly(state: PaletteReadOnlyState): void;
|
|
313
|
+
}
|
|
314
|
+
/** The read-only canvas as the palette sees it (guide §13.5). */
|
|
315
|
+
interface PaletteReadOnlyState {
|
|
316
|
+
/** Veto every entry but Lasso and Hand on `palette.trigger`, from the invalid import on. */
|
|
317
|
+
locked: boolean;
|
|
318
|
+
/** Mark those entries `aria-disabled` and muted, once the shell's delay has passed. */
|
|
319
|
+
shown: boolean;
|
|
320
|
+
}
|
|
321
|
+
interface ProblemSummary {
|
|
322
|
+
count: number;
|
|
323
|
+
/** How many of them are errors; decides icon and wording. */
|
|
324
|
+
errors: number;
|
|
325
|
+
/**
|
|
326
|
+
* The rows of the problems popover (web, embedded without `onActivate`), in this order; the IDE
|
|
327
|
+
* host ignores them. `problemSummary(items)` builds the whole summary from them.
|
|
328
|
+
*/
|
|
329
|
+
items?: readonly ProblemItem[] | undefined;
|
|
330
|
+
}
|
|
331
|
+
type StatusSeverity = "danger" | "warning";
|
|
332
|
+
interface StatusMessage {
|
|
333
|
+
severity: StatusSeverity;
|
|
334
|
+
text: string;
|
|
335
|
+
}
|
|
336
|
+
/** The web app's primary action (guide §5.7): a blue primary button, icon and label, at the top right. */
|
|
337
|
+
interface PrimaryActionOptions {
|
|
338
|
+
/** Label and `aria-label`; default `messages.share` ("Share"). */
|
|
339
|
+
label?: string | undefined;
|
|
340
|
+
/** Default `"share-2"`. */
|
|
341
|
+
icon?: ShellIconName | undefined;
|
|
342
|
+
onSelect(): void;
|
|
343
|
+
/** Read on mount and on `primary.refresh()`; disabled stays focusable (`aria-disabled`). */
|
|
344
|
+
disabled?: (() => boolean) | undefined;
|
|
345
|
+
}
|
|
346
|
+
interface PrimaryActionHandle {
|
|
347
|
+
/** The `<button data-chrome="primary">`. */
|
|
348
|
+
readonly element: HTMLButtonElement;
|
|
349
|
+
/** True while the label is collapsed to the icon (guide §5.15); the root then carries `data-primary="collapsed"`. */
|
|
350
|
+
isCollapsed(): boolean;
|
|
351
|
+
/** Re-reads `disabled()`. */
|
|
352
|
+
refresh(): void;
|
|
353
|
+
}
|
|
354
|
+
/** A link of the legal line after Impressum and Datenschutz. */
|
|
355
|
+
interface LegalLink {
|
|
356
|
+
label: string;
|
|
357
|
+
href: string;
|
|
358
|
+
/** For a label in another language than the tool's. */
|
|
359
|
+
lang?: string | undefined;
|
|
360
|
+
}
|
|
361
|
+
interface LegalLineOptions {
|
|
362
|
+
/** After Impressum and Datenschutz: `{ label: "GitHub", href: "https://github.com/Miragon/…" }`. */
|
|
363
|
+
links?: readonly LegalLink[] | undefined;
|
|
364
|
+
/** The copyright year; default the current year at mount. */
|
|
365
|
+
year?: number | undefined;
|
|
366
|
+
}
|
|
367
|
+
/** One entry of the File group; label and icon come from the shell (guide §2, §5.4). */
|
|
368
|
+
interface FileMenuAction {
|
|
369
|
+
onSelect(): void;
|
|
370
|
+
/** Shortcut chip, e.g. "⌘O"; the web app binds the key itself. */
|
|
371
|
+
shortcut?: string | undefined;
|
|
372
|
+
/** `kind: "dialog"` (`aria-haspopup="dialog"`) when it opens an in-page dialog, not the browser's file picker. */
|
|
373
|
+
dialog?: boolean | undefined;
|
|
374
|
+
disabled?: (() => boolean) | undefined;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The File group of the web app (guide §5.4), in this order, as far as the modeler has them:
|
|
378
|
+
* "New diagram" (`file-plus`), "Open…" (`folder-open`), "Show example", "Import…" (`import`).
|
|
379
|
+
* Menu ids `new-diagram`, `open`, `show-example`, `import`, `data-menu-group="file"`.
|
|
380
|
+
*/
|
|
381
|
+
interface FileMenuOptions {
|
|
382
|
+
newDiagram?: FileMenuAction | undefined;
|
|
383
|
+
open?: FileMenuAction | undefined;
|
|
384
|
+
showExample?: FileMenuAction | undefined;
|
|
385
|
+
import?: FileMenuAction | undefined;
|
|
386
|
+
}
|
|
387
|
+
/** What `localStorage` offers; a blocked storage throws, the shell catches it. */
|
|
388
|
+
interface StorageLike {
|
|
389
|
+
getItem(key: string): string | null;
|
|
390
|
+
setItem(key: string, value: string): void;
|
|
391
|
+
removeItem(key: string): void;
|
|
392
|
+
}
|
|
393
|
+
interface WebAppearanceOptions {
|
|
394
|
+
/** The two `theme-color` values from the vendored token JSON (see `ThemeColors`). */
|
|
395
|
+
themeColors: ThemeColors;
|
|
396
|
+
/** Default `globalThis.localStorage`. */
|
|
397
|
+
storage?: StorageLike | undefined;
|
|
398
|
+
}
|
|
399
|
+
/** The mode choice of a dark-capable web app (guide §13.3), as the Appearance group drives it. */
|
|
400
|
+
interface AppearanceHandle {
|
|
401
|
+
/** The stored choice, `"system"` without one. */
|
|
402
|
+
choice(): AppearanceChoice;
|
|
403
|
+
/**
|
|
404
|
+
* Stores the choice (`"system"` removes `APPEARANCE_STORAGE_KEY`) and applies `documentMode` on
|
|
405
|
+
* `<html>` and the metas in one step, with `cd-shell-no-transition` for one frame (guide §7).
|
|
406
|
+
*/
|
|
407
|
+
setChoice(choice: AppearanceChoice): void;
|
|
408
|
+
}
|
|
409
|
+
/** The web app's start screen (guide §8): a centred glass card with the Komet and two actions. */
|
|
410
|
+
interface EmptyStateOptions {
|
|
411
|
+
/** The card's title (h1, 21px/600), the modeler's name: "Event Storming Modeler". */
|
|
412
|
+
title: string;
|
|
413
|
+
/** One line of help (16px/1.6, `--cd-ui-text-leise`): "Start a new diagram, or explore the example." */
|
|
414
|
+
text: string;
|
|
415
|
+
/**
|
|
416
|
+
* URL of the official Miragon icon `miragon-komet-blau.svg`, vendored unchanged from
|
|
417
|
+
* `Miragon/corporate-identity` (guide §2, §11), shown at 64px with `alt=""`.
|
|
418
|
+
*/
|
|
419
|
+
komet: string;
|
|
420
|
+
/** "New diagram", the blue primary button. The shell hides the card first. */
|
|
421
|
+
onNewDiagram(): void;
|
|
422
|
+
/** "Show example", the ghost button; omitted = no example button. The shell hides the card first. */
|
|
423
|
+
onShowExample?: (() => void) | undefined;
|
|
424
|
+
/** The drag-and-drop hint (13px, `--cd-ui-text-leise`), shown with a `dropZone` only; default `messages.dropHint`. */
|
|
425
|
+
dropHint?: string | undefined;
|
|
426
|
+
}
|
|
427
|
+
interface DropZoneOptions {
|
|
428
|
+
/**
|
|
429
|
+
* Like `<input accept>`: extensions (".storm") and MIME types ("application/json", "text/*").
|
|
430
|
+
* List the MIME types too, so a drag can already show a foreign type as forbidden. Empty = any file.
|
|
431
|
+
*/
|
|
432
|
+
accept: readonly string[];
|
|
433
|
+
/** Default `false`: a drag with more than one file is forbidden. */
|
|
434
|
+
multiple?: boolean | undefined;
|
|
435
|
+
/** The dropped files that match `accept` (one unless `multiple`). */
|
|
436
|
+
onDrop(files: readonly File[]): void;
|
|
437
|
+
/** The dropped files outside `accept`; default a danger toast `messages.cannotOpenFile`. */
|
|
438
|
+
onReject?: ((files: readonly File[]) => void) | undefined;
|
|
439
|
+
}
|
|
440
|
+
interface ToastHandle {
|
|
441
|
+
/** Closes the toast (slide and fade out); a second call does nothing. */
|
|
442
|
+
dismiss(): void;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export { type AppearanceHandle as A, type StorageLike as B, type TooltipContent as C, type DropZoneOptions as D, type EmptyHintOptions as E, type FileMenuAction as F, type TooltipHandle as G, iconElement as H, ICONS as I, iconMarkup as J, type LegalLineOptions as L, type MenuActionEntry as M, PALETTE_TOOL_ICON as P, type ShellOptions as S, type ToastHandle as T, type WebAppearanceOptions as W, type ShellHandle as a, type EmptyStateOptions as b, type FileMenuOptions as c, type IconNode as d, type IconOptions as e, type InspectorHandle as f, type InspectorOptions as g, type LegalLink as h, type LegendHandle as i, type LegendOptions as j, type MenuCheckboxEntry as k, type MenuDialogEntry as l, type MenuEntry as m, type MenuGroups as n, type MenuHandle as o, type MenuRadioGroup as p, type MenuRadioOption as q, type PaletteReadOnlyState as r, type PaletteRegistration as s, type PrimaryActionHandle as t, type PrimaryActionOptions as u, type ProblemSummary as v, type ProblemsOptions as w, type ShellIconName as x, type StatusMessage as y, type StatusSeverity as z };
|