@miragon/dmn-modeler 0.8.0 → 0.10.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/dist/index.d.ts CHANGED
@@ -1,12 +1,37 @@
1
+ /* Excluded from this release type: createDiffViewer */
2
+
1
3
  /** Factory signature for one independent DMN modeler instance. */
2
4
  export declare type CreateDmnModeler = (container: HTMLElement, options: DmnModelerOptions) => Promise<DmnModelerHandle>;
3
5
 
4
6
  /** Stand up one independent DMN modeler bound to the supplied DOM hosts. */
5
7
  export declare function createModeler(container: HTMLElement, options: DmnModelerOptions): Promise<DmnModelerHandle>;
6
8
 
9
+ /** A kind of change a diff counts and marks. */
10
+ declare type DiffCategory = keyof DiffCounts;
11
+
12
+ /**
13
+ * Summary counts across the four diff categories, used for the legend chip.
14
+ */
15
+ declare interface DiffCounts {
16
+ readonly added: number;
17
+ readonly removed: number;
18
+ readonly changed: number;
19
+ readonly layoutChanged: number;
20
+ }
21
+
7
22
  /** Additional dmn-js dependency-injection modules, grouped by view editor. */
8
23
  export declare type DmnAdditionalModules = Partial<Record<DmnViewType, unknown[]>>;
9
24
 
25
+ /* Excluded from this release type: DmnDiffMarkOptions */
26
+
27
+ /* Excluded from this release type: DmnDiffMarks */
28
+
29
+ /* Excluded from this release type: DmnDiffStatus */
30
+
31
+ /* Excluded from this release type: DmnDiffViewerHandle */
32
+
33
+ /* Excluded from this release type: DmnDiffViewerOptions */
34
+
10
35
  /** One expression language shown by decision editors. */
11
36
  export declare interface DmnExpressionLanguage {
12
37
  readonly value: string;
@@ -27,8 +52,13 @@ export declare interface DmnKeyboardOptions {
27
52
  }
28
53
 
29
54
  /** The independent instance handle returned by {@link createModeler}. */
30
- export declare interface DmnModelerHandle {
31
- /** Load DMN XML, replacing any currently loaded document. */
55
+ export declare interface DmnModelerHandle extends DmnPendingInputHandle {
56
+ /**
57
+ * Load DMN XML, replacing any currently loaded document. An outside write
58
+ * keeps the open view, such as a decision's table, while the new document
59
+ * still holds its element (matched by id); otherwise the first view opens,
60
+ * the decision requirements diagram when the document has one.
61
+ */
32
62
  loadDiagram(xml: string): Promise<DmnOperationResult>;
33
63
  /** Serialise the current document as formatted DMN XML. */
34
64
  exportDiagram(): Promise<string>;
@@ -118,7 +148,21 @@ export declare interface DmnOperationResult {
118
148
  readonly warnings: DmnWarning[];
119
149
  }
120
150
 
121
- /* Excluded from this release type: DmnPendingInputHandle */
151
+ /**
152
+ * Input a view editor holds in its input debounce, so it is not in the
153
+ * document or an export yet. A host applies it before it exports for a save.
154
+ */
155
+ export declare interface DmnPendingInputHandle {
156
+ /** Whether such input waits; `false` once destroyed. */
157
+ hasPendingInput(): boolean;
158
+ /**
159
+ * Applies that input to the document now. A no-op once destroyed. Input that
160
+ * fails does not hold back the rest; its error is thrown once the rest is applied.
161
+ */
162
+ flushPendingInput(): void;
163
+ }
164
+
165
+ /* Excluded from this release type: DmnTableMarks */
122
166
 
123
167
  /**
124
168
  * Theme selection for a single instance. The modeler toggles a
@@ -182,8 +226,97 @@ export declare class NoModelerError extends Error {
182
226
  */
183
227
  declare type SurfaceThemeMode = "light" | "dark" | "automatic";
184
228
 
229
+ /**
230
+ * A decision table's scroll position in a DMN diff pane, anchored on the
231
+ * topmost visible rule both versions share, so the partner pane lines up the
232
+ * same rule even when rules were added or removed above it.
233
+ */
234
+ declare interface TableScroll {
235
+ /** The rule at the top of the view; absent when no shared rule is visible. */
236
+ readonly rule?: string;
237
+ /** Pixels scrolled past the top of that rule, or past the table's top without one. */
238
+ readonly offset: number;
239
+ readonly left: number;
240
+ }
241
+
242
+ /**
243
+ * Canvas viewbox used for pan/zoom synchronisation between panes.
244
+ */
245
+ declare interface Viewport {
246
+ readonly x: number;
247
+ readonly y: number;
248
+ readonly width: number;
249
+ readonly height: number;
250
+ }
251
+
185
252
  export { }
186
253
 
254
+ /**
255
+ * Ambient type declarations for `bpmn-js-differ`, which ships without its own
256
+ * `.d.ts`. Covers only the subset used by the BPMN diff feature — `diff()`,
257
+ * the shape of its return value and the tracked-element check its specs pin.
258
+ */
259
+ declare module "bpmn-js-differ" {
260
+ /**
261
+ * A bpmn-moddle element reference — opaque here because the differ only
262
+ * consumes objects produced by `bpmn-moddle` and we never inspect them
263
+ * beyond reading `$type` and `id`.
264
+ */
265
+ interface ModdleElement {
266
+ $type: string;
267
+ id?: string;
268
+ [key: string]: unknown;
269
+ }
270
+
271
+ export interface ChangedEntry {
272
+ model: ModdleElement;
273
+ attrs: Record<string, { oldValue: unknown; newValue: unknown }>;
274
+ }
275
+
276
+ export interface DiffResult {
277
+ _added: Record<string, ModdleElement>;
278
+ _removed: Record<string, ModdleElement>;
279
+ _changed: Record<string, ChangedEntry>;
280
+ _layoutChanged: Record<string, ModdleElement>;
281
+ }
282
+
283
+ export function diff(before: ModdleElement, after: ModdleElement): DiffResult;
284
+
285
+ export class ChangeHandler {
286
+ _isTracked(
287
+ element: ModdleElement,
288
+ ): { element: ModdleElement; property: string } | false | undefined;
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Minimal ambient shim for `bpmn-moddle`, which ships no `.d.ts`.
294
+ *
295
+ * `loadBpmnModdle` treats the dynamic moddle import as `unknown` and casts it, so it
296
+ * needs the module to *resolve* but never its member types. An empty module
297
+ * declaration does exactly that — and, unlike a richer shim, it merges without
298
+ * conflict alongside a consumer program's own `bpmn-moddle` declaration
299
+ * (the package ships a fuller one for its specs). Keeping this empty is what
300
+ * lets the differ lib be pulled into any program, including those with no moddle
301
+ * shim of their own.
302
+ */
303
+ declare module "bpmn-moddle" {}
304
+
305
+ /** The part of `saxen`, which ships no `.d.ts`, that the declaration scan uses. */
306
+ declare module "saxen" {
307
+ export class Parser {
308
+ constructor(options?: { proxy?: boolean });
309
+ on(
310
+ event: "openTag",
311
+ handler: (name: string, getAttrs: () => Record<string, string>) => void,
312
+ ): this;
313
+ on(event: "error", handler: (error: Error) => void): this;
314
+ parse(xml: string): Error | undefined;
315
+ }
316
+
317
+ export function decode(text: string): string;
318
+ }
319
+
187
320
  declare module "diagram-js/lib/core/EventBus" {
188
321
  export default class EventBus {
189
322
  on<T extends string>(event: T, callback: EventCallback, that?: any): void;