@yuneta/gobj-ui 7.4.0 → 7.4.2

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.
@@ -19915,7 +19915,7 @@ function refresh_legend(gobj) {
19915
19915
  let $item = (0, _yuneta_gobj_js.createElement2)([
19916
19916
  "button",
19917
19917
  {
19918
- class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " is-primary" : ""),
19918
+ class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " is-primary is-light" : ""),
19919
19919
  title: topic_name,
19920
19920
  "aria-label": topic_name,
19921
19921
  "aria-pressed": focused ? "true" : "false"
@@ -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
  /************************************************************
@@ -19902,7 +19902,7 @@ function refresh_legend(gobj) {
19902
19902
  let $item = createElement2([
19903
19903
  "button",
19904
19904
  {
19905
- class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " is-primary" : ""),
19905
+ class: "GRAPH_LEGEND_ITEM button is-small" + (focused ? " is-primary is-light" : ""),
19906
19906
  title: topic_name,
19907
19907
  "aria-label": topic_name,
19908
19908
  "aria-pressed": focused ? "true" : "false"
@@ -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.2",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -2259,8 +2259,11 @@ function refresh_legend(gobj)
2259
2259
  let focused = (priv.focus_topic === topic_name);
2260
2260
  let $item = createElement2(
2261
2261
  ['button', {
2262
+ /* `is-light` on the focused one, not solid `is-primary`:
2263
+ * the solid fill sat right behind the swatch and swallowed
2264
+ * the one colour the entry exists to show. */
2262
2265
  class: 'GRAPH_LEGEND_ITEM button is-small' +
2263
- (focused? ' is-primary' : ''),
2266
+ (focused? ' is-primary is-light' : ''),
2264
2267
  title: topic_name,
2265
2268
  'aria-label': topic_name,
2266
2269
  'aria-pressed': focused? 'true' : 'false'
@@ -2320,11 +2323,17 @@ function ac_legend_topic(gobj, event, kw, src)
2320
2323
  log_error(`${gobj_short_name(gobj)}: legend click with no topic`);
2321
2324
  return -1;
2322
2325
  }
2323
- gobj_publish_event(
2324
- gobj,
2325
- "EV_TOPIC_SELECTED",
2326
- {topic: (priv.focus_topic === topic)? "" : topic}
2327
- );
2326
+
2327
+ let next = (priv.focus_topic === topic)? "" : topic;
2328
+
2329
+ /* APPLY, then announce in that order, and both halves are needed.
2330
+ * The host mirrors the announcement into the URL and remembers the
2331
+ * segment it just wrote, so the route change it causes comes back
2332
+ * DEDUPED: a legend that only announced moved the URL and focused
2333
+ * nothing. This is the same contract the topics view keeps, where
2334
+ * clicking a topic shows it and says so. */
2335
+ gobj_send_event(gobj, "EV_SET_FOCUS_TOPIC", {topic: next}, gobj);
2336
+ gobj_publish_event(gobj, "EV_TOPIC_SELECTED", {topic: next});
2328
2337
  return 0;
2329
2338
  }
2330
2339