@bpmnkit/editor 0.0.34 → 0.0.35

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/editor.js CHANGED
@@ -2384,6 +2384,14 @@ export class BpmnEditor {
2384
2384
  scrollToElement(id) {
2385
2385
  self.scrollToElement(id);
2386
2386
  },
2387
+ // The editor works on one plane — `diagrams[0]` — and has no drill-in.
2388
+ // Saying so honestly is what lets a navigation plugin decline to drill
2389
+ // here, rather than appearing to and doing nothing.
2390
+ getPlanes() {
2391
+ const plane = self._defs?.diagrams[0]?.plane;
2392
+ return plane === undefined ? [] : [{ id: plane.bpmnElement, name: plane.bpmnElement }];
2393
+ },
2394
+ showPlane() { },
2387
2395
  getAbsoluteBBox(id) {
2388
2396
  return self._absoluteBBox(id);
2389
2397
  },
package/dist/i18n.d.ts CHANGED
@@ -11,4 +11,39 @@ export type Translate = (template: string, vars?: TranslateVars) => string;
11
11
  export declare function interpolate(template: string, vars?: TranslateVars): string;
12
12
  /** The default (identity) translator: no localization, just placeholder interpolation. */
13
13
  export declare function defaultTranslate(template: string, vars?: TranslateVars): string;
14
+ /**
15
+ * A translator that also records what it was asked for.
16
+ *
17
+ * Localising a UI starts with knowing which strings it has, and the usual
18
+ * answer — grep the source for the translation call — produces a list nobody
19
+ * can trust: it includes strings behind code that no longer runs, and misses
20
+ * any built by concatenation. Harvesting from a *running* editor inverts that.
21
+ * Every key it observes is real by construction, and a key the harvest never
22
+ * observes is either dead or reachable only through a path the harvest does
23
+ * not exercise. Both are worth knowing, and neither is knowable from the
24
+ * source alone.
25
+ *
26
+ * @param base - The translator to delegate to. Defaults to identity, which is
27
+ * what a harvest wants; pass a real one to record a live session instead.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const recorder = createTranslationRecorder();
32
+ * const editor = new BpmnEditor({ container, translate: recorder.translate });
33
+ * initEditorHud(editor);
34
+ * recorder.keys(); // every string the editor asked for while starting up
35
+ * ```
36
+ */
37
+ export declare function createTranslationRecorder(base?: Translate): TranslationRecorder;
38
+ /** A {@link Translate} that remembers every template it was given. */
39
+ export interface TranslationRecorder {
40
+ /** Pass this to the editor as its `translate` option. */
41
+ translate: Translate;
42
+ /** Every template requested, in the order it was first asked for. */
43
+ keys(): string[];
44
+ /** The interpolation variables a template was given, sorted. */
45
+ placeholders(template: string): string[];
46
+ /** Forgets everything observed so far. */
47
+ reset(): void;
48
+ }
14
49
  //# sourceMappingURL=i18n.d.ts.map
package/dist/i18n.js CHANGED
@@ -8,4 +8,49 @@ export function interpolate(template, vars) {
8
8
  export function defaultTranslate(template, vars) {
9
9
  return interpolate(template, vars);
10
10
  }
11
+ /**
12
+ * A translator that also records what it was asked for.
13
+ *
14
+ * Localising a UI starts with knowing which strings it has, and the usual
15
+ * answer — grep the source for the translation call — produces a list nobody
16
+ * can trust: it includes strings behind code that no longer runs, and misses
17
+ * any built by concatenation. Harvesting from a *running* editor inverts that.
18
+ * Every key it observes is real by construction, and a key the harvest never
19
+ * observes is either dead or reachable only through a path the harvest does
20
+ * not exercise. Both are worth knowing, and neither is knowable from the
21
+ * source alone.
22
+ *
23
+ * @param base - The translator to delegate to. Defaults to identity, which is
24
+ * what a harvest wants; pass a real one to record a live session instead.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const recorder = createTranslationRecorder();
29
+ * const editor = new BpmnEditor({ container, translate: recorder.translate });
30
+ * initEditorHud(editor);
31
+ * recorder.keys(); // every string the editor asked for while starting up
32
+ * ```
33
+ */
34
+ export function createTranslationRecorder(base = defaultTranslate) {
35
+ // Insertion-ordered, so the harvest reads in the order the UI asks.
36
+ const seen = new Map();
37
+ return {
38
+ translate(template, vars) {
39
+ const names = seen.get(template) ?? new Set();
40
+ for (const name of Object.keys(vars ?? {}))
41
+ names.add(name);
42
+ seen.set(template, names);
43
+ return base(template, vars);
44
+ },
45
+ keys() {
46
+ return [...seen.keys()];
47
+ },
48
+ placeholders(template) {
49
+ return [...(seen.get(template) ?? [])].sort();
50
+ },
51
+ reset() {
52
+ seen.clear();
53
+ },
54
+ };
55
+ }
11
56
  //# sourceMappingURL=i18n.js.map
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export { ELEMENT_GROUPS, ELEMENT_TYPE_LABELS, EXTERNAL_LABEL_TYPES, CONTEXTUAL_A
5
5
  export type { ElementGroup } from "./element-groups.js";
6
6
  export { initEditorHud } from "./hud.js";
7
7
  export type { HudOptions } from "./hud.js";
8
- export { defaultTranslate, interpolate } from "./i18n.js";
9
- export type { Translate, TranslateVars } from "./i18n.js";
8
+ export { createTranslationRecorder, defaultTranslate, interpolate } from "./i18n.js";
9
+ export type { Translate, TranslationRecorder, TranslateVars } from "./i18n.js";
10
10
  export { createSideDock } from "./dock.js";
11
11
  export type { SideDock } from "./dock.js";
12
12
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -2,6 +2,6 @@ export { BpmnEditor } from "./editor.js";
2
2
  export { createEmptyDefinitions } from "./modeling.js";
3
3
  export { ELEMENT_GROUPS, ELEMENT_TYPE_LABELS, EXTERNAL_LABEL_TYPES, CONTEXTUAL_ADD_TYPES, getElementGroup, getValidLabelPositions, } from "./element-groups.js";
4
4
  export { initEditorHud } from "./hud.js";
5
- export { defaultTranslate, interpolate } from "./i18n.js";
5
+ export { createTranslationRecorder, defaultTranslate, interpolate } from "./i18n.js";
6
6
  export { createSideDock } from "./dock.js";
7
7
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmnkit/editor",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "dist/**/*.d.ts"
18
18
  ],
19
19
  "dependencies": {
20
- "@bpmnkit/canvas": "0.0.31",
21
- "@bpmnkit/core": "0.2.0"
20
+ "@bpmnkit/canvas": "0.1.0",
21
+ "@bpmnkit/core": "0.3.0"
22
22
  },
23
23
  "description": "Full-featured interactive BPMN editor with undo/redo, HUD, and side-dock UI",
24
24
  "keywords": [