yarramate 1.41.0 → 1.41.1
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/canvas-scene.js +2 -2
- package/dist/nesting-span.js +29 -0
- package/dist/{visual-app-lib/types/visual-app/subject-filter.d.ts → subject-filter.d.ts} +1 -1
- package/dist/subject-filter.js +31 -0
- package/dist/visual-app-lib/editor.js +2 -2
- package/dist/visual-app-lib/types/nesting-span.d.ts +13 -0
- package/dist/visual-app-lib/types/subject-filter.d.ts +35 -0
- package/dist/visual-app-lib/types/visual-app/view-tree-model.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/{visual-app-lib/types/visual-app/nesting-span.d.ts → nesting-span.d.ts} +0 -0
package/dist/canvas-scene.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { foldGraph, foldTree } from './fold-tree.js';
|
|
2
|
-
import { spansNesting } from './
|
|
3
|
-
import { subjectMatchesQuickFilter } from './
|
|
2
|
+
import { spansNesting } from './nesting-span.js';
|
|
3
|
+
import { subjectMatchesQuickFilter } from './subject-filter.js';
|
|
4
4
|
/** The drawn relationships: what nesting did not consume, and RACI only if shown. */
|
|
5
5
|
export function drawnCanvasEdges(graph, tree, showResponsibility) {
|
|
6
6
|
return graph.edges.filter((edge) => !tree.consumedEdgeIds.has(edge.id) &&
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an edge's two ends are nested one inside the other (#439, ADR 0139).
|
|
3
|
+
*
|
|
4
|
+
* Composition maps onto cytoscape's compound `parent`, so a pair that also
|
|
5
|
+
* carries any OTHER relationship produces an edge from a container to its own
|
|
6
|
+
* child. ELK cannot lay that out: measured on a five-concept model, the
|
|
7
|
+
* container and its child render and every unrelated node loses its geometry.
|
|
8
|
+
*
|
|
9
|
+
* Its own module rather than a helper inside `graph-canvas.tsx`, following
|
|
10
|
+
* `subject-filter.ts`: the canvas is type-checked with JSX and a test that
|
|
11
|
+
* imports it is not, so pure rules live where a test can reach them.
|
|
12
|
+
*/
|
|
13
|
+
export function spansNesting(from, to, parentOf) {
|
|
14
|
+
const climbs = (start, target) => {
|
|
15
|
+
// `resolveNestingParents` already refuses to nest a composition cycle, so
|
|
16
|
+
// a cycle should be unreachable here. Guarded anyway: the cost of being
|
|
17
|
+
// wrong is a frozen canvas rather than a bad picture.
|
|
18
|
+
const seen = new Set();
|
|
19
|
+
let at = parentOf.get(start);
|
|
20
|
+
while (at !== undefined && !seen.has(at)) {
|
|
21
|
+
if (at === target)
|
|
22
|
+
return true;
|
|
23
|
+
seen.add(at);
|
|
24
|
+
at = parentOf.get(at);
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
return climbs(from, to) || climbs(to, from);
|
|
29
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* the canvas module registers cytoscape-elk. So the predicate lives in this
|
|
11
11
|
* small pure module and both surfaces import it from here.
|
|
12
12
|
*/
|
|
13
|
-
import type { CanvasNode } from "
|
|
13
|
+
import type { CanvasNode } from "./graph-projection.js";
|
|
14
14
|
/**
|
|
15
15
|
* The slice of a subject the predicate reads — the render data both the
|
|
16
16
|
* canvas and the rail already hold.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed filter text made comparable: trimmed and lowercased, once, so every
|
|
3
|
+
* surface trims the same way before matching.
|
|
4
|
+
*/
|
|
5
|
+
export const normalizeFilterText = (text) => text.trim().toLowerCase();
|
|
6
|
+
/**
|
|
7
|
+
* Whether a subject survives the typed text: case-insensitive, against its
|
|
8
|
+
* id, name, and kind label. `name` and `kindLabel` are `unknown` because the
|
|
9
|
+
* canvas reads them out of cytoscape data, which types nothing.
|
|
10
|
+
*/
|
|
11
|
+
export function subjectMatchesQuickFilter(trimmedLowerFilter, id, name, kindLabel) {
|
|
12
|
+
if (trimmedLowerFilter === "")
|
|
13
|
+
return true;
|
|
14
|
+
if (id.toLowerCase().includes(trimmedLowerFilter))
|
|
15
|
+
return true;
|
|
16
|
+
if (typeof name === "string" &&
|
|
17
|
+
name.toLowerCase().includes(trimmedLowerFilter)) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return (typeof kindLabel === "string" &&
|
|
21
|
+
kindLabel.toLowerCase().includes(trimmedLowerFilter));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* How many of these subjects survive the typed text — the number a tree row
|
|
25
|
+
* shows while the filter narrows (#317). With no text every subject
|
|
26
|
+
* survives, so this is also the plain length.
|
|
27
|
+
*/
|
|
28
|
+
export const countMatchingSubjects = (subjects, filterText) => {
|
|
29
|
+
const needle = normalizeFilterText(filterText);
|
|
30
|
+
return subjects.filter((subject) => subjectMatchesQuickFilter(needle, subject.id, subject.name, subject.kindLabel)).length;
|
|
31
|
+
};
|
|
@@ -27210,7 +27210,7 @@ qh.use = function(e) {
|
|
|
27210
27210
|
return Tn(e);
|
|
27211
27211
|
}, qh.version = qee, qh.stylesheet = qh.Stylesheet = Gh;
|
|
27212
27212
|
//#endregion
|
|
27213
|
-
//#region src/
|
|
27213
|
+
//#region src/nesting-span.ts
|
|
27214
27214
|
function Jh(e, t, n) {
|
|
27215
27215
|
let r = (e, t) => {
|
|
27216
27216
|
let r = /* @__PURE__ */ new Set(), i = n.get(e);
|
|
@@ -27372,7 +27372,7 @@ function ote(e, t, n) {
|
|
|
27372
27372
|
};
|
|
27373
27373
|
}
|
|
27374
27374
|
//#endregion
|
|
27375
|
-
//#region src/
|
|
27375
|
+
//#region src/subject-filter.ts
|
|
27376
27376
|
var Xh = (e) => e.trim().toLowerCase();
|
|
27377
27377
|
function Zh(e, t, n, r) {
|
|
27378
27378
|
return e === "" || t.toLowerCase().includes(e) || typeof n == "string" && n.toLowerCase().includes(e) ? !0 : typeof r == "string" && r.toLowerCase().includes(e);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an edge's two ends are nested one inside the other (#439, ADR 0139).
|
|
3
|
+
*
|
|
4
|
+
* Composition maps onto cytoscape's compound `parent`, so a pair that also
|
|
5
|
+
* carries any OTHER relationship produces an edge from a container to its own
|
|
6
|
+
* child. ELK cannot lay that out: measured on a five-concept model, the
|
|
7
|
+
* container and its child render and every unrelated node loses its geometry.
|
|
8
|
+
*
|
|
9
|
+
* Its own module rather than a helper inside `graph-canvas.tsx`, following
|
|
10
|
+
* `subject-filter.ts`: the canvas is type-checked with JSX and a test that
|
|
11
|
+
* imports it is not, so pure rules live where a test can reach them.
|
|
12
|
+
*/
|
|
13
|
+
export declare function spansNesting(from: string, to: string, parentOf: ReadonlyMap<string, string>): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one substring judgement every surface that filters subjects by typed
|
|
3
|
+
* text shares.
|
|
4
|
+
*
|
|
5
|
+
* #307 extracted the predicate inside `graph-canvas.tsx` so the canvas pass
|
|
6
|
+
* and the shell's empty-state honesty could not drift; #317 lifts it here so
|
|
7
|
+
* the rail's tree filter can share it too. It cannot simply be imported from
|
|
8
|
+
* `graph-canvas.tsx`: the rail's tree model (`view-tree-model.ts`) keeps a
|
|
9
|
+
* zero-dependency discipline — no React, no cytoscape — and merely loading
|
|
10
|
+
* the canvas module registers cytoscape-elk. So the predicate lives in this
|
|
11
|
+
* small pure module and both surfaces import it from here.
|
|
12
|
+
*/
|
|
13
|
+
import type { CanvasNode } from "./graph-projection.js";
|
|
14
|
+
/**
|
|
15
|
+
* The slice of a subject the predicate reads — the render data both the
|
|
16
|
+
* canvas and the rail already hold.
|
|
17
|
+
*/
|
|
18
|
+
export type FilterableSubject = Pick<CanvasNode, "id" | "name" | "kindLabel">;
|
|
19
|
+
/**
|
|
20
|
+
* Typed filter text made comparable: trimmed and lowercased, once, so every
|
|
21
|
+
* surface trims the same way before matching.
|
|
22
|
+
*/
|
|
23
|
+
export declare const normalizeFilterText: (text: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Whether a subject survives the typed text: case-insensitive, against its
|
|
26
|
+
* id, name, and kind label. `name` and `kindLabel` are `unknown` because the
|
|
27
|
+
* canvas reads them out of cytoscape data, which types nothing.
|
|
28
|
+
*/
|
|
29
|
+
export declare function subjectMatchesQuickFilter(trimmedLowerFilter: string, id: string, name: unknown, kindLabel: unknown): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* How many of these subjects survive the typed text — the number a tree row
|
|
32
|
+
* shows while the filter narrows (#317). With no text every subject
|
|
33
|
+
* survives, so this is also the plain length.
|
|
34
|
+
*/
|
|
35
|
+
export declare const countMatchingSubjects: (subjects: readonly FilterableSubject[], filterText: string) => number;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import type { CanvasNode } from "../graph-projection.js";
|
|
16
16
|
import type { Layer } from "../profile.js";
|
|
17
17
|
import type { VisualViewOperation, VisualViewSummary } from "../adapters/visual/protocol-contract.js";
|
|
18
|
-
import { type FilterableSubject } from "
|
|
18
|
+
import { type FilterableSubject } from "../subject-filter.js";
|
|
19
19
|
export declare const VIEWS_ROOT_KEY = "views";
|
|
20
20
|
export declare const MODEL_ROOT_KEY = "model";
|
|
21
21
|
/** Collapse keys are strings so one set holds every branch of both trees. */
|
package/package.json
CHANGED
|
File without changes
|