@yuneta/gobj-ui 7.4.0 → 7.4.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.
@@ -19965,7 +19965,9 @@ function ac_legend_topic(gobj, event, kw, src) {
19965
19965
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: legend click with no topic`);
19966
19966
  return -1;
19967
19967
  }
19968
- (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TOPIC_SELECTED", { topic: priv.focus_topic === topic ? "" : topic });
19968
+ let next = priv.focus_topic === topic ? "" : topic;
19969
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_FOCUS_TOPIC", { topic: next }, gobj);
19970
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TOPIC_SELECTED", { topic: next });
19969
19971
  return 0;
19970
19972
  }
19971
19973
  /************************************************************
@@ -19952,7 +19952,9 @@ function ac_legend_topic(gobj, event, kw, src) {
19952
19952
  log_error(`${gobj_short_name(gobj)}: legend click with no topic`);
19953
19953
  return -1;
19954
19954
  }
19955
- gobj_publish_event(gobj, "EV_TOPIC_SELECTED", { topic: priv.focus_topic === topic ? "" : topic });
19955
+ let next = priv.focus_topic === topic ? "" : topic;
19956
+ gobj_send_event(gobj, "EV_SET_FOCUS_TOPIC", { topic: next }, gobj);
19957
+ gobj_publish_event(gobj, "EV_TOPIC_SELECTED", { topic: next });
19956
19958
  return 0;
19957
19959
  }
19958
19960
  /************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.4.0",
3
+ "version": "7.4.1",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -2320,11 +2320,17 @@ function ac_legend_topic(gobj, event, kw, src)
2320
2320
  log_error(`${gobj_short_name(gobj)}: legend click with no topic`);
2321
2321
  return -1;
2322
2322
  }
2323
- gobj_publish_event(
2324
- gobj,
2325
- "EV_TOPIC_SELECTED",
2326
- {topic: (priv.focus_topic === topic)? "" : topic}
2327
- );
2323
+
2324
+ let next = (priv.focus_topic === topic)? "" : topic;
2325
+
2326
+ /* APPLY, then announce in that order, and both halves are needed.
2327
+ * The host mirrors the announcement into the URL and remembers the
2328
+ * segment it just wrote, so the route change it causes comes back
2329
+ * DEDUPED: a legend that only announced moved the URL and focused
2330
+ * nothing. This is the same contract the topics view keeps, where
2331
+ * clicking a topic shows it and says so. */
2332
+ gobj_send_event(gobj, "EV_SET_FOCUS_TOPIC", {topic: next}, gobj);
2333
+ gobj_publish_event(gobj, "EV_TOPIC_SELECTED", {topic: next});
2328
2334
  return 0;
2329
2335
  }
2330
2336