@miragon/dmn-modeler 0.1.0 → 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/CHANGELOG.md +35 -0
- package/dist/darkTheme.css +1 -1
- package/dist/dmn-modeler.css +1 -1
- package/dist/index.d.ts +22 -33
- package/dist/index.js +9 -1
- package/dist/lightTheme.css +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Factory signature for one independent DMN modeler instance. */
|
|
2
2
|
export declare type CreateDmnModeler = (container: HTMLElement, options: DmnModelerOptions) => Promise<DmnModelerHandle>;
|
|
3
3
|
|
|
4
4
|
/** Stand up one independent DMN modeler bound to the supplied DOM hosts. */
|
|
@@ -28,39 +28,39 @@ export declare interface DmnKeyboardOptions {
|
|
|
28
28
|
|
|
29
29
|
/** The independent instance handle returned by {@link createModeler}. */
|
|
30
30
|
export declare interface DmnModelerHandle {
|
|
31
|
-
/**
|
|
31
|
+
/** Load DMN XML, replacing any currently loaded document. */
|
|
32
32
|
loadDiagram(xml: string): Promise<DmnOperationResult>;
|
|
33
|
-
/**
|
|
33
|
+
/** Serialise the current document as formatted DMN XML. */
|
|
34
34
|
exportDiagram(): Promise<string>;
|
|
35
|
-
/**
|
|
35
|
+
/** Return the active view, if the loaded document has one. */
|
|
36
36
|
getActiveView(): DmnView | undefined;
|
|
37
|
-
/**
|
|
37
|
+
/** Return every view in the loaded document. */
|
|
38
38
|
getViews(): DmnView[];
|
|
39
|
-
/**
|
|
39
|
+
/** Open a view previously returned by this handle. */
|
|
40
40
|
openView(view: DmnView): Promise<DmnOperationResult>;
|
|
41
|
-
/**
|
|
41
|
+
/** Whether the decision requirements diagram is active. */
|
|
42
42
|
isDrdViewActive(): boolean;
|
|
43
|
-
/**
|
|
43
|
+
/** Focus the active DRD canvas; safely does nothing in other views. */
|
|
44
44
|
focusCanvas(): void;
|
|
45
|
-
/**
|
|
45
|
+
/** Whether the active DRD canvas owns focus; false in other views. */
|
|
46
46
|
isCanvasFocused(): boolean;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Switch the colour theme live. Toggles this instance's `data-dmn-theme`
|
|
49
49
|
* attribute and mirrors it to a legacy `#theme-link` when present.
|
|
50
50
|
*/
|
|
51
51
|
setTheme(theme: DmnThemeMode): void;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Set the page-global UI locale and re-open the active view so its already
|
|
54
54
|
* rendered labels re-translate. A no-op when the resolved locale is unchanged
|
|
55
55
|
* (an unknown code resolves to `"en"`). Because it re-opens the active view it
|
|
56
56
|
* re-fires `onViewChanged` and clears that view's undo history, like a
|
|
57
57
|
* re-import; the DRD viewbox is preserved.
|
|
58
58
|
*/
|
|
59
59
|
setLocale(locale: string): Promise<void>;
|
|
60
|
-
/**
|
|
60
|
+
/** Tear down this instance and all of its listeners and observers. */
|
|
61
61
|
destroy(): void;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Unstable escape hatch into the active dmn-js viewer's DI graph. The
|
|
64
64
|
* service names and returned shapes are not covered by this facade's API.
|
|
65
65
|
*/
|
|
66
66
|
getService<T = unknown>(name: string): T;
|
|
@@ -68,34 +68,34 @@ export declare interface DmnModelerHandle {
|
|
|
68
68
|
|
|
69
69
|
/** Per-instance configuration for {@link createModeler}. */
|
|
70
70
|
export declare interface DmnModelerOptions {
|
|
71
|
-
/**
|
|
71
|
+
/** The properties-panel host owned by this modeler instance. */
|
|
72
72
|
propertiesPanel: {
|
|
73
73
|
parent: HTMLElement;
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Extra DI modules for individual view editors. Caller modules are
|
|
77
77
|
* appended after the facade defaults, allowing deliberate overrides.
|
|
78
78
|
*/
|
|
79
79
|
additionalModules?: DmnAdditionalModules;
|
|
80
|
-
/**
|
|
80
|
+
/** Extra moddle descriptors, merged over the bundled Camunda descriptor. */
|
|
81
81
|
moddleExtensions?: Record<string, object>;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Expression-language configuration. When supplied it replaces the
|
|
84
84
|
* facade's six-language default.
|
|
85
85
|
*/
|
|
86
86
|
expressionLanguages?: DmnExpressionLanguages;
|
|
87
|
-
/**
|
|
87
|
+
/** Data types shown by editors. When supplied they replace the defaults. */
|
|
88
88
|
dataTypes?: string[];
|
|
89
|
-
/**
|
|
89
|
+
/** Per-editor keyboard configuration. */
|
|
90
90
|
keyboard?: DmnKeyboardOptions;
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
92
|
+
* Colour theme — defaults to `"automatic"`. Theming always engages: the
|
|
93
93
|
* instance gets a `data-dmn-theme` attribute from the first frame regardless
|
|
94
94
|
* of whether this is set.
|
|
95
95
|
*/
|
|
96
96
|
theme?: DmnThemeMode;
|
|
97
97
|
/**
|
|
98
|
-
*
|
|
98
|
+
* UI locale — defaults to the page's current locale (`"en"`). Page-global:
|
|
99
99
|
* the i18n instance is a singleton, so this sets the locale for every modeler
|
|
100
100
|
* on the page. An unknown code resolves to `"en"`.
|
|
101
101
|
*/
|
|
@@ -114,7 +114,7 @@ export declare interface DmnOperationResult {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
117
|
+
* Theme selection for a single instance. The modeler toggles a
|
|
118
118
|
* `data-dmn-theme` attribute on its container + panel parent (the authoritative
|
|
119
119
|
* mechanism — dark rules are scoped under `[data-dmn-theme="dark"]`, so two
|
|
120
120
|
* instances on one page can hold different themes) and mirrors the choice onto a
|
|
@@ -148,17 +148,6 @@ export declare interface DmnViewElement {
|
|
|
148
148
|
readonly [property: string]: unknown;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
/**
|
|
152
|
-
* The public TypeScript surface of the host-free DMN modeler facade.
|
|
153
|
-
*
|
|
154
|
-
* Engine features are split into the same categories used by ADR 0007:
|
|
155
|
-
*
|
|
156
|
-
* - **[A] Engine-intrinsic** features are always present.
|
|
157
|
-
* - **[B] Opinionated built-ins** have a useful default and may be replaced.
|
|
158
|
-
*
|
|
159
|
-
* The `on*` members are outbound notifications, documented separately from
|
|
160
|
-
* either category. They do not provide host capabilities to the modeler.
|
|
161
|
-
*/
|
|
162
151
|
/** A view editor supported by dmn-js. */
|
|
163
152
|
export declare type DmnViewType = "drd" | "decisionTable" | "literalExpression" | "boxedExpression";
|
|
164
153
|
|
package/dist/index.js
CHANGED
|
@@ -464,7 +464,15 @@ function E(e) {
|
|
|
464
464
|
async function D(e, n) {
|
|
465
465
|
t.extend(c);
|
|
466
466
|
let r = new C(e, n);
|
|
467
|
-
|
|
467
|
+
try {
|
|
468
|
+
r.setTheme(n.theme ?? "automatic"), n.locale && t.setLanguage(n.locale);
|
|
469
|
+
} catch (e) {
|
|
470
|
+
try {
|
|
471
|
+
r.destroy();
|
|
472
|
+
} catch {}
|
|
473
|
+
throw e;
|
|
474
|
+
}
|
|
475
|
+
return r;
|
|
468
476
|
}
|
|
469
477
|
//#endregion
|
|
470
478
|
export { D as createModeler };
|