@miragon/modeler-shell 0.0.0-stage → 0.1.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 +1902 -0
- package/LICENSE +21 -0
- package/README.md +435 -2
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/dist/appearance-D3FUcbu6.d.cts +53 -0
- package/dist/appearance-D3FUcbu6.d.ts +53 -0
- package/dist/chunk-5JSZ4VGA.js +551 -0
- package/dist/chunk-5JSZ4VGA.js.map +1 -0
- package/dist/chunk-6LQOFACK.js +1576 -0
- package/dist/chunk-6LQOFACK.js.map +1 -0
- package/dist/chunk-N4QXFF3A.js +23 -0
- package/dist/chunk-N4QXFF3A.js.map +1 -0
- package/dist/chunk-RJRFR6N3.js +136 -0
- package/dist/chunk-RJRFR6N3.js.map +1 -0
- package/dist/core.cjs +619 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +171 -0
- package/dist/core.d.ts +171 -0
- package/dist/core.js +91 -0
- package/dist/core.js.map +1 -0
- package/dist/diagram-js.cjs +1115 -0
- package/dist/diagram-js.cjs.map +1 -0
- package/dist/diagram-js.d.cts +163 -0
- package/dist/diagram-js.d.ts +163 -0
- package/dist/diagram-js.js +867 -0
- package/dist/diagram-js.js.map +1 -0
- package/dist/index.cjs +2175 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +103 -0
- package/dist/index.js.map +1 -0
- package/dist/keymap-CObQE6q6.d.cts +151 -0
- package/dist/keymap-DORzHnK-.d.ts +151 -0
- package/dist/protocol-DhYBakWL.d.cts +15 -0
- package/dist/protocol-IeW8bf4f.d.ts +15 -0
- package/dist/shell.css +914 -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 +2364 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +165 -0
- package/dist/testing.d.ts +165 -0
- package/dist/testing.js +2297 -0
- package/dist/testing.js.map +1 -0
- package/dist/types-B6NfkiUG.d.cts +66 -0
- package/dist/types-B6NfkiUG.d.ts +66 -0
- package/dist/types-DnZn9CPw.d.ts +284 -0
- package/dist/types-OuFlqZp0.d.cts +284 -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 +2198 -0
- package/dist/vscode-webview.cjs.map +1 -0
- package/dist/vscode-webview.d.cts +82 -0
- package/dist/vscode-webview.d.ts +82 -0
- package/dist/vscode-webview.js +250 -0
- package/dist/vscode-webview.js.map +1 -0
- package/package.json +145 -4
- package/src/core/appearance.ts +104 -0
- package/src/core/fit.ts +205 -0
- package/src/core/index.ts +84 -0
- package/src/core/keymap.ts +275 -0
- package/src/core/layout.ts +69 -0
- package/src/core/messages.ts +88 -0
- package/src/core/sizes.ts +85 -0
- package/src/core/types.ts +84 -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 +240 -0
- package/src/diagram-js/types.ts +67 -0
- package/src/diagram-js/viewport.ts +564 -0
- package/src/diagram-js.ts +2 -0
- package/src/dom/element.ts +51 -0
- package/src/dom/hint.ts +51 -0
- package/src/dom/icons.ts +309 -0
- package/src/dom/index.ts +29 -0
- package/src/dom/inspector.ts +35 -0
- package/src/dom/keys.ts +59 -0
- package/src/dom/ledger.ts +87 -0
- package/src/dom/legend.ts +85 -0
- package/src/dom/menu.ts +393 -0
- package/src/dom/mount.ts +461 -0
- package/src/dom/problems.ts +72 -0
- package/src/dom/shell-dom.css +966 -0
- package/src/dom/status.ts +72 -0
- package/src/dom/tooltip.ts +237 -0
- package/src/dom/types.ts +277 -0
- package/src/dom/zoom-panel.ts +154 -0
- package/src/index.ts +3 -0
- package/src/shell.css +6 -0
- package/src/testing/cases.ts +1012 -0
- package/src/testing/checks.ts +832 -0
- package/src/testing/facts.ts +587 -0
- package/src/testing/geometry.ts +472 -0
- package/src/testing/harness.ts +138 -0
- package/src/testing/index.ts +15 -0
- package/src/testing/page-tools.ts +434 -0
- package/src/testing/page.ts +17 -0
- package/src/testing/vscode-stub.ts +237 -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 +76 -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,165 @@
|
|
|
1
|
+
import { d as Size, P as PaletteRow, a as ChromeIsland, c as ShellHost } from './types-B6NfkiUG.cjs';
|
|
2
|
+
import { A as Appearance, T as Theme, C as ColorThemeSetting } from './appearance-D3FUcbu6.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The part of Playwright's `Page` the kit drives, typed structurally: the kit has no runtime
|
|
6
|
+
* dependency on Playwright, the consumer's e2e suite passes its own `page`.
|
|
7
|
+
*/
|
|
8
|
+
interface PageLike {
|
|
9
|
+
evaluate<R, Arg>(pageFunction: (arg: Arg) => R | Promise<R>, arg: Arg): Promise<R>;
|
|
10
|
+
setViewportSize(size: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
keyboard: {
|
|
15
|
+
press(key: string): Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
mouse: {
|
|
18
|
+
click(x: number, y: number): Promise<void>;
|
|
19
|
+
dblclick(x: number, y: number): Promise<void>;
|
|
20
|
+
move(x: number, y: number): Promise<void>;
|
|
21
|
+
down(): Promise<void>;
|
|
22
|
+
up(): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
waitForTimeout(timeout: number): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Every island box must match within this many pixels (guide §13.4). */
|
|
28
|
+
declare const GEOMETRY_TOLERANCE_PX = 1;
|
|
29
|
+
/**
|
|
30
|
+
* `getBoundingClientRect()` relative to the shell root's padding box, where its absolutely
|
|
31
|
+
* positioned islands anchor (a border on the root, as in a framed foreign page, does not count).
|
|
32
|
+
*/
|
|
33
|
+
interface IslandBox {
|
|
34
|
+
left: number;
|
|
35
|
+
top: number;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
}
|
|
39
|
+
interface ChromeMeasurement {
|
|
40
|
+
container: Size;
|
|
41
|
+
/** From the root's `data-palette` attribute. */
|
|
42
|
+
paletteRow: PaletteRow;
|
|
43
|
+
/** The visible islands, found by `[data-chrome]`. */
|
|
44
|
+
islands: Partial<Record<ChromeIsland, IslandBox>>;
|
|
45
|
+
/** `[data-legend="open"]`, `[data-inspector="open"]`, `[data-problems="shown"]` on the root. */
|
|
46
|
+
open: {
|
|
47
|
+
legend: boolean;
|
|
48
|
+
inspector: boolean;
|
|
49
|
+
problems: boolean;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Constraints of one island; every given field must hold within `GEOMETRY_TOLERANCE_PX`. */
|
|
53
|
+
interface ExpectedBox {
|
|
54
|
+
left?: number;
|
|
55
|
+
top?: number;
|
|
56
|
+
right?: number;
|
|
57
|
+
bottom?: number;
|
|
58
|
+
width?: number;
|
|
59
|
+
height?: number;
|
|
60
|
+
/** Horizontal centre relative to the root. */
|
|
61
|
+
centerX?: number;
|
|
62
|
+
}
|
|
63
|
+
/** Measures the islands of the shell under `root` (default `.cd-shell`) in the page. */
|
|
64
|
+
declare function measureChrome(page: PageLike, root?: string): Promise<ChromeMeasurement>;
|
|
65
|
+
/** The boxes guide §5.2–§5.12 expects for what was measured (anchors per host and breakpoint). */
|
|
66
|
+
declare function expectedChromeBoxes(measurement: ChromeMeasurement, host: ShellHost): Partial<Record<ChromeIsland, ExpectedBox>>;
|
|
67
|
+
|
|
68
|
+
interface OpenContext {
|
|
69
|
+
/** The page's viewport, which is the modeler's container in an own document. */
|
|
70
|
+
size: Size;
|
|
71
|
+
/**
|
|
72
|
+
* What the host requests before the modeler resolves it: in an IDE host the VS Code color theme
|
|
73
|
+
* (`vsCodeStubSearch` hands it to a page with the VS Code stub). For an embedded host the kit
|
|
74
|
+
* itself puts the foreign page's `<html>` in this mode once `open` resolved.
|
|
75
|
+
*/
|
|
76
|
+
requested: Appearance;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* How the kit makes the optional islands visible (`geometry`, `aria`) and puts the modeler into its
|
|
80
|
+
* invalid-file state (`readOnly`).
|
|
81
|
+
*/
|
|
82
|
+
interface ShowHooks<P extends PageLike = PageLike> {
|
|
83
|
+
problems?: ((page: P) => Promise<void>) | undefined;
|
|
84
|
+
status?: ((page: P) => Promise<void>) | undefined;
|
|
85
|
+
legend?: ((page: P) => Promise<void>) | undefined;
|
|
86
|
+
inspector?: ((page: P) => Promise<void>) | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Puts the modeler into its invalid-file state the way its host does (an invalid import): a
|
|
89
|
+
* read-only canvas and the status box. The kit waits `INVALID_STATUS_DELAY_MS` afterwards.
|
|
90
|
+
*/
|
|
91
|
+
invalid?: ((page: P) => Promise<void>) | undefined;
|
|
92
|
+
}
|
|
93
|
+
/** A show hook by name: the islands `legend`, `inspector`, `problems`, `status` and the state `invalid`. */
|
|
94
|
+
type ShowHook = keyof ShowHooks;
|
|
95
|
+
interface ShellConformanceHarness<P extends PageLike = PageLike> {
|
|
96
|
+
host: ShellHost;
|
|
97
|
+
/** The modes the modeler declares (static); the appearance case requests dark from `["light"]`. */
|
|
98
|
+
themes: readonly Theme[];
|
|
99
|
+
/** Load the modeler with the shell at `size`, as the host would with `requested`; resolve once the first import is done. */
|
|
100
|
+
open(page: P, context: OpenContext): Promise<void>;
|
|
101
|
+
/** Tear modeler and shell down through the page's own path; `undefined` skips the cleanup case. */
|
|
102
|
+
destroy?: ((page: P) => Promise<void>) | undefined;
|
|
103
|
+
/** CSS selector of the shell root; default `.cd-shell`. */
|
|
104
|
+
root?: string | undefined;
|
|
105
|
+
/** Hooks for the islands and states the modeler has; one that is neither given nor `absent` is reported as skipped. */
|
|
106
|
+
show?: ShowHooks<P> | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The islands and states the modeler does not have. An absent hook is not reported as skipped,
|
|
109
|
+
* and `geometry` and `aria` assert that its island is never visible. Listing a hook that `show`
|
|
110
|
+
* also gives fails every case that uses it.
|
|
111
|
+
*/
|
|
112
|
+
absent?: readonly ShowHook[] | undefined;
|
|
113
|
+
/** Container sizes of the geometry case; default wide 1280 × 900, narrow 720 × 700, very narrow 420 × 700. */
|
|
114
|
+
sizes?: readonly Size[] | undefined;
|
|
115
|
+
}
|
|
116
|
+
/** One part of a case the harness could not feed. */
|
|
117
|
+
interface ShellSkip {
|
|
118
|
+
/**
|
|
119
|
+
* The harness field that would feed it: a show hook, `destroy`, or `open` when the document it
|
|
120
|
+
* opens lacks what the case needs (a shape on the canvas).
|
|
121
|
+
*/
|
|
122
|
+
hook: ShowHook | "destroy" | "open";
|
|
123
|
+
reason: string;
|
|
124
|
+
}
|
|
125
|
+
interface ShellCaseOutcome {
|
|
126
|
+
/** What the case could not (fully) run, one entry per missing harness field. */
|
|
127
|
+
skipped?: readonly ShellSkip[];
|
|
128
|
+
}
|
|
129
|
+
interface ShellConformanceCase {
|
|
130
|
+
name: string;
|
|
131
|
+
run<P extends PageLike>(page: P, harness: ShellConformanceHarness<P>): Promise<ShellCaseOutcome | void>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The cases: `geometry` (every `data-chrome` island ±1px, per host and breakpoint), `aria`
|
|
135
|
+
* (roles, names, `aria-expanded`/`-controls`/`-keyshortcuts`/`-disabled`, DOM order, no positive
|
|
136
|
+
* tabindex), `keys` (each chrome key acts exactly once; in the IDE host a `keydown` listener on
|
|
137
|
+
* `window` never fires for a handled key; unmodified `+`/`-` never zoom; select all acts on the
|
|
138
|
+
* canvas only), `create` (Enter on the first creating palette entry places one selected element in
|
|
139
|
+
* the free rectangle and focuses the canvas), `readOnly` (the invalid-file lock of guide §13.5),
|
|
140
|
+
* `appearance` (dark requested from a light-only modeler: nothing turns dark, `color-scheme` light
|
|
141
|
+
* everywhere, the canvas surround and the palette's tool colours from the roles) and `cleanup` (after
|
|
142
|
+
* `destroy` no shell element, class, attribute or key handling remains).
|
|
143
|
+
*/
|
|
144
|
+
declare function shellConformanceCases(): ShellConformanceCase[];
|
|
145
|
+
/** Playwright's `test` (or any runner whose body receives `{ page }`). */
|
|
146
|
+
type ShellConformanceTest<P extends PageLike = PageLike> = (name: string, body: (fixtures: {
|
|
147
|
+
page: P;
|
|
148
|
+
}) => Promise<void>) => unknown;
|
|
149
|
+
interface RegisterShellConformanceOptions {
|
|
150
|
+
/** Default: `console.warn`, one line per case with its skips joined by "; ". */
|
|
151
|
+
onSkip?: ((caseName: string, skips: readonly ShellSkip[]) => void) | undefined;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The query string for a test page that installs the VS Code stub of
|
|
155
|
+
* `@miragon/modeler-shell/testing/vscode-stub` with `stubOptionsFromSearch(location.search)`:
|
|
156
|
+
* `theme=dark&kontrast=hoch`, plus the `colorTheme` setting and VS Code's reduce motion.
|
|
157
|
+
*/
|
|
158
|
+
declare function vsCodeStubSearch(requested: Appearance, extra?: {
|
|
159
|
+
colorTheme?: ColorThemeSetting | undefined;
|
|
160
|
+
reduceMotion?: boolean | undefined;
|
|
161
|
+
}): string;
|
|
162
|
+
/** Registers every case as `shell conformance: <name>`. */
|
|
163
|
+
declare function registerShellConformance<P extends PageLike>(harness: ShellConformanceHarness<P>, test: ShellConformanceTest<P>, options?: RegisterShellConformanceOptions): void;
|
|
164
|
+
|
|
165
|
+
export { type ChromeMeasurement, type ExpectedBox, GEOMETRY_TOLERANCE_PX, type IslandBox, type OpenContext, type PageLike, type RegisterShellConformanceOptions, type ShellCaseOutcome, type ShellConformanceCase, type ShellConformanceHarness, type ShellConformanceTest, type ShellSkip, type ShowHook, type ShowHooks, expectedChromeBoxes, measureChrome, registerShellConformance, shellConformanceCases, vsCodeStubSearch };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { d as Size, P as PaletteRow, a as ChromeIsland, c as ShellHost } from './types-B6NfkiUG.js';
|
|
2
|
+
import { A as Appearance, T as Theme, C as ColorThemeSetting } from './appearance-D3FUcbu6.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The part of Playwright's `Page` the kit drives, typed structurally: the kit has no runtime
|
|
6
|
+
* dependency on Playwright, the consumer's e2e suite passes its own `page`.
|
|
7
|
+
*/
|
|
8
|
+
interface PageLike {
|
|
9
|
+
evaluate<R, Arg>(pageFunction: (arg: Arg) => R | Promise<R>, arg: Arg): Promise<R>;
|
|
10
|
+
setViewportSize(size: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
keyboard: {
|
|
15
|
+
press(key: string): Promise<void>;
|
|
16
|
+
};
|
|
17
|
+
mouse: {
|
|
18
|
+
click(x: number, y: number): Promise<void>;
|
|
19
|
+
dblclick(x: number, y: number): Promise<void>;
|
|
20
|
+
move(x: number, y: number): Promise<void>;
|
|
21
|
+
down(): Promise<void>;
|
|
22
|
+
up(): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
waitForTimeout(timeout: number): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Every island box must match within this many pixels (guide §13.4). */
|
|
28
|
+
declare const GEOMETRY_TOLERANCE_PX = 1;
|
|
29
|
+
/**
|
|
30
|
+
* `getBoundingClientRect()` relative to the shell root's padding box, where its absolutely
|
|
31
|
+
* positioned islands anchor (a border on the root, as in a framed foreign page, does not count).
|
|
32
|
+
*/
|
|
33
|
+
interface IslandBox {
|
|
34
|
+
left: number;
|
|
35
|
+
top: number;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
}
|
|
39
|
+
interface ChromeMeasurement {
|
|
40
|
+
container: Size;
|
|
41
|
+
/** From the root's `data-palette` attribute. */
|
|
42
|
+
paletteRow: PaletteRow;
|
|
43
|
+
/** The visible islands, found by `[data-chrome]`. */
|
|
44
|
+
islands: Partial<Record<ChromeIsland, IslandBox>>;
|
|
45
|
+
/** `[data-legend="open"]`, `[data-inspector="open"]`, `[data-problems="shown"]` on the root. */
|
|
46
|
+
open: {
|
|
47
|
+
legend: boolean;
|
|
48
|
+
inspector: boolean;
|
|
49
|
+
problems: boolean;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Constraints of one island; every given field must hold within `GEOMETRY_TOLERANCE_PX`. */
|
|
53
|
+
interface ExpectedBox {
|
|
54
|
+
left?: number;
|
|
55
|
+
top?: number;
|
|
56
|
+
right?: number;
|
|
57
|
+
bottom?: number;
|
|
58
|
+
width?: number;
|
|
59
|
+
height?: number;
|
|
60
|
+
/** Horizontal centre relative to the root. */
|
|
61
|
+
centerX?: number;
|
|
62
|
+
}
|
|
63
|
+
/** Measures the islands of the shell under `root` (default `.cd-shell`) in the page. */
|
|
64
|
+
declare function measureChrome(page: PageLike, root?: string): Promise<ChromeMeasurement>;
|
|
65
|
+
/** The boxes guide §5.2–§5.12 expects for what was measured (anchors per host and breakpoint). */
|
|
66
|
+
declare function expectedChromeBoxes(measurement: ChromeMeasurement, host: ShellHost): Partial<Record<ChromeIsland, ExpectedBox>>;
|
|
67
|
+
|
|
68
|
+
interface OpenContext {
|
|
69
|
+
/** The page's viewport, which is the modeler's container in an own document. */
|
|
70
|
+
size: Size;
|
|
71
|
+
/**
|
|
72
|
+
* What the host requests before the modeler resolves it: in an IDE host the VS Code color theme
|
|
73
|
+
* (`vsCodeStubSearch` hands it to a page with the VS Code stub). For an embedded host the kit
|
|
74
|
+
* itself puts the foreign page's `<html>` in this mode once `open` resolved.
|
|
75
|
+
*/
|
|
76
|
+
requested: Appearance;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* How the kit makes the optional islands visible (`geometry`, `aria`) and puts the modeler into its
|
|
80
|
+
* invalid-file state (`readOnly`).
|
|
81
|
+
*/
|
|
82
|
+
interface ShowHooks<P extends PageLike = PageLike> {
|
|
83
|
+
problems?: ((page: P) => Promise<void>) | undefined;
|
|
84
|
+
status?: ((page: P) => Promise<void>) | undefined;
|
|
85
|
+
legend?: ((page: P) => Promise<void>) | undefined;
|
|
86
|
+
inspector?: ((page: P) => Promise<void>) | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Puts the modeler into its invalid-file state the way its host does (an invalid import): a
|
|
89
|
+
* read-only canvas and the status box. The kit waits `INVALID_STATUS_DELAY_MS` afterwards.
|
|
90
|
+
*/
|
|
91
|
+
invalid?: ((page: P) => Promise<void>) | undefined;
|
|
92
|
+
}
|
|
93
|
+
/** A show hook by name: the islands `legend`, `inspector`, `problems`, `status` and the state `invalid`. */
|
|
94
|
+
type ShowHook = keyof ShowHooks;
|
|
95
|
+
interface ShellConformanceHarness<P extends PageLike = PageLike> {
|
|
96
|
+
host: ShellHost;
|
|
97
|
+
/** The modes the modeler declares (static); the appearance case requests dark from `["light"]`. */
|
|
98
|
+
themes: readonly Theme[];
|
|
99
|
+
/** Load the modeler with the shell at `size`, as the host would with `requested`; resolve once the first import is done. */
|
|
100
|
+
open(page: P, context: OpenContext): Promise<void>;
|
|
101
|
+
/** Tear modeler and shell down through the page's own path; `undefined` skips the cleanup case. */
|
|
102
|
+
destroy?: ((page: P) => Promise<void>) | undefined;
|
|
103
|
+
/** CSS selector of the shell root; default `.cd-shell`. */
|
|
104
|
+
root?: string | undefined;
|
|
105
|
+
/** Hooks for the islands and states the modeler has; one that is neither given nor `absent` is reported as skipped. */
|
|
106
|
+
show?: ShowHooks<P> | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The islands and states the modeler does not have. An absent hook is not reported as skipped,
|
|
109
|
+
* and `geometry` and `aria` assert that its island is never visible. Listing a hook that `show`
|
|
110
|
+
* also gives fails every case that uses it.
|
|
111
|
+
*/
|
|
112
|
+
absent?: readonly ShowHook[] | undefined;
|
|
113
|
+
/** Container sizes of the geometry case; default wide 1280 × 900, narrow 720 × 700, very narrow 420 × 700. */
|
|
114
|
+
sizes?: readonly Size[] | undefined;
|
|
115
|
+
}
|
|
116
|
+
/** One part of a case the harness could not feed. */
|
|
117
|
+
interface ShellSkip {
|
|
118
|
+
/**
|
|
119
|
+
* The harness field that would feed it: a show hook, `destroy`, or `open` when the document it
|
|
120
|
+
* opens lacks what the case needs (a shape on the canvas).
|
|
121
|
+
*/
|
|
122
|
+
hook: ShowHook | "destroy" | "open";
|
|
123
|
+
reason: string;
|
|
124
|
+
}
|
|
125
|
+
interface ShellCaseOutcome {
|
|
126
|
+
/** What the case could not (fully) run, one entry per missing harness field. */
|
|
127
|
+
skipped?: readonly ShellSkip[];
|
|
128
|
+
}
|
|
129
|
+
interface ShellConformanceCase {
|
|
130
|
+
name: string;
|
|
131
|
+
run<P extends PageLike>(page: P, harness: ShellConformanceHarness<P>): Promise<ShellCaseOutcome | void>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The cases: `geometry` (every `data-chrome` island ±1px, per host and breakpoint), `aria`
|
|
135
|
+
* (roles, names, `aria-expanded`/`-controls`/`-keyshortcuts`/`-disabled`, DOM order, no positive
|
|
136
|
+
* tabindex), `keys` (each chrome key acts exactly once; in the IDE host a `keydown` listener on
|
|
137
|
+
* `window` never fires for a handled key; unmodified `+`/`-` never zoom; select all acts on the
|
|
138
|
+
* canvas only), `create` (Enter on the first creating palette entry places one selected element in
|
|
139
|
+
* the free rectangle and focuses the canvas), `readOnly` (the invalid-file lock of guide §13.5),
|
|
140
|
+
* `appearance` (dark requested from a light-only modeler: nothing turns dark, `color-scheme` light
|
|
141
|
+
* everywhere, the canvas surround and the palette's tool colours from the roles) and `cleanup` (after
|
|
142
|
+
* `destroy` no shell element, class, attribute or key handling remains).
|
|
143
|
+
*/
|
|
144
|
+
declare function shellConformanceCases(): ShellConformanceCase[];
|
|
145
|
+
/** Playwright's `test` (or any runner whose body receives `{ page }`). */
|
|
146
|
+
type ShellConformanceTest<P extends PageLike = PageLike> = (name: string, body: (fixtures: {
|
|
147
|
+
page: P;
|
|
148
|
+
}) => Promise<void>) => unknown;
|
|
149
|
+
interface RegisterShellConformanceOptions {
|
|
150
|
+
/** Default: `console.warn`, one line per case with its skips joined by "; ". */
|
|
151
|
+
onSkip?: ((caseName: string, skips: readonly ShellSkip[]) => void) | undefined;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The query string for a test page that installs the VS Code stub of
|
|
155
|
+
* `@miragon/modeler-shell/testing/vscode-stub` with `stubOptionsFromSearch(location.search)`:
|
|
156
|
+
* `theme=dark&kontrast=hoch`, plus the `colorTheme` setting and VS Code's reduce motion.
|
|
157
|
+
*/
|
|
158
|
+
declare function vsCodeStubSearch(requested: Appearance, extra?: {
|
|
159
|
+
colorTheme?: ColorThemeSetting | undefined;
|
|
160
|
+
reduceMotion?: boolean | undefined;
|
|
161
|
+
}): string;
|
|
162
|
+
/** Registers every case as `shell conformance: <name>`. */
|
|
163
|
+
declare function registerShellConformance<P extends PageLike>(harness: ShellConformanceHarness<P>, test: ShellConformanceTest<P>, options?: RegisterShellConformanceOptions): void;
|
|
164
|
+
|
|
165
|
+
export { type ChromeMeasurement, type ExpectedBox, GEOMETRY_TOLERANCE_PX, type IslandBox, type OpenContext, type PageLike, type RegisterShellConformanceOptions, type ShellCaseOutcome, type ShellConformanceCase, type ShellConformanceHarness, type ShellConformanceTest, type ShellSkip, type ShowHook, type ShowHooks, expectedChromeBoxes, measureChrome, registerShellConformance, shellConformanceCases, vsCodeStubSearch };
|