@miragon/modeler-api 1.2.0 → 1.4.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/README.md +180 -57
- package/dist/{chunk-E6KJB7QH.js → chunk-N4TQ7UHQ.js} +2 -2
- package/dist/chunk-N4TQ7UHQ.js.map +1 -0
- package/dist/conformance.cjs +600 -34
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +32 -4
- package/dist/conformance.d.ts +32 -4
- package/dist/conformance.js +600 -34
- package/dist/conformance.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -8
- package/dist/index.d.ts +73 -8
- package/dist/index.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-E6KJB7QH.js.map +0 -1
package/dist/conformance.d.cts
CHANGED
|
@@ -10,6 +10,11 @@ export { apiVersionsCompatible } from './index.cjs';
|
|
|
10
10
|
* import { conformanceCases, registerConformance } from "@miragon/modeler-api/conformance";
|
|
11
11
|
* registerConformance(harness, test); // node:test, vitest, jest — any (name, fn) runner
|
|
12
12
|
*
|
|
13
|
+
* The runner must run the cases one after another, as node:test, vitest and
|
|
14
|
+
* jest do within a file unless told otherwise (no `test.concurrent`): the
|
|
15
|
+
* keys case moves the focus and dispatches keys in the one document every
|
|
16
|
+
* mounted instance listens to.
|
|
17
|
+
*
|
|
13
18
|
* Cases throw plain Errors on violation, so the kit has no runner or
|
|
14
19
|
* assertion-library dependency. A case that CANNOT (fully) run because the
|
|
15
20
|
* harness left an optional field undefined resolves with `{ skipped }` and
|
|
@@ -31,13 +36,28 @@ interface ConformanceHarness {
|
|
|
31
36
|
* engines compute viewboxes from the host's client size, so a detached
|
|
32
37
|
* or 0×0 host yields NaN view state; they also need a real browser
|
|
33
38
|
* (vitest browser mode / Playwright), jsdom has no getBBox. Keep
|
|
34
|
-
* `fitOnImport` at its default: the L5 cases check the modeler's own fit
|
|
39
|
+
* `fitOnImport` at its default: the L5 cases check the modeler's own fit.
|
|
40
|
+
* The keys case finds the canvas in the host `attachedHost()` made during
|
|
41
|
+
* this call (or takes the one `canvasElement` names): mount into one, or
|
|
42
|
+
* that case reports a skip
|
|
35
43
|
*/
|
|
36
44
|
create(): Promise<CollaborativeModeler>;
|
|
37
45
|
/** a fresh READ-ONLY instance (`meta.editable === false`) — the viewer
|
|
38
46
|
* mount hosts use on read-only surfaces; absent = the package ships no
|
|
39
|
-
* viewer and the viewer case is reported as skipped
|
|
47
|
+
* viewer and the viewer case is reported as skipped. The keys case aims
|
|
48
|
+
* its keys at the viewer too: mount it as `create()` does */
|
|
40
49
|
createReadonly?(): Promise<CollaborativeModeler>;
|
|
50
|
+
/**
|
|
51
|
+
* the focusable element `modeler` (from `create()` or `createReadonly()`)
|
|
52
|
+
* placed in its host to take its keys: the keys case aims the keys that
|
|
53
|
+
* must act at it, and the host's controls it puts next to it and into the
|
|
54
|
+
* `attachedHost()` it lies in. `undefined` = the focusable `<svg>` (one
|
|
55
|
+
* with a `tabindex`, diagram-js's canvas) in the one `attachedHost()` the
|
|
56
|
+
* call mounted into. A modeler that takes its keys on another element (a
|
|
57
|
+
* `<div>`, a `<canvas>`) names it here; `null` or `undefined` returned, or
|
|
58
|
+
* an element outside every `attachedHost()`, is reported as a skip
|
|
59
|
+
*/
|
|
60
|
+
canvasElement?(modeler: CollaborativeModeler): Element | null | undefined;
|
|
41
61
|
/**
|
|
42
62
|
* CANONICAL sample documents of the notation (>= 2, distinct, at least one
|
|
43
63
|
* rendering an element, ideally several covering config/axis content too)
|
|
@@ -208,7 +228,15 @@ interface RegisterOptions {
|
|
|
208
228
|
* console.warn */
|
|
209
229
|
onAdvisory?: (caseName: string, advice: string) => void;
|
|
210
230
|
}
|
|
211
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* bind every case to a (name, fn) test runner — node:test, vitest, jest —
|
|
233
|
+
* that runs them one after another: the keys case moves the focus and
|
|
234
|
+
* dispatches keys in the one document every mounted instance listens to, so
|
|
235
|
+
* a case running beside it would see its keys or lose its focus. A case's
|
|
236
|
+
* advisories are reported before its skip, so an `onSkip` that throws does
|
|
237
|
+
* not hide them
|
|
238
|
+
*/
|
|
212
239
|
declare function registerConformance(harness: ConformanceHarness, test: (name: string, fn: () => Promise<void>) => unknown, options?: RegisterOptions): void;
|
|
213
240
|
|
|
214
|
-
export {
|
|
241
|
+
export { attachedHost, conformanceCases, registerConformance };
|
|
242
|
+
export type { CaseOutcome, ConformanceCase, ConformanceHarness, InteractionState, RegisterOptions, UserMutation };
|
package/dist/conformance.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export { apiVersionsCompatible } from './index.js';
|
|
|
10
10
|
* import { conformanceCases, registerConformance } from "@miragon/modeler-api/conformance";
|
|
11
11
|
* registerConformance(harness, test); // node:test, vitest, jest — any (name, fn) runner
|
|
12
12
|
*
|
|
13
|
+
* The runner must run the cases one after another, as node:test, vitest and
|
|
14
|
+
* jest do within a file unless told otherwise (no `test.concurrent`): the
|
|
15
|
+
* keys case moves the focus and dispatches keys in the one document every
|
|
16
|
+
* mounted instance listens to.
|
|
17
|
+
*
|
|
13
18
|
* Cases throw plain Errors on violation, so the kit has no runner or
|
|
14
19
|
* assertion-library dependency. A case that CANNOT (fully) run because the
|
|
15
20
|
* harness left an optional field undefined resolves with `{ skipped }` and
|
|
@@ -31,13 +36,28 @@ interface ConformanceHarness {
|
|
|
31
36
|
* engines compute viewboxes from the host's client size, so a detached
|
|
32
37
|
* or 0×0 host yields NaN view state; they also need a real browser
|
|
33
38
|
* (vitest browser mode / Playwright), jsdom has no getBBox. Keep
|
|
34
|
-
* `fitOnImport` at its default: the L5 cases check the modeler's own fit
|
|
39
|
+
* `fitOnImport` at its default: the L5 cases check the modeler's own fit.
|
|
40
|
+
* The keys case finds the canvas in the host `attachedHost()` made during
|
|
41
|
+
* this call (or takes the one `canvasElement` names): mount into one, or
|
|
42
|
+
* that case reports a skip
|
|
35
43
|
*/
|
|
36
44
|
create(): Promise<CollaborativeModeler>;
|
|
37
45
|
/** a fresh READ-ONLY instance (`meta.editable === false`) — the viewer
|
|
38
46
|
* mount hosts use on read-only surfaces; absent = the package ships no
|
|
39
|
-
* viewer and the viewer case is reported as skipped
|
|
47
|
+
* viewer and the viewer case is reported as skipped. The keys case aims
|
|
48
|
+
* its keys at the viewer too: mount it as `create()` does */
|
|
40
49
|
createReadonly?(): Promise<CollaborativeModeler>;
|
|
50
|
+
/**
|
|
51
|
+
* the focusable element `modeler` (from `create()` or `createReadonly()`)
|
|
52
|
+
* placed in its host to take its keys: the keys case aims the keys that
|
|
53
|
+
* must act at it, and the host's controls it puts next to it and into the
|
|
54
|
+
* `attachedHost()` it lies in. `undefined` = the focusable `<svg>` (one
|
|
55
|
+
* with a `tabindex`, diagram-js's canvas) in the one `attachedHost()` the
|
|
56
|
+
* call mounted into. A modeler that takes its keys on another element (a
|
|
57
|
+
* `<div>`, a `<canvas>`) names it here; `null` or `undefined` returned, or
|
|
58
|
+
* an element outside every `attachedHost()`, is reported as a skip
|
|
59
|
+
*/
|
|
60
|
+
canvasElement?(modeler: CollaborativeModeler): Element | null | undefined;
|
|
41
61
|
/**
|
|
42
62
|
* CANONICAL sample documents of the notation (>= 2, distinct, at least one
|
|
43
63
|
* rendering an element, ideally several covering config/axis content too)
|
|
@@ -208,7 +228,15 @@ interface RegisterOptions {
|
|
|
208
228
|
* console.warn */
|
|
209
229
|
onAdvisory?: (caseName: string, advice: string) => void;
|
|
210
230
|
}
|
|
211
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* bind every case to a (name, fn) test runner — node:test, vitest, jest —
|
|
233
|
+
* that runs them one after another: the keys case moves the focus and
|
|
234
|
+
* dispatches keys in the one document every mounted instance listens to, so
|
|
235
|
+
* a case running beside it would see its keys or lose its focus. A case's
|
|
236
|
+
* advisories are reported before its skip, so an `onSkip` that throws does
|
|
237
|
+
* not hide them
|
|
238
|
+
*/
|
|
212
239
|
declare function registerConformance(harness: ConformanceHarness, test: (name: string, fn: () => Promise<void>) => unknown, options?: RegisterOptions): void;
|
|
213
240
|
|
|
214
|
-
export {
|
|
241
|
+
export { attachedHost, conformanceCases, registerConformance };
|
|
242
|
+
export type { CaseOutcome, ConformanceCase, ConformanceHarness, InteractionState, RegisterOptions, UserMutation };
|