@yuneta/gobj-ui 7.23.86 → 7.23.88

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.
@@ -47,7 +47,7 @@ import {
47
47
  refresh_language,
48
48
  } from "@yuneta/gobj-js";
49
49
 
50
- import {yui_toolbar} from "./yui_toolbar.js";
50
+ import {yui_toolbar, yui_toolbar_icon} from "./yui_toolbar.js";
51
51
  import {attach_clear} from "./yui_inputs.js";
52
52
  import {
53
53
  yui_graph_camera_items,
@@ -57,7 +57,6 @@ import {
57
57
  yui_graph_place_at,
58
58
  yui_graph_viewport_of,
59
59
  yui_graph_fold_items,
60
- yui_graph_icon,
61
60
  yui_graph_refresh_item,
62
61
  yui_graph_update_zoom,
63
62
  } from "./yui_graph_camera.js";
@@ -177,7 +176,7 @@ SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container eleme
177
176
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
178
177
 
179
178
  /*---------------- Graph Settings ----------------*/
180
- SDATA(data_type_t.DTP_STRING, "wide", 0, "36px", "Height of header"),
179
+ SDATA(data_type_t.DTP_STRING, "wide", 0, "40px", "Height of header. 40px and not 36: it is what an untouched Bulma control measures, so the find box stood 4px taller than every button beside it, and it is what the third graph of the family (C_YUI_TREEDB_GRAPH) uses"),
181
180
  SDATA(data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
182
181
 
183
182
  SDATA_END()
@@ -586,7 +585,7 @@ function make_toolbar(gobj)
586
585
  ['div', {class: 'JSON_GRAPH_FIND control has-icons-left',
587
586
  style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
588
587
  $find_input,
589
- ['span', {class: 'icon is-left'}, [yui_graph_icon('yi-magnifying-glass')]]
588
+ ['span', {class: 'icon is-left'}, [yui_toolbar_icon('yi-magnifying-glass')]]
590
589
  ]]);
591
590
  attach_clear($find_control, $find_input);
592
591
 
@@ -657,13 +656,20 @@ function make_toolbar(gobj)
657
656
  return ['option', attrs, layout_label(key)];
658
657
  });
659
658
 
659
+ /* Bulma's `.select` styles a WRAPPER that holds the control, not
660
+ * the control: on the `<select>` itself its `.select select` rule
661
+ * never matches, so the box kept the browser's own font -- 13.3px
662
+ * in a row where everything else says 16 -- and none of Bulma's
663
+ * chrome. The class goes where Bulma looks for it. */
660
664
  let $layout_select = createElement2(
661
- ['select', {
662
- class: 'JSON_GRAPH_LAYOUT select',
663
- style: {height: toolbar_wide, "margin-left": "0.5em"},
664
- title: t("layout"), 'data-i18n-title': "layout",
665
- 'aria-label': t("layout"), 'data-i18n-aria-label': "layout"
666
- }, options, {
665
+ ['div', {class: 'select', style: {"margin-left": "0.5em"}}, [
666
+ ['select', {
667
+ class: 'JSON_GRAPH_LAYOUT',
668
+ style: {height: toolbar_wide},
669
+ title: t("layout"), 'data-i18n-title': "layout",
670
+ 'aria-label': t("layout"), 'data-i18n-aria-label': "layout"
671
+ }, options]
672
+ ], {
667
673
  change: (evt) => {
668
674
  evt.stopPropagation();
669
675
  gobj_send_event(gobj, "EV_CHANGE_LAYOUT", {layout: evt.target.value}, gobj);
@@ -524,6 +524,16 @@
524
524
  * Circular badge populated by the host-registered provider
525
525
  * via yui_shell_set_avatar_provider().
526
526
  *============================================================*/
527
+ /* The badge is 2rem, and the item's own 0.5rem padding put the
528
+ * avatar at 48px in a row of 44px items -- the only thing in the app
529
+ * bar that stood taller than the rest. The padding gives way; the
530
+ * badge (which is the identity, and the hit target) does not, and the
531
+ * item keeps the row's 2.75rem min-height. */
532
+ .yui-toolbar-item.yui-toolbar-avatar {
533
+ padding-top: 0.25rem;
534
+ padding-bottom: 0.25rem;
535
+ }
536
+
527
537
  .yui-toolbar-avatar .yui-avatar {
528
538
  display: inline-flex;
529
539
  align-items: center;
@@ -79,14 +79,11 @@ import {
79
79
  gobj_stop_children,
80
80
  } from "@yuneta/gobj-js";
81
81
 
82
- import {yui_toolbar} from "./yui_toolbar.js";
82
+
83
83
  import {attach_clear} from "./yui_inputs.js";
84
84
  import {register_c_g6_nodes_tree} from "./c_g6_nodes_tree.js";
85
- import {
86
- yui_graph_fold_items,
87
- yui_graph_icon,
88
- YUI_GRAPH_ICON_SIZE,
89
- } from "./yui_graph_camera.js";
85
+ import {yui_graph_fold_items} from "./yui_graph_camera.js";
86
+ import {yui_toolbar, yui_toolbar_icon, YUI_TOOLBAR_ICON_SIZE} from "./yui_toolbar.js";
90
87
  import {
91
88
  removeChildElements,
92
89
  disableElements,
@@ -406,7 +403,7 @@ function build_ui(gobj)
406
403
  ['div', {class: 'GRAPH_LEGEND is-flex-grow-0',
407
404
  style: 'display:flex; flex-wrap:nowrap; align-items:center; ' +
408
405
  'gap:.35rem; padding:.3rem .5rem; overflow-x:auto; ' +
409
- 'min-height:2.2rem;'}, []],
406
+ 'min-height:2.9rem;'}, []],
410
407
  ['div', {class: `GRAPH_BODY is-flex-grow-1 ${padding}`, style: 'height:100%; min-height:0; overflow:hidden;'}, [
411
408
  ['div', {id: priv.canvas_id, class: `GRAPH_CANVAS graph-container`, style: 'height:100%; min-height:0;border: 1px solid var(--bulma-border-weak);border-radius:0.2rem;'}, [
412
409
  ]]
@@ -578,7 +575,7 @@ function node_shape_items(gobj, wide)
578
575
  title: t(key), 'data-i18n-title': key,
579
576
  'aria-label': t(key), 'data-i18n-aria-label': key,
580
577
  'aria-pressed': 'false'},
581
- yui_graph_icon(NODE_MODE_ICONS[mode]),
578
+ yui_toolbar_icon(NODE_MODE_ICONS[mode]),
582
579
  {
583
580
  click: (evt) => {
584
581
  evt.stopPropagation();
@@ -595,7 +592,7 @@ function node_shape_items(gobj, wide)
595
592
  title: t('node labels'), 'data-i18n-title': 'node labels',
596
593
  'aria-label': t('node labels'), 'data-i18n-aria-label': 'node labels',
597
594
  'aria-pressed': 'false'},
598
- yui_graph_icon('yi-font'),
595
+ yui_toolbar_icon('yi-font'),
599
596
  {
600
597
  click: (evt) => {
601
598
  evt.stopPropagation();
@@ -697,7 +694,7 @@ function make_toolbar(gobj)
697
694
  }],
698
695
 
699
696
  ['button', {class: 'GRAPH_REFRESH button'}, [
700
- yui_graph_icon('yi-arrows-rotate'),
697
+ yui_toolbar_icon('yi-arrows-rotate'),
701
698
  ['span', {class: 'is-hidden-mobile', style: 'padding-left:5px;', i18n: 'refresh'}, 'refresh']
702
699
  ], {
703
700
  click: (evt) => {
@@ -722,7 +719,7 @@ function make_toolbar(gobj)
722
719
  ['button', {class: 'button ml-2 TREEDB_JSON_BTN',
723
720
  title: t('raw json'), 'aria-label': t('raw json'),
724
721
  'data-i18n-title': 'raw json', 'data-i18n-aria-label': 'raw json'}, [
725
- yui_graph_icon('yi-eye'),
722
+ yui_toolbar_icon('yi-eye'),
726
723
  ['span', {class: 'is-hidden-mobile', style: 'padding-left:5px;', i18n: 'raw json'}, 'raw json']
727
724
  ], {
728
725
  click: (evt) => {
@@ -779,7 +776,7 @@ function make_toolbar(gobj)
779
776
  ['div', {class: 'GRAPH_FIND control has-icons-left',
780
777
  style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
781
778
  $find_input,
782
- ['span', {class: 'icon is-left'}, [yui_graph_icon('yi-magnifying-glass')]]
779
+ ['span', {class: 'icon is-left'}, [yui_toolbar_icon('yi-magnifying-glass')]]
783
780
  ]]);
784
781
  attach_clear($find_control, $find_input);
785
782
 
@@ -2458,19 +2455,41 @@ function ac_set_operation_mode(gobj, event, kw, src)
2458
2455
  * into the URL, so what you are looking at stays linkable.
2459
2456
  ************************************************************/
2460
2457
  /* The legend is the strip UNDER the toolbar, and the two are read as
2461
- * one thing: what they say has to be the same size, or the lower one
2462
- * reads as a footnote to the upper. `is-small` earns its place in the
2463
- * PADDING -- a chip per topic has to fit on one row -- and nowhere
2464
- * else, so the text and the glyphs are given back in `rem`, which is
2465
- * measured against the page instead of against the 0.75rem the class
2466
- * sets. In `em` they were 18px and 14.4px against the toolbar's 24px
2467
- * and 16px: three sizes in two strips.
2458
+ * one thing: it is a layer CONTROL, so it is built at the toolbar's
2459
+ * size and not one step under it. `is-small` was kept for its
2460
+ * padding, on the argument that a chip per topic has to fit on one
2461
+ * row -- and the strip SCROLLS sideways (`overflow-x:auto`), so it
2462
+ * never had to fit anything. It is gone.
2468
2463
  *
2469
2464
  * The count is the one deliberate step down: it is the number beside
2470
- * the name, not the name. */
2471
- const LEGEND_GLYPH_STYLE = `font-size:${YUI_GRAPH_ICON_SIZE}; line-height:1; color:inherit;`;
2465
+ * the name, not the name. `has-text-grey` is what it used to wear,
2466
+ * and Bulma's grey on the dark scheme is 3.86:1 -- under the 4.5 that
2467
+ * small text needs, which is why it read as a smudge. It takes the
2468
+ * chip's own colour at 80%: 12:1 in dark, 10:1 in light, and still
2469
+ * visibly secondary. */
2470
+ const LEGEND_GLYPH_STYLE = `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;`;
2472
2471
  const LEGEND_NAME_STYLE = 'font-size:1rem; line-height:1.2;';
2473
- const LEGEND_COUNT_STYLE = 'margin-left:.4rem; font-size:.875rem;';
2472
+ const LEGEND_COUNT_STYLE = 'margin-left:.4rem; font-size:.875rem; opacity:.8;';
2473
+
2474
+ /* The MAIN topic is the trunk the whole tree hangs from, and it was
2475
+ * the one chip drawn as unavailable: its body was a `<button
2476
+ * disabled>` (because it cannot be hidden) and Bulma paints that at
2477
+ * half opacity, with its star a grey `span` beside four bright ones.
2478
+ * The most important chip of the strip read as the dead one.
2479
+ *
2480
+ * It is not a button any more -- a control that does nothing should
2481
+ * not look like a control that is broken. It is a `div` wearing the
2482
+ * same `.button` skin, at full strength, with the name in bold and
2483
+ * the star in gold. */
2484
+ const LEGEND_MAIN_NAME_STYLE = LEGEND_NAME_STYLE + ' font-weight:700;';
2485
+ /* `--bulma-warning-on-scheme` and NOT `--bulma-warning`: the raw
2486
+ * brand colour is the same bright gold in both schemes, which is
2487
+ * 10.4:1 on the dark ground and **1.75:1** on the light one -- a
2488
+ * star nobody could see in daylight. The `-on-scheme` variant is
2489
+ * what Bulma keeps for a brand colour used as INK: the same hue,
2490
+ * darkened to 23% lightness when the scheme is light. */
2491
+ const LEGEND_STAR_MAIN_STYLE = LEGEND_GLYPH_STYLE +
2492
+ ' color:var(--bulma-warning-on-scheme, var(--bulma-warning, #ffdd57));';
2474
2493
 
2475
2494
  /* The focused chip is HIGHLIGHTED, not pressed. The body of a chip is
2476
2495
  * the show/hide toggle, and that is what its `aria-pressed` says;
@@ -2534,10 +2553,10 @@ function refresh_legend(gobj)
2534
2553
  `border:1px solid rgba(0,0,0,.25);` +
2535
2554
  (hidden? 'opacity:.35;' : '')}],
2536
2555
  ['span', {class: 'GRAPH_LEGEND_NAME',
2537
- style: LEGEND_NAME_STYLE +
2556
+ style: (is_main? LEGEND_MAIN_NAME_STYLE : LEGEND_NAME_STYLE) +
2538
2557
  (hidden? ' text-decoration:line-through; opacity:.6;' : '')},
2539
2558
  topic_name],
2540
- ['span', {class: 'GRAPH_LEGEND_COUNT has-text-grey',
2559
+ ['span', {class: 'GRAPH_LEGEND_COUNT',
2541
2560
  style: LEGEND_COUNT_STYLE},
2542
2561
  hidden? `${entry.total}` : `${entry.visible}/${entry.total}`]
2543
2562
  );
@@ -2549,7 +2568,7 @@ function refresh_legend(gobj)
2549
2568
  * and a `disabled="undefined"` button is a disabled button --
2550
2569
  * every chip was dead except its star. */
2551
2570
  let body_attrs = {
2552
- class: 'GRAPH_LEGEND_ITEM button is-small' +
2571
+ class: 'GRAPH_LEGEND_ITEM button' +
2553
2572
  (focused? ' GRAPH_LEGEND_FOCUSED' : '') +
2554
2573
  (is_main? ' GRAPH_LEGEND_MAIN' : ''),
2555
2574
  type: 'button',
@@ -2565,18 +2584,26 @@ function refresh_legend(gobj)
2565
2584
  'aria-label': topic_name,
2566
2585
  'aria-pressed': hidden? 'false' : 'true',
2567
2586
  };
2587
+ /* The main topic cannot be hidden, so its body is not a toggle
2588
+ * and must not be drawn as one that is broken: a `div` with the
2589
+ * same `.button` skin, at full strength. `disabled` on a button
2590
+ * is Bulma's half opacity, which put the trunk of the tree in
2591
+ * the strip's weakest chip. */
2592
+ let $body;
2568
2593
  if(is_main) {
2569
- body_attrs.disabled = 'disabled';
2594
+ delete body_attrs['aria-pressed'];
2595
+ $body = createElement2(['div', body_attrs, controls]);
2596
+ } else {
2597
+ $body = createElement2(
2598
+ ['button', body_attrs, controls, {
2599
+ click: (evt) => {
2600
+ evt.stopPropagation();
2601
+ gobj_send_event(gobj, "EV_LEGEND_TOPIC",
2602
+ {topic: topic_name, action: "toggle"}, gobj);
2603
+ }
2604
+ }]
2605
+ );
2570
2606
  }
2571
- let $body = createElement2(
2572
- ['button', body_attrs, controls, {
2573
- click: (evt) => {
2574
- evt.stopPropagation();
2575
- gobj_send_event(gobj, "EV_LEGEND_TOPIC",
2576
- {topic: topic_name, action: "toggle"}, gobj);
2577
- }
2578
- }]
2579
- );
2580
2607
 
2581
2608
  let extras = [];
2582
2609
 
@@ -2585,13 +2612,13 @@ function refresh_legend(gobj)
2585
2612
  * is a button too: pressing it hands the choice back to the
2586
2613
  * graph (deduced again). On a deduced one it is a mark. */
2587
2614
  if(is_main && state.main_chosen) {
2588
- extras.push(['button', {class: 'GRAPH_LEGEND_STAR button is-small pressed_state',
2589
- type: 'button', style: 'padding:0 .4rem;',
2615
+ extras.push(['button', {class: 'GRAPH_LEGEND_STAR button pressed_state',
2616
+ type: 'button', style: 'padding:0 .5rem;',
2590
2617
  title: t('main topic'), 'data-i18n-title': 'main topic',
2591
2618
  'aria-label': t('main topic'),
2592
2619
  'data-i18n-aria-label': 'main topic',
2593
2620
  'aria-pressed': 'true'},
2594
- [['span', {style: LEGEND_GLYPH_STYLE}, '★']], {
2621
+ [['span', {style: LEGEND_STAR_MAIN_STYLE}, '★']], {
2595
2622
  click: (evt) => {
2596
2623
  evt.stopPropagation();
2597
2624
  gobj_send_event(gobj, "EV_LEGEND_TOPIC",
@@ -2599,13 +2626,17 @@ function refresh_legend(gobj)
2599
2626
  }
2600
2627
  }]);
2601
2628
  } else if(is_main) {
2602
- extras.push(['span', {class: 'GRAPH_LEGEND_STAR button is-small is-static',
2603
- style: 'padding:0 .4rem;',
2629
+ /* Deduced, not chosen: a MARK and not a button. Gold and at
2630
+ * full strength all the same -- `is-static` painted it the
2631
+ * grey of something switched off, next to four bright
2632
+ * stars that only offer to become this one. */
2633
+ extras.push(['span', {class: 'GRAPH_LEGEND_STAR button',
2634
+ style: 'padding:0 .5rem; cursor:default;',
2604
2635
  title: t('main topic'), 'data-i18n-title': 'main topic'},
2605
- [['span', {style: LEGEND_GLYPH_STYLE}, '★']]]);
2636
+ [['span', {style: LEGEND_STAR_MAIN_STYLE}, '★']]]);
2606
2637
  } else if(!hidden) {
2607
- extras.push(['button', {class: 'GRAPH_LEGEND_STAR button is-small',
2608
- type: 'button', style: 'padding:0 .4rem;',
2638
+ extras.push(['button', {class: 'GRAPH_LEGEND_STAR button',
2639
+ type: 'button', style: 'padding:0 .5rem;',
2609
2640
  title: t('main topic'), 'data-i18n-title': 'main topic',
2610
2641
  'aria-label': t('main topic'),
2611
2642
  'data-i18n-aria-label': 'main topic'},
@@ -2623,9 +2654,9 @@ function refresh_legend(gobj)
2623
2654
  * the schema hangs from the main one. */
2624
2655
  if(!hidden && entry.linked && entry.loose > 0) {
2625
2656
  extras.push(['button', {
2626
- class: 'GRAPH_LEGEND_LOOSE button is-small' +
2657
+ class: 'GRAPH_LEGEND_LOOSE button' +
2627
2658
  (entry.loose_shown? ' pressed_state' : ''),
2628
- type: 'button', style: 'padding:0 .45rem;',
2659
+ type: 'button', style: 'padding:0 .55rem;',
2629
2660
  title: t('loose records'), 'data-i18n-title': 'loose records',
2630
2661
  'aria-label': t('loose records'),
2631
2662
  'data-i18n-aria-label': 'loose records',
@@ -2641,9 +2672,9 @@ function refresh_legend(gobj)
2641
2672
 
2642
2673
  if(!hidden) {
2643
2674
  extras.push(['button', {
2644
- class: 'GRAPH_LEGEND_FOCUS button is-small' +
2675
+ class: 'GRAPH_LEGEND_FOCUS button' +
2645
2676
  (focused? ' pressed_state' : ''),
2646
- type: 'button', style: 'padding:0 .4rem;',
2677
+ type: 'button', style: 'padding:0 .5rem;',
2647
2678
  title: t('highlight topic'), 'data-i18n-title': 'highlight topic',
2648
2679
  'aria-label': t('highlight topic'),
2649
2680
  'data-i18n-aria-label': 'highlight topic',
@@ -91,6 +91,8 @@ import {row_matches} from "./yui_row_search.js";
91
91
 
92
92
  import {t} from "i18next";
93
93
 
94
+ import {yui_toolbar_icon} from "./yui_toolbar.js";
95
+
94
96
  import {plan_treedb_writes, READONLY_FORM_TOOLBAR} from "./treedb_write_plan.js";
95
97
  import {yui_file_read, yui_files_manifest, yui_file_id_label} from "./yui_file_field.js";
96
98
  import {yui_asset_id} from "./yui_asset.js";
@@ -583,7 +585,7 @@ function build_ui(gobj)
583
585
  * reorder this group as if they were peer actions. */
584
586
  let $edit_button = createElement2(
585
587
  ['button', {id: ``, class: 'button button-edit-record mr-1'}, [
586
- ['i', {class: 'yi-pen'}],
588
+ yui_toolbar_icon('yi-pen'),
587
589
  ['span',
588
590
  {
589
591
  class: 'is-hidden-mobile', i18n: 'edit', style: 'padding-left:5px;'
@@ -609,7 +611,7 @@ function build_ui(gobj)
609
611
  if(with_new_button) {
610
612
  let $new_button = createElement2(
611
613
  ['button', {id: ``, class: 'button button-new-record mr-1', disabled: true}, [
612
- ['i', {class: 'yi-plus'}],
614
+ yui_toolbar_icon('yi-plus'),
613
615
  ['span',
614
616
  {
615
617
  class: 'is-hidden-mobile', i18n: 'new', style: 'padding-left:5px;'
@@ -629,7 +631,7 @@ function build_ui(gobj)
629
631
  if(with_delete_button) {
630
632
  let $delete_button = createElement2(
631
633
  ['button', {id: ``, class: 'button button-delete-record mr-1', disabled: true}, [
632
- ['i', {class: 'yi-trash'}],
634
+ yui_toolbar_icon('yi-trash'),
633
635
  ['span',
634
636
  {
635
637
  class: 'is-hidden-mobile', i18n: 'delete', style: 'padding-left:5px;'
@@ -650,7 +652,7 @@ function build_ui(gobj)
650
652
  if(with_copy_button) {
651
653
  let $copy_button = createElement2(
652
654
  ['button', {id: ``, class: 'button button-copy-record mr-1', disabled: true}, [
653
- ['i', {class: 'yi-copy'}],
655
+ yui_toolbar_icon('yi-copy'),
654
656
  ['span',
655
657
  {
656
658
  class: 'is-hidden-mobile', i18n: 'copy', style: 'padding-left:5px;'
@@ -671,7 +673,7 @@ function build_ui(gobj)
671
673
  if(with_paste_button) {
672
674
  let $paste_button = createElement2(
673
675
  ['button', {id: ``, class: 'button button-paste-record mr-1', disabled: true}, [
674
- ['i', {class: 'yi-paste'}],
676
+ yui_toolbar_icon('yi-paste'),
675
677
  ['span',
676
678
  {
677
679
  class: 'is-hidden-mobile', i18n: 'paste', style: 'padding-left:5px;'
@@ -727,7 +729,7 @@ function build_ui(gobj)
727
729
  'data-i18n-placeholder': 'search'
728
730
  }],
729
731
  ['span', {class: 'icon is-left'}, [
730
- ['i', {class: 'yi-magnifying-glass'}]
732
+ yui_toolbar_icon('yi-magnifying-glass')
731
733
  ]]
732
734
  ]]
733
735
  );
@@ -754,7 +756,7 @@ function build_ui(gobj)
754
756
  if(with_refresh_button) {
755
757
  let $refresh = createElement2(
756
758
  ['button', {class: 'button mr-1', title: t('refresh'), 'data-i18n-title': 'refresh'}, [
757
- ['i', {class: 'yi-arrows-rotate'}],
759
+ yui_toolbar_icon('yi-arrows-rotate'),
758
760
  ['span', {class: 'is-hidden-mobile', i18n: 'refresh', style: 'padding-left:5px;'}, 'refresh']
759
761
  ], {
760
762
  'click': (event) => {
@@ -775,7 +777,7 @@ function build_ui(gobj)
775
777
  ['button', {class: 'TREEDB_TABLE_SCHEMA button mr-1',
776
778
  title: t('schema'), 'data-i18n-title': 'schema',
777
779
  'aria-label': t('schema'), 'data-i18n-aria-label': 'schema'}, [
778
- ['i', {class: 'yi-hexagon-nodes'}],
780
+ yui_toolbar_icon('yi-hexagon-nodes'),
779
781
  ['span', {class: 'is-hidden-mobile', i18n: 'schema', style: 'padding-left:5px;'}, 'schema']
780
782
  ], {
781
783
  'click': (event) => {
@@ -796,7 +798,7 @@ function build_ui(gobj)
796
798
  title: t('choose the columns to show'),
797
799
  'data-i18n-title': 'choose the columns to show',
798
800
  'aria-label': t('columns'), 'data-i18n-aria-label': 'columns'}, [
799
- ['i', {class: 'yi-table'}],
801
+ yui_toolbar_icon('yi-table'),
800
802
  ['span', {class: 'is-hidden-mobile', i18n: 'columns', style: 'padding-left:5px;'}, 'columns']
801
803
  ], {
802
804
  'click': (event) => {
@@ -817,7 +819,7 @@ function build_ui(gobj)
817
819
  title: t('download the rows loaded in this table as csv'),
818
820
  'data-i18n-title': 'download the rows loaded in this table as csv',
819
821
  'aria-label': t('export'), 'data-i18n-aria-label': 'export'}, [
820
- ['i', {class: 'yi-download'}],
822
+ yui_toolbar_icon('yi-download'),
821
823
  ['span', {class: 'is-hidden-mobile', i18n: 'export', style: 'padding-left:5px;'}, 'export']
822
824
  ], {
823
825
  'click': (event) => {
@@ -60,6 +60,7 @@ import "./c_yui_treedb_topics.css";
60
60
  import {yui_shell_show_error, yui_shell_show_modal, yui_shell_popup_layer} from "./shell_modals.js";
61
61
  import {yui_shell_of, yui_shell_set_sub_routes} from "./c_yui_shell.js";
62
62
  import {nodes_answer} from "./nodes_answer.js";
63
+ import {yui_toolbar_icon} from "./yui_toolbar.js";
63
64
 
64
65
  import {t} from "i18next";
65
66
 
@@ -273,7 +274,7 @@ function build_ui(gobj)
273
274
  ['button', {class: 'button TREEDB_TOPICS_BACK is-hidden',
274
275
  title: t('topics'), 'aria-label': t('topics'),
275
276
  'data-i18n-title': 'topics', 'data-i18n-aria-label': 'topics'}, [
276
- ['span', {class: 'icon'}, [['i', {class: 'yi-arrow-left'}]]],
277
+ ['span', {class: 'icon'}, [yui_toolbar_icon('yi-arrow-left')]],
277
278
  ['span', {i18n: 'topics'}, 'topics']
278
279
  ], {
279
280
  click: (evt) => {
@@ -287,7 +288,7 @@ function build_ui(gobj)
287
288
  title: t('schema graph'), 'aria-label': t('schema graph'),
288
289
  'data-i18n-title': 'schema graph',
289
290
  'data-i18n-aria-label': 'schema graph'}, [
290
- ['span', {class: 'icon'}, [['i', {class: 'yi-hexagon-nodes'}]]],
291
+ ['span', {class: 'icon'}, [yui_toolbar_icon('yi-hexagon-nodes')]],
291
292
  ['span', {i18n: 'schema'}, 'schema']
292
293
  ], {
293
294
  click: (evt) => {
@@ -305,7 +306,7 @@ function build_ui(gobj)
305
306
  ['div', {class: source_url?
306
307
  'TREEDB_TOPICS_SOURCE' : 'TREEDB_TOPICS_SOURCE is-hidden',
307
308
  title: source_url, 'aria-label': source_url}, [
308
- ['span', {class: 'icon'}, [['i', {class: 'yi-cloudversify'}]]],
309
+ ['span', {class: 'icon'}, [yui_toolbar_icon('yi-cloudversify')]],
309
310
  ['span', {class: 'TREEDB_TOPICS_SOURCE_URL'}, source_url]
310
311
  ]],
311
312
  /* Inspect the treedb's raw tranger json (whole service,
@@ -315,7 +316,7 @@ function build_ui(gobj)
315
316
  style: 'margin-left:auto;',
316
317
  title: t('raw json'), 'aria-label': t('raw json'),
317
318
  'data-i18n-title': 'raw json', 'data-i18n-aria-label': 'raw json'}, [
318
- ['span', {class: 'icon'}, [['i', {class: 'yi-eye'}]]],
319
+ ['span', {class: 'icon'}, [yui_toolbar_icon('yi-eye')]],
319
320
  ['span', {i18n: 'raw json'}, 'raw json']
320
321
  ], {
321
322
  click: (evt) => {
@@ -40,37 +40,11 @@ import {createElement2, gobj_send_event} from "@yuneta/gobj-js";
40
40
  import {t} from "i18next";
41
41
 
42
42
  import {set_pressed_state} from "./lib_graph.js";
43
+ /* The glyph size is the TOOLBAR's, not the graph's: it is shared with
44
+ * the JSON viewer and the treedb topics row, which are not graphs. */
45
+ import {yui_toolbar_icon} from "./yui_toolbar.js";
43
46
 
44
47
 
45
- /************************************************************
46
- * ONE size for every glyph of a graph's toolbar ROW, in
47
- * `rem` and not `em`.
48
- *
49
- * In `em` the same declaration draws three different icons:
50
- * `1.5em` is 24px inside a plain button, 18px inside an
51
- * `is-small` one, and a labelled button left its icon at the
52
- * inherited 16px -- so one row held 16px, 18px and 24px
53
- * glyphs and looked like three toolbars pushed together.
54
- * `rem` is measured against the page, so a chip that is
55
- * deliberately shorter than a button still carries the same
56
- * glyph.
57
- *
58
- * 20px against the row's 16px text: an icon-only button is
59
- * legible at half its 40px height, and beside a label the
60
- * glyph reads as a marker rather than as a second word.
61
- ************************************************************/
62
- export const YUI_GRAPH_ICON_SIZE = "1.25rem";
63
-
64
- /* The `<i>` spec of a toolbar glyph, at that one size. */
65
- export function yui_graph_icon(icon_class, extra_style)
66
- {
67
- return ['i', {
68
- class: icon_class,
69
- style: `font-size:${YUI_GRAPH_ICON_SIZE}; line-height:1; color:inherit;` +
70
- (extra_style || ''),
71
- }];
72
- }
73
-
74
48
  /************************************************************
75
49
  * One icon button that fires `event_name`.
76
50
  ************************************************************/
@@ -80,7 +54,7 @@ function camera_button(gobj, icon, event_name, label_key, wide, extra_style)
80
54
  style: {height: wide, width: '2.5em'},
81
55
  title: t(label_key), 'data-i18n-title': label_key,
82
56
  'aria-label': t(label_key), 'data-i18n-aria-label': label_key},
83
- yui_graph_icon(icon, extra_style),
57
+ yui_toolbar_icon(icon, extra_style),
84
58
  {
85
59
  click: (evt) => {
86
60
  evt.stopPropagation();
@@ -16,6 +16,41 @@ import {
16
16
 
17
17
  import "./yui_toolbar.css"; // Must be in index.js ?
18
18
 
19
+
20
+ /************************************************************
21
+ * ONE size for every glyph of a view's toolbar, in `rem`.
22
+ *
23
+ * It lives here because it belongs to the TOOLBAR and not to
24
+ * any one view: it was born in the graph rows (7.23.86) and the
25
+ * JSON viewer beside them still drew 16px, which is the same
26
+ * drift one level up.
27
+ *
28
+ * `rem` and not `em` is the whole lesson: `em` is measured
29
+ * against the button, so one declaration draws three icons --
30
+ * `1.5em` is 24px in a plain button, 18px in an `is-small`
31
+ * chip, and a labelled button that declares nothing keeps the
32
+ * inherited 16px. `rem` is measured against the page, so a
33
+ * chip deliberately shorter than a button still carries the
34
+ * same glyph.
35
+ *
36
+ * 20px against a row's 16px text: an icon-only button is
37
+ * legible at half its 40px height, and beside a label the
38
+ * glyph reads as a marker rather than as a second word. The
39
+ * app BAR is a different band and keeps its own, bigger size
40
+ * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
41
+ ************************************************************/
42
+ const YUI_TOOLBAR_ICON_SIZE = "1.25rem";
43
+
44
+ /* The `<i>` spec of a toolbar glyph, at that one size. */
45
+ function yui_toolbar_icon(icon_class, extra_style)
46
+ {
47
+ return ['i', {
48
+ class: icon_class,
49
+ style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` +
50
+ (extra_style || ''),
51
+ }];
52
+ }
53
+
19
54
  function yui_toolbar(attrs={}, items = [])
20
55
  {
21
56
  /*
@@ -125,4 +160,4 @@ function yui_toolbar(attrs={}, items = [])
125
160
  return $toolbar;
126
161
  }
127
162
 
128
- export {yui_toolbar};
163
+ export {yui_toolbar, yui_toolbar_icon, YUI_TOOLBAR_ICON_SIZE};