@yuneta/gobj-ui 7.31.7 → 7.32.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/README.md CHANGED
@@ -761,11 +761,14 @@ under the card — they sit ON the border.
761
761
  **A click on an edge lights it** (`7.31.5`), as in the schema and treedb
762
762
  graphs: the line in amber, its two cards ringed with it, and the row of the
763
763
  parent's key the line leaves from washed. A second click on it, or a click on
764
- the canvas, puts it out; so does a fold that takes its child card away, and a
765
- new document. The cards are html, where G6 paints no state, so the lit edge is
766
- BAKED into the drawing like a find match (a rebuild that keeps the camera), and
767
- it is kept by the path of its child card, which survives a rebuild where the
768
- ids do not. An edge takes a click 7px either side of its line. The zoom goes
764
+ the canvas, puts it out. A fold that takes its child card away puts it out
765
+ too, and so does a new document. The edge gets the G6 state `lit`. The cards are html, and G6
766
+ paints no state on html, so the two cards get new html (`updateNodeData`), and
767
+ nothing else is drawn again. The schema graph and the treedb graph do the same.
768
+ Up to `7.31.7` each click built the whole drawing again and ran the layout. A
769
+ rebuild (a fold, a find, a theme change) lights the edge again: the edge is
770
+ kept by the path of its child card, because a rebuild keeps the paths and
771
+ changes the ids. An edge takes a click 7px either side of its line. The zoom goes
769
772
  down to 2% (`10%` before, where a document of a few hundred cards did not fit),
770
773
  and a **minimap** (bottom left, the library's `yui_graph_minimap.js`) appears
771
774
  from `minimap_min_nodes` cards on (default `10`).
@@ -2686,8 +2689,9 @@ like this:
2686
2689
 
2687
2690
  and its card draws the row `version (2)`. An empty `tkey` marks no field.
2688
2691
 
2689
- The topic cards (`C_YUI_TREEDB_TOPICS`) and its topic-info panel say the same
2690
- keys. A card of a topic with `pkey2s` has a `pkey2s` line under its version and
2692
+ The topic cards (`C_YUI_TREEDB_TOPICS`) are in alphabetical order, and so
2693
+ are its tabs (7.32.0+). The system topics (`__*__`) come first. The topic
2694
+ cards and the topic-info panel say the same keys. A card of a topic with `pkey2s` has a `pkey2s` line under its version and
2691
2695
  column count. The info panel always has a `tkey` row, which says *append time*
2692
2696
  when the topic has none, a `pkey2s` row when the topic has secondary keys, and
2693
2697
  `system` by the flag names (`sf_string_key`), not by the number. In its column
@@ -6051,6 +6055,11 @@ Three facts the text does not show:
6051
6055
 
6052
6056
  - **The zone is the browser's**, and the text names no zone and no offset. Two
6053
6057
  readers in two zones see two different clocks for the same record.
6058
+ - **One formatter for each language and time zone** (`7.31.8`). The function
6059
+ builds an `Intl.DateTimeFormat` the first time, and uses it again after that.
6060
+ A new language or a new zone gets a new one. A filter over a time column of
6061
+ 10 000 rows takes 16 ms for each key, and took 350 ms when each call built
6062
+ its own formatter.
6054
6063
  - **The hour that repeats in autumn reads the same in its two passes**: in
6055
6064
  Europe/Madrid, `1792888200` and `1792891800` both read
6056
6065
  `25 oct 2026, 02:30:00`.
@@ -10499,6 +10499,19 @@ var DATE_TIME_OPTIONS = {
10499
10499
  second: "2-digit",
10500
10500
  hourCycle: "h23"
10501
10501
  };
10502
+ var __date_time_formatters__ = /* @__PURE__ */ new Map();
10503
+ var JANUARY = new Date(Date.UTC(2026, 0, 1));
10504
+ var JULY = new Date(Date.UTC(2026, 6, 1));
10505
+ function date_time_formatter(locale) {
10506
+ let loc = safe_locale(locale);
10507
+ let key = `${loc}|${JANUARY.getTimezoneOffset()}|${JULY.getTimezoneOffset()}`;
10508
+ let f = __date_time_formatters__.get(key);
10509
+ if (!f) {
10510
+ f = date_time_format(loc, DATE_TIME_OPTIONS);
10511
+ __date_time_formatters__.set(key, f);
10512
+ }
10513
+ return f;
10514
+ }
10502
10515
  /***************************************************************
10503
10516
  * A moment as a VIEW shows it as text: the day, the month and the
10504
10517
  * year, then the clock of 24 hours with its seconds, in the APP's
@@ -10509,7 +10522,8 @@ var DATE_TIME_OPTIONS = {
10509
10522
  * fmt_date_time(d, "en") -> "Oct 14, 2026, 15:05:09"
10510
10523
  *
10511
10524
  * "" for anything that is not a valid Date. A locale Intl refuses
10512
- * writes in the environment's (date_time_format).
10525
+ * writes in the environment's (date_time_format). The formatter is
10526
+ * built once per locale and time zone (date_time_formatter).
10513
10527
  *
10514
10528
  * The time cells of C_YUI_FORM and C_YUI_TREEDB_TOPIC_WITH_FORM and
10515
10529
  * the reading C_YUI_JSON writes beside a time field all come from
@@ -10517,7 +10531,7 @@ var DATE_TIME_OPTIONS = {
10517
10531
  ***************************************************************/
10518
10532
  function fmt_date_time(date, locale) {
10519
10533
  if (!(date instanceof Date) || isNaN(date.getTime())) return "";
10520
- return date_time_format(locale, DATE_TIME_OPTIONS).format(date);
10534
+ return date_time_formatter(locale).format(date);
10521
10535
  }
10522
10536
  /************************************************************
10523
10537
  * JSON type discriminator (viewer vocabulary)
@@ -44593,7 +44607,9 @@ var PRIVATE_DATA$14 = {
44593
44607
  lit_path: "",
44594
44608
  lit_parent_path: "",
44595
44609
  lit_port: "",
44596
- lit_found: false
44610
+ lit_found: false,
44611
+ lit_edge_id: "",
44612
+ cards: null
44597
44613
  };
44598
44614
  var __gclass__$14 = null;
44599
44615
  var __layout_registered__$1 = false;
@@ -44985,7 +45001,20 @@ function build_graph$4(gobj) {
44985
45001
  stroke: "#999",
44986
45002
  lineWidth: 1,
44987
45003
  endArrow: true
44988
- }
45004
+ },
45005
+ state: { lit: () => {
45006
+ let dark = yui_is_dark();
45007
+ let lit_color = dark ? LIT_COLOR_DARK$1 : LIT_COLOR_LIGHT$1;
45008
+ return {
45009
+ stroke: lit_color,
45010
+ lineWidth: 3,
45011
+ halo: true,
45012
+ haloStroke: dark ? LIT_HALO_DARK$1 : LIT_HALO_LIGHT$1,
45013
+ haloLineWidth: 8,
45014
+ endArrowFill: lit_color,
45015
+ endArrowStroke: lit_color
45016
+ };
45017
+ } }
44989
45018
  },
44990
45019
  layout: layout_cfg.g6_layout,
44991
45020
  behaviors: BEHAVIORS_READING$1.slice()
@@ -45194,19 +45223,19 @@ function get_group_label(path) {
45194
45223
  return path;
45195
45224
  }
45196
45225
  /************************************************************
45197
- * Recursively build nodes and edges from JSON
45226
+ * The rows of the card of `path`: one per key of `kw`, the
45227
+ * containers among them (`pending_complex`, each with the port
45228
+ * and the row it opens), and how many rows the find matched.
45198
45229
  ************************************************************/
45199
- function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port) {
45200
- let group_id = gen_node_id$1(gobj);
45201
- let is_dict = (0, _yuneta_gobj_js.is_object)(kw);
45202
- let is_list = (0, _yuneta_gobj_js.is_array)(kw);
45203
- if (!is_dict && !is_list) return null;
45230
+ function card_rows_of(gobj, path, kw) {
45204
45231
  let priv = gobj.priv;
45232
+ let is_dict = (0, _yuneta_gobj_js.is_object)(kw);
45205
45233
  let needle = priv.search || "";
45206
45234
  let dark = yui_is_dark();
45207
45235
  let lines = [];
45208
45236
  let pending_complex = [];
45209
45237
  let card_matched = false;
45238
+ let matches = 0;
45210
45239
  let colors = json_card_style(is_dict ? GROUP_COLORS.dict : GROUP_COLORS.list, dark);
45211
45240
  let entries = is_dict ? Object.entries(kw) : kw.map((v, i) => [i, v]);
45212
45241
  for (let [key, value] of entries) {
@@ -45214,7 +45243,7 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45214
45243
  let matched = cell_matches(key, value, type, needle);
45215
45244
  if (matched) {
45216
45245
  card_matched = true;
45217
- priv.match_count++;
45246
+ matches++;
45218
45247
  }
45219
45248
  let fold = null;
45220
45249
  if (has_branch(value)) {
@@ -45236,21 +45265,37 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45236
45265
  }
45237
45266
  lines.push(build_cell_html(key, value, type, dark, matched, fold));
45238
45267
  }
45239
- if (parent_id && is_pure_collection(kw)) {
45240
- if (priv.collapsed.has(path)) {
45241
- push_fold_phantom(gobj, path, parent_id, parent_port, nodes, edges);
45242
- return parent_id;
45243
- }
45244
- for (let pending of pending_complex) build_json_nodes(gobj, add_segment(path, pending.key), pending.value, nodes, edges, parent_id, parent_port);
45245
- return parent_id;
45246
- }
45268
+ return {
45269
+ is_dict,
45270
+ dark,
45271
+ colors,
45272
+ lines,
45273
+ pending_complex,
45274
+ card_matched,
45275
+ matches
45276
+ };
45277
+ }
45278
+ /************************************************************
45279
+ * The html of the card of `path`, from its rows (card_rows_of),
45280
+ * lit or not as priv.lit_* says now. The build draws every card
45281
+ * with it, and repaint_cards() one card alone: the same moment
45282
+ * reads the same either way.
45283
+ ************************************************************/
45284
+ function card_html_of(gobj, path, rows, has_parent) {
45285
+ let priv = gobj.priv;
45286
+ let is_dict = rows.is_dict;
45287
+ let dark = rows.dark;
45288
+ let colors = rows.colors;
45289
+ let lines = rows.lines;
45290
+ let pending_complex = rows.pending_complex;
45291
+ let card_matched = rows.card_matched;
45247
45292
  let label = get_group_label(path) || (is_dict ? "{}" : "[]");
45248
45293
  let foldable = pending_complex.length > 0;
45249
45294
  let folded = foldable && priv.collapsed.has(path);
45250
45295
  let border_color = card_matched ? dark ? "#ffb300" : "#ff8f00" : colors.border;
45251
45296
  let border_width = card_matched ? 2 : 1;
45252
45297
  let lit_color = dark ? LIT_COLOR_DARK$1 : LIT_COLOR_LIGHT$1;
45253
- let lit_child = !!parent_id && !(0, _yuneta_gobj_js.empty_string)(priv.lit_path) && path === priv.lit_path;
45298
+ let lit_child = has_parent && !(0, _yuneta_gobj_js.empty_string)(priv.lit_path) && path === priv.lit_path;
45254
45299
  let lit_row = -1;
45255
45300
  let lit_parent = !(0, _yuneta_gobj_js.empty_string)(priv.lit_path) && path === priv.lit_parent_path;
45256
45301
  if (lit_parent) {
@@ -45260,7 +45305,6 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45260
45305
  }
45261
45306
  }
45262
45307
  let lit_card = lit_child || lit_parent;
45263
- if (lit_child) priv.lit_found = true;
45264
45308
  if (lit_card) {
45265
45309
  border_color = lit_color;
45266
45310
  border_width = 3;
@@ -45270,7 +45314,8 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45270
45314
  }).join("");
45271
45315
  let min_width = Math.max(180, label.length * 9);
45272
45316
  let card_height = CARD_HEADER_H$1 + lines.length * CARD_ROW_H$1;
45273
- let node_html = `
45317
+ return {
45318
+ node_html: `
45274
45319
  <div class="JSON_CARD" data-json-path="${(0, _yuneta_gobj_js.escapeHtml)(path)}" style="
45275
45320
  min-width: ${min_width}px;
45276
45321
  background: ${colors.bg};
@@ -45291,7 +45336,41 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45291
45336
  gap: 6px;
45292
45337
  ">${FOLD_SPACER}<span style="flex:1 1 auto; text-align:center;">${(0, _yuneta_gobj_js.escapeHtml)(label)}</span>${fold_toggle_html(path, foldable, folded, pending_complex.length, colors)}</div>
45293
45338
  ${content_html}
45294
- </div>`;
45339
+ </div>`,
45340
+ min_width,
45341
+ card_height,
45342
+ folded,
45343
+ lit_child
45344
+ };
45345
+ }
45346
+ /************************************************************
45347
+ * Recursively build nodes and edges from JSON
45348
+ ************************************************************/
45349
+ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port) {
45350
+ let group_id = gen_node_id$1(gobj);
45351
+ let is_dict = (0, _yuneta_gobj_js.is_object)(kw);
45352
+ let is_list = (0, _yuneta_gobj_js.is_array)(kw);
45353
+ if (!is_dict && !is_list) return null;
45354
+ let priv = gobj.priv;
45355
+ let rows = card_rows_of(gobj, path, kw);
45356
+ let dark = rows.dark;
45357
+ let colors = rows.colors;
45358
+ let pending_complex = rows.pending_complex;
45359
+ priv.match_count += rows.matches;
45360
+ if (parent_id && is_pure_collection(kw)) {
45361
+ if (priv.collapsed.has(path)) {
45362
+ push_fold_phantom(gobj, path, parent_id, parent_port, nodes, edges);
45363
+ return parent_id;
45364
+ }
45365
+ for (let pending of pending_complex) build_json_nodes(gobj, add_segment(path, pending.key), pending.value, nodes, edges, parent_id, parent_port);
45366
+ return parent_id;
45367
+ }
45368
+ let card = card_html_of(gobj, path, rows, !!parent_id);
45369
+ let folded = card.folded;
45370
+ let lit_child = card.lit_child;
45371
+ let min_width = card.min_width;
45372
+ let card_height = card.card_height;
45373
+ if (lit_child) priv.lit_found = true;
45295
45374
  let ports = [];
45296
45375
  if (parent_id) ports.push({
45297
45376
  key: "in",
@@ -45317,7 +45396,7 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45317
45396
  is_dict
45318
45397
  },
45319
45398
  style: {
45320
- innerHTML: node_html,
45399
+ innerHTML: card.node_html,
45321
45400
  size: [min_width, card_height],
45322
45401
  dx: -(min_width / 2),
45323
45402
  dy: -(card_height / 2),
@@ -45328,8 +45407,14 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45328
45407
  }
45329
45408
  };
45330
45409
  nodes.push(node);
45410
+ priv.cards.set(path, {
45411
+ id: group_id,
45412
+ kw,
45413
+ has_parent: !!parent_id
45414
+ });
45331
45415
  if (parent_id) {
45332
45416
  let edge = {
45417
+ id: "je-" + group_id,
45333
45418
  source: parent_id,
45334
45419
  target: group_id,
45335
45420
  style: {
@@ -45344,15 +45429,10 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
45344
45429
  }
45345
45430
  };
45346
45431
  if (parent_port) edge.style.sourcePort = parent_port;
45347
- if (lit_child) Object.assign(edge.style, {
45348
- stroke: lit_color,
45349
- lineWidth: 3,
45350
- halo: true,
45351
- haloStroke: dark ? LIT_HALO_DARK$1 : LIT_HALO_LIGHT$1,
45352
- haloLineWidth: 8,
45353
- endArrowFill: lit_color,
45354
- endArrowStroke: lit_color
45355
- });
45432
+ if (lit_child) {
45433
+ edge.states = ["lit"];
45434
+ priv.lit_edge_id = edge.id;
45435
+ }
45356
45436
  edges.push(edge);
45357
45437
  }
45358
45438
  if (folded) {
@@ -45425,6 +45505,8 @@ function load_json(gobj) {
45425
45505
  priv.node_counter = 0;
45426
45506
  priv.match_count = 0;
45427
45507
  priv.lit_found = false;
45508
+ priv.lit_edge_id = "";
45509
+ priv.cards = /* @__PURE__ */ new Map();
45428
45510
  let nodes = [];
45429
45511
  let edges = [];
45430
45512
  build_json_nodes(gobj, path, json, nodes, edges, null);
@@ -45628,6 +45710,86 @@ function refresh_json(gobj, opts) {
45628
45710
  }
45629
45711
  }
45630
45712
  /************************************************************
45713
+ * Repaint the cards of these paths alone, lit or not as
45714
+ * priv.lit_* says now, and draw once. A click on an edge
45715
+ * changes two cards: rebuilding the graph for them redrew
45716
+ * every card, the layout and the camera's frame.
45717
+ ************************************************************/
45718
+ function repaint_cards$2(gobj, paths) {
45719
+ let priv = gobj.priv;
45720
+ let graph = priv.graph;
45721
+ if (!graph || !priv.cards) return;
45722
+ let updates = [];
45723
+ for (let path of paths) {
45724
+ let c = priv.cards.get(path);
45725
+ if (!c) continue;
45726
+ let card = card_html_of(gobj, path, card_rows_of(gobj, path, c.kw), c.has_parent);
45727
+ updates.push({
45728
+ id: c.id,
45729
+ style: { innerHTML: card.node_html }
45730
+ });
45731
+ }
45732
+ try {
45733
+ if (updates.length) graph.updateNodeData(updates);
45734
+ Promise.resolve(graph.draw()).then(() => {
45735
+ paint_anchor_mark$1(gobj);
45736
+ }).catch((e) => {
45737
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: redraw failed: ${e}`);
45738
+ });
45739
+ } catch (e) {
45740
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot repaint the cards: ${e}`);
45741
+ }
45742
+ }
45743
+ /************************************************************
45744
+ * Put the lit edge out: its state off, and the paths of its
45745
+ * two cards returned, to be repainted plain. Draws nothing:
45746
+ * the caller repaints once, and two draws race. [] when
45747
+ * nothing is lit.
45748
+ ************************************************************/
45749
+ function put_out_edge(gobj) {
45750
+ let priv = gobj.priv;
45751
+ let graph = priv.graph;
45752
+ if ((0, _yuneta_gobj_js.empty_string)(priv.lit_path)) return [];
45753
+ let paths = [priv.lit_path, priv.lit_parent_path];
45754
+ let edge_id = priv.lit_edge_id;
45755
+ priv.lit_path = "";
45756
+ priv.lit_parent_path = "";
45757
+ priv.lit_port = "";
45758
+ priv.lit_edge_id = "";
45759
+ if (graph && !(0, _yuneta_gobj_js.empty_string)(edge_id)) try {
45760
+ graph.updateData({ edges: [{
45761
+ id: edge_id,
45762
+ states: []
45763
+ }] });
45764
+ } catch (e) {
45765
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: edge state not cleared: ${e}`);
45766
+ }
45767
+ return paths;
45768
+ }
45769
+ /************************************************************
45770
+ * Light an edge: its `lit` state on, and the paths of its two
45771
+ * cards returned, to be repainted with the ring (the parent's
45772
+ * row of the key it leaves from washed). The cards are html,
45773
+ * where G6 paints no state, so their mark is in their html.
45774
+ * Draws nothing, as put_out_edge().
45775
+ ************************************************************/
45776
+ function light_edge$2(gobj, edge_id, child_path, parent_path, port) {
45777
+ let priv = gobj.priv;
45778
+ priv.lit_path = child_path;
45779
+ priv.lit_parent_path = parent_path;
45780
+ priv.lit_port = port;
45781
+ priv.lit_edge_id = edge_id;
45782
+ try {
45783
+ priv.graph.updateData({ edges: [{
45784
+ id: edge_id,
45785
+ states: ["lit"]
45786
+ }] });
45787
+ } catch (e) {
45788
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: edge state not set: ${e}`);
45789
+ }
45790
+ return [child_path, parent_path];
45791
+ }
45792
+ /************************************************************
45631
45793
  * Custom tree layout for JSON visualization
45632
45794
  ************************************************************/
45633
45795
  var JsonTreeLayout = class extends _antv_g6.BaseLayout {
@@ -45728,6 +45890,7 @@ function ac_load_data$1(gobj, event, kw, src) {
45728
45890
  gobj.priv.lit_path = "";
45729
45891
  gobj.priv.lit_parent_path = "";
45730
45892
  gobj.priv.lit_port = "";
45893
+ gobj.priv.lit_edge_id = "";
45731
45894
  }
45732
45895
  refresh_json(gobj);
45733
45896
  return 0;
@@ -45845,10 +46008,10 @@ function ac_collapse_all$2(gobj, event, kw, src) {
45845
46008
  * EV_EDGE_CLICK { id }
45846
46009
  *
45847
46010
  * Light the edge and its two ends, or put it out when it is
45848
- * the lit one. Baked into the drawing, like a find match: the
45849
- * cards are html, where G6 paints no state, so the drawing is
45850
- * rebuilt with the camera kept. The edge is kept by the PATH
45851
- * of its child card, which a rebuild keeps and the ids do not.
46011
+ * the lit one. Only the edge and its two cards are redrawn
46012
+ * (light_edge). The edge is kept by the PATH of its child
46013
+ * card, which a rebuild (a fold, a find) keeps and the ids do
46014
+ * not: the rebuild lights it again.
45852
46015
  ************************************************************/
45853
46016
  function ac_edge_click$2(gobj, event, kw, src) {
45854
46017
  let priv = gobj.priv;
@@ -45867,16 +46030,10 @@ function ac_edge_click$2(gobj, event, kw, src) {
45867
46030
  }
45868
46031
  let tdata = target && target.data || {};
45869
46032
  if (tdata.phantom || (0, _yuneta_gobj_js.empty_string)(tdata.path)) return 0;
45870
- if (priv.lit_path === tdata.path) {
45871
- priv.lit_path = "";
45872
- priv.lit_parent_path = "";
45873
- priv.lit_port = "";
45874
- } else {
45875
- priv.lit_path = tdata.path;
45876
- priv.lit_parent_path = source && source.data && source.data.path || "";
45877
- priv.lit_port = edge.style && edge.style.sourcePort || "";
45878
- }
45879
- refresh_json(gobj, { preserve_view: true });
46033
+ let same = priv.lit_path === tdata.path;
46034
+ let paths = put_out_edge(gobj);
46035
+ if (!same) paths = paths.concat(light_edge$2(gobj, edge.id, tdata.path, source && source.data && source.data.path || "", edge.style && edge.style.sourcePort || ""));
46036
+ repaint_cards$2(gobj, new Set(paths));
45880
46037
  return 0;
45881
46038
  }
45882
46039
  /************************************************************
@@ -45885,10 +46042,7 @@ function ac_edge_click$2(gobj, event, kw, src) {
45885
46042
  function ac_canvas_click$2(gobj, event, kw, src) {
45886
46043
  let priv = gobj.priv;
45887
46044
  if ((0, _yuneta_gobj_js.empty_string)(priv.lit_path)) return 0;
45888
- priv.lit_path = "";
45889
- priv.lit_parent_path = "";
45890
- priv.lit_port = "";
45891
- refresh_json(gobj, { preserve_view: true });
46045
+ repaint_cards$2(gobj, put_out_edge(gobj));
45892
46046
  return 0;
45893
46047
  }
45894
46048
  /************************************************************
@@ -58850,6 +59004,17 @@ function topic_is_shown(topic_name) {
58850
59004
  return topic_name.substring(0, 2) !== "__" || topic_name === "__icons__";
58851
59005
  }
58852
59006
  /************************************************************
59007
+ * The topics in ALPHABETICAL order, for the cards, the tabs
59008
+ * and the site map: the backend's order is not the same from
59009
+ * one load to the next, and a reader finds a topic by its
59010
+ * place. The system topics (__*__) sort first.
59011
+ ************************************************************/
59012
+ function sorted_topic_names(descs) {
59013
+ return Object.keys(descs).sort((a, b) => {
59014
+ return a.localeCompare(b);
59015
+ });
59016
+ }
59017
+ /************************************************************
58853
59018
  * The nodes of __icons__ are the user icons of the app: each
58854
59019
  * load and each write of them goes to the icon registry
58855
59020
  * (lib_icons.js), and the shell tells the views that decided
@@ -58885,7 +59050,8 @@ function process_treedb_descs$1(gobj) {
58885
59050
  let system = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "system");
58886
59051
  let treedb_name = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name");
58887
59052
  let readonly = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "readonly");
58888
- for (const [key, desc] of Object.entries(descs)) {
59053
+ for (const key of sorted_topic_names(descs)) {
59054
+ let desc = descs[key];
58889
59055
  if (!system && !topic_is_shown(key)) continue;
58890
59056
  let kw_topic_form = {
58891
59057
  subscriber: gobj,
@@ -58946,7 +59112,7 @@ function register_sub_routes$1(gobj) {
58946
59112
  icon: "yi-compass-drafting",
58947
59113
  gclass: "C_YUI_TREEDB_SCHEMA"
58948
59114
  });
58949
- if ((0, _yuneta_gobj_js.is_object)(descs)) for (let topic of Object.keys(descs)) {
59115
+ if ((0, _yuneta_gobj_js.is_object)(descs)) for (let topic of sorted_topic_names(descs)) {
58950
59116
  if (!system && !topic_is_shown(topic)) continue;
58951
59117
  nodes.push({
58952
59118
  route: base + "/" + topic,