@yuneta/gobj-ui 7.29.5 → 7.29.7

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.
@@ -4,11 +4,11 @@
4
4
  * Two layouts made for a treedb, and nothing else.
5
5
  *
6
6
  * What a treedb graph IS, once it is folded (treedb_fold_model.js):
7
- * a forest read top to bottom. A main topic is a tree (places:
8
- * country, region, site, building), the other topics hang from its
9
- * nodes through hooks (devices, users, controllers), a record may
10
- * hang from two parents (a device from its place AND its
11
- * controller), and every visible node was reached from a root.
7
+ * a forest read top to bottom. A main topic is a tree (sites:
8
+ * country, region, campus), the other topics hang from its nodes
9
+ * through hooks (devices, notes), a record may hang from two
10
+ * parents of two topics (a device from its site AND its owner),
11
+ * and every visible node was reached from a root.
12
12
  * Tens to a few hundred cards on screen, never the whole store.
13
13
  *
14
14
  * G6's own layouts either do not know that or pay for not knowing:
@@ -30,8 +30,8 @@
30
30
  *
31
31
  * - roots are the nodes with no incoming edge, in node order;
32
32
  * - a node belongs to the FIRST parent that reaches it in a
33
- * breadth-first walk from the roots -- the place, not the
34
- * controller, because the place's column came first -- and the
33
+ * breadth-first walk from the roots -- a device under its site
34
+ * or under its owner, whichever the walk meets first -- and the
35
35
  * other links are drawn as edges across the tree;
36
36
  * - the children of a node are ordered by the HOOK they hang from
37
37
  * (the parent's port order, which is the schema's column order)
@@ -44,7 +44,7 @@
44
44
  * between them. O(n), and opening a hook moves NOTHING that is
45
45
  * not below or beside it -- the cards keep their order, the eye
46
46
  * keeps its place. It reads DOWN because that is the direction a
47
- * tree with many children has room in: a building with a hundred
47
+ * tree with many children has room in: a site with a hundred
48
48
  * devices is a wide row, not a tall column beside a card. (The
49
49
  * left-to-right reading is `direction: "LR"`, kept for a host
50
50
  * that wants it; `dagre` reads that way in the graph.)
@@ -296,7 +296,7 @@ function extent_at(n, a)
296
296
  * subtree gets an angular SECTOR proportional to its leaves, a node
297
297
  * sits in the middle of its sector, and the radius of each ring is
298
298
  * the larger of "one step further out than the ring before" and
299
- * "long enough for its nodes to sit side by side" -- so a building
299
+ * "long enough for its nodes to sit side by side" -- so a site
300
300
  * with a hundred devices is a wide, sparse fan, and nothing
301
301
  * overlaps by construction. Several roots share the circle around
302
302
  * a virtual centre.
@@ -9,20 +9,20 @@ import { describe, test, expect } from "vitest";
9
9
  import { spanning_tree, layout_tree, layout_radial } from "./treedb_layout.js";
10
10
 
11
11
  /* region -> (north, south); north -> site; site -> d0, d1 (hook rank 1) and
12
- * c1 (hook rank 2); c1 -> d0 as well (second parent). */
12
+ * x1 (hook rank 2); x1 -> d0 as well (second parent). */
13
13
  const N = (id, w, h) => ({id, w, h});
14
14
  const nodes = [
15
15
  N("region", 172, 96), N("north", 172, 96), N("south", 172, 96), N("site", 172, 120),
16
- N("d0", 116, 40), N("d1", 116, 40), N("c1", 172, 96),
16
+ N("d0", 116, 40), N("d1", 116, 40), N("x1", 172, 96),
17
17
  ];
18
18
  const edges = [
19
19
  {source: "region", target: "north", rank: 0},
20
20
  {source: "region", target: "south", rank: 0},
21
21
  {source: "north", target: "site", rank: 0},
22
- {source: "site", target: "c1", rank: 2},
22
+ {source: "site", target: "x1", rank: 2},
23
23
  {source: "site", target: "d0", rank: 1},
24
24
  {source: "site", target: "d1", rank: 1},
25
- {source: "c1", target: "d0", rank: 0},
25
+ {source: "x1", target: "d0", rank: 0},
26
26
  ];
27
27
 
28
28
  describe("the spanning tree", () => {
@@ -35,13 +35,13 @@ describe("the spanning tree", () => {
35
35
 
36
36
  test("children are ordered by hook rank, then by node order", () => {
37
37
  let t = spanning_tree(nodes, edges);
38
- expect(t.children.get("site")).toEqual(["d0", "d1", "c1"]);
38
+ expect(t.children.get("site")).toEqual(["d0", "d1", "x1"]);
39
39
  expect(t.children.get("region")).toEqual(["north", "south"]);
40
40
  });
41
41
 
42
42
  test("a node with two parents belongs to the first that reaches it", () => {
43
43
  let t = spanning_tree(nodes, edges);
44
- expect(t.children.get("c1")).toEqual([]); /* d0 is site's */
44
+ expect(t.children.get("x1")).toEqual([]); /* d0 is site's */
45
45
  expect(t.depth.get("d0")).toBe(3);
46
46
  });
47
47
 
@@ -71,20 +71,20 @@ describe("the tidy tree, read down (the default)", () => {
71
71
  expect(pos.get("south").y).toBe(pos.get("north").y);
72
72
  /* depth 2 holds site (120 tall): the row is 120 tall */
73
73
  expect(pos.get("site").y).toBe(2 * (96 + 100) + 60);
74
- /* depth 3 holds chips (40) and c1 (96): row is 96 tall, the
74
+ /* depth 3 holds chips (40) and x1 (96): row is 96 tall, the
75
75
  * chips are centred in it */
76
76
  let row3 = 2 * (96 + 100) + 120 + 100;
77
- expect(pos.get("c1").y).toBe(row3 + 48);
77
+ expect(pos.get("x1").y).toBe(row3 + 48);
78
78
  expect(pos.get("d0").y).toBe(row3 + 48);
79
79
  });
80
80
 
81
81
  test("siblings sit side by side; a parent is centred over its children", () => {
82
82
  let pos = layout_tree(nodes, edges, {nodesep: 10, ranksep: 100});
83
- /* site's children: d0 (116), d1 (116), c1 (172) = 424 wide */
83
+ /* site's children: d0 (116), d1 (116), x1 (172) = 424 wide */
84
84
  expect(pos.get("d1").x - pos.get("d0").x).toBe(126);
85
- expect(pos.get("c1").x - pos.get("d1").x).toBe(58 + 10 + 86);
85
+ expect(pos.get("x1").x - pos.get("d1").x).toBe(58 + 10 + 86);
86
86
  let first = pos.get("d0").x - 58;
87
- let last = pos.get("c1").x + 86;
87
+ let last = pos.get("x1").x + 86;
88
88
  expect(pos.get("site").x).toBe((first + last) / 2);
89
89
  });
90
90
 
@@ -103,20 +103,20 @@ describe("the tidy tree, read right", () => {
103
103
  expect(pos.get("region").x).toBe(86); /* 172/2 */
104
104
  expect(pos.get("north").x).toBe(172 + 100 + 86);
105
105
  expect(pos.get("south").x).toBe(pos.get("north").x);
106
- /* depth 3 holds chips (116) and c1 (172): column is 172 wide,
106
+ /* depth 3 holds chips (116) and x1 (172): column is 172 wide,
107
107
  * the chips are centred in it */
108
108
  let col3 = 3 * (172 + 100);
109
- expect(pos.get("c1").x).toBe(col3 + 86);
109
+ expect(pos.get("x1").x).toBe(col3 + 86);
110
110
  expect(pos.get("d0").x).toBe(col3 + 86);
111
111
  });
112
112
 
113
113
  test("siblings stack with the gap; a parent is centred on its children", () => {
114
114
  let pos = layout_tree(nodes, edges, {nodesep: 10, ranksep: 100, direction: "LR"});
115
- /* site's children: d0 (40), d1 (40), c1 (96) = 196 tall */
115
+ /* site's children: d0 (40), d1 (40), x1 (96) = 196 tall */
116
116
  expect(pos.get("d1").y - pos.get("d0").y).toBe(50);
117
- expect(pos.get("c1").y - pos.get("d1").y).toBe(20 + 10 + 48);
117
+ expect(pos.get("x1").y - pos.get("d1").y).toBe(20 + 10 + 48);
118
118
  let first = pos.get("d0").y - 20;
119
- let last = pos.get("c1").y + 48;
119
+ let last = pos.get("x1").y + 48;
120
120
  expect(pos.get("site").y).toBe((first + last) / 2);
121
121
  });
122
122
 
@@ -146,7 +146,7 @@ describe("the tidy tree, read right", () => {
146
146
  expect(pos.get("d0").y).toBe(base.get("d0").y); /* above the new one */
147
147
  expect(pos.get("d1").y).toBe(base.get("d1").y);
148
148
  expect(pos.get("d2").y).toBe(base.get("d1").y + 50);
149
- expect(pos.get("c1").y).toBe(base.get("c1").y + 50); /* pushed down, in order */
149
+ expect(pos.get("x1").y).toBe(base.get("x1").y + 50); /* pushed down, in order */
150
150
  });
151
151
  });
152
152
 
package/src/yui_dev.js CHANGED
@@ -1455,7 +1455,7 @@ function refresh_dev_chrome()
1455
1455
  }
1456
1456
 
1457
1457
  /* The payload of a FOLDED entry as text, the way it is on screen: one line
1458
- * per row, a closed branch as its one-line summary (`data {places: […], …}`)
1458
+ * per row, a closed branch as its one-line summary (`data {sites: […], …}`)
1459
1459
  * and only an OPENED branch with its content, four characters further in.
1460
1460
  *
1461
1461
  * Read from the painted DOM and not from the payload, because whether a
@@ -39,12 +39,12 @@ describe("entry_shown_lines", () => {
39
39
  const $e = painted({
40
40
  result: 0,
41
41
  comment: "db_history^7301: 500 nodes",
42
- data: {places: [1, 2, 3], families: [4], devices: [5, 6]},
42
+ data: {sites: [1, 2, 3], buildings: [4], devices: [5, 6]},
43
43
  });
44
44
  expect(entry_shown_lines($e)).toEqual([
45
45
  " • result: 0",
46
46
  " • comment: db_history^7301: 500 nodes",
47
- " ▸ data {places:[…],families:[…],devices:[…]}",
47
+ " ▸ data {sites:[…],buildings:[…],devices:[…]}",
48
48
  ]);
49
49
  });
50
50
 
package/src/yui_icons.css CHANGED
@@ -351,9 +351,8 @@
351
351
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath d='M267.5 440.6c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29l0-320c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4l-192 160L64 241l0-145c0-17.7-14.3-32-32-32S0 78.3 0 96L0 416c0 17.7 14.3 32 32 32s32-14.3 32-32l0-145 11.5 9.6 192 160z'/%3E%3C/svg%3E");
352
352
  }
353
353
 
354
- /* yi-bolt / yi-droplet: hand-drawn masks. Added for the node-tree
355
- * demo, but they earn their place in the set on their own: energy and
356
- * water are two of the meter families the AMR apps read. */
354
+ /* yi-bolt / yi-droplet: hand-drawn masks, for electricity and water:
355
+ * a supply, a measure or a section of either. */
357
356
  .yi-bolt::before {
358
357
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M300 0 60 288l140 0-50 224 240-288-140 0z'/%3E%3C/svg%3E");
359
358
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M300 0 60 288l140 0-50 224 240-288-140 0z'/%3E%3C/svg%3E");
@@ -631,8 +630,8 @@
631
630
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M176 24c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c-35.3 0-64 28.7-64 64l-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0c0 35.3 28.7 64 64 64l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40c35.3 0 64-28.7 64-64l40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0c0-35.3-28.7-64-64-64l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40zM160 128l192 0c17.7 0 32 14.3 32 32l0 192c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-192c0-17.7 14.3-32 32-32zm16 48l0 160 160 0 0-160-160 0z'/%3E%3C/svg%3E");
632
631
  }
633
632
 
634
- /* A controller, a box in the field: the server (FontAwesome Free
635
- * 7.3.1). */
633
+ /* A server: a machine that serves others, a rack unit (FontAwesome
634
+ * Free 7.3.1). */
636
635
  .yi-server::before {
637
636
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M64 32C28.7 32 0 60.7 0 96l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 32zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0zM64 288c-35.3 0-64 28.7-64 64l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 288zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0z'/%3E%3C/svg%3E");
638
637
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M64 32C28.7 32 0 60.7 0 96l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 32zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0zM64 288c-35.3 0-64 28.7-64 64l0 64c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-64c0-35.3-28.7-64-64-64L64 288zm216 72a24 24 0 1 1 0 48 24 24 0 1 1 0-48zm56 24a24 24 0 1 1 48 0 24 24 0 1 1 -48 0z'/%3E%3C/svg%3E");
@@ -764,7 +763,7 @@
764
763
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z'/%3E%3C/svg%3E");
765
764
  }
766
765
 
767
- /* A hierarchy of groups to file things in -- zones, places: the tree of
766
+ /* A hierarchy of groups to file things in -- zones, sites: the tree of
768
767
  * folders of Windows Explorer, VS Code or Drive. The sitemap is the site
769
768
  * map (FontAwesome Free 7.3.1). */
770
769
  .yi-folder-tree::before {
@@ -4,23 +4,23 @@ import {row_matches, is_fkey_ref, is_hook_size} from "./yui_row_search.js";
4
4
 
5
5
  describe("row_matches", () => {
6
6
  const row = {
7
- id: "E00000042",
7
+ id: "D00000042",
8
8
  name: "",
9
- place: [
9
+ site: [
10
10
  {
11
- id: "es.city.site-a.local-13-gate",
12
- topic_name: "places",
11
+ id: "north.campus-a.room-13",
12
+ topic_name: "sites",
13
13
  hook_name: "devices"
14
14
  }
15
15
  ],
16
- tension: 400,
16
+ capacity: 400,
17
17
  enabled: true,
18
18
  _operation: "hidden",
19
19
  __md_treedb__: {topic_name: "devices"}
20
20
  };
21
21
 
22
22
  it("finds a plain field", () => {
23
- expect(row_matches(row, "e00000042")).toBe(true);
23
+ expect(row_matches(row, "d00000042")).toBe(true);
24
24
  });
25
25
 
26
26
  it("finds a number", () => {
@@ -28,13 +28,13 @@ describe("row_matches", () => {
28
28
  });
29
29
 
30
30
  it("finds a value INSIDE an fkey, which is the whole point", () => {
31
- expect(row_matches(row, "local-13-gate")).toBe(true);
31
+ expect(row_matches(row, "room-13")).toBe(true);
32
32
  });
33
33
 
34
34
  it("does NOT match the structural halves of an fkey", () => {
35
35
  /* `topic_name`/`hook_name` are the same two words on every row:
36
36
  * matching them turns the term into a wildcard. */
37
- expect(row_matches(row, "places")).toBe(false);
37
+ expect(row_matches(row, "sites")).toBe(false);
38
38
  expect(row_matches(row, "hook")).toBe(false);
39
39
  });
40
40
 
@@ -56,14 +56,14 @@ describe("row_matches, on a table loaded with hook_size", () => {
56
56
  /* What a topic table gets since 7.23.163: the hook is the COUNT
57
57
  * of its children, not their ids. */
58
58
  const row = {
59
- id: "places-madrid",
60
- name: "Madrid",
59
+ id: "sites-north",
60
+ name: "North",
61
61
  devices: [{size: 400}],
62
- __md_treedb__: {topic_name: "places"}
62
+ __md_treedb__: {topic_name: "sites"}
63
63
  };
64
64
 
65
65
  it("does NOT match the count of a hook", () => {
66
- /* It did, and "400" then answered every place holding 400
66
+ /* It did, and "400" then answered every site holding 400
67
67
  * devices together with the ones that really say 400. */
68
68
  expect(row_matches(row, "400")).toBe(false);
69
69
  expect(row_matches(row, "40")).toBe(false);
@@ -71,19 +71,19 @@ describe("row_matches, on a table loaded with hook_size", () => {
71
71
  });
72
72
 
73
73
  it("still matches the rest of the row", () => {
74
- expect(row_matches(row, "madrid")).toBe(true);
74
+ expect(row_matches(row, "north")).toBe(true);
75
75
  });
76
76
 
77
77
  it("still walks a hook that DID come with its children", () => {
78
78
  /* A node event carries whole hooks whatever the table asked
79
79
  * for, so both shapes reach this row. */
80
80
  const loaded = {
81
- id: "places-madrid",
81
+ id: "sites-north",
82
82
  devices: [
83
- {id: "E00000042", topic_name: "devices", hook_name: "places"}
83
+ {id: "D00000042", topic_name: "devices", hook_name: "sites"}
84
84
  ]
85
85
  };
86
- expect(row_matches(loaded, "e00000042")).toBe(true);
86
+ expect(row_matches(loaded, "d00000042")).toBe(true);
87
87
  });
88
88
  });
89
89
 
@@ -70,8 +70,8 @@ describe("yui_shell_last_route_under", () => {
70
70
 
71
71
  describe("yui_shell_previous_route", () => {
72
72
  it("answers the route before the current one, as browser Back does", () => {
73
- const s = shell(["/topics", "/topics/device_types", "/topics/devices"]);
74
- expect(yui_shell_previous_route(s)).toBe("/topics/device_types");
73
+ const s = shell(["/topics", "/topics/models", "/topics/devices"]);
74
+ expect(yui_shell_previous_route(s)).toBe("/topics/models");
75
75
  });
76
76
 
77
77
  it("goes back to the previous record, not past it", () => {