@yuneta/gobj-ui 7.23.86 → 7.23.87

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
@@ -850,12 +850,16 @@ both keys, either — a G6 `trigger` is a CHORD, not a list of alternatives:
850
850
  `Shortcut.match()` compares the keys held to the keys bound as a SET, so
851
851
  `['Control', 'Meta']` would mean both at once.
852
852
 
853
- **One glyph size for the whole row** (`7.23.86`): `YUI_GRAPH_ICON_SIZE` in
854
- `yui_graph_camera.js`, with a `yui_graph_icon()` that builds the `<i>`. It is
855
- in **`rem` and not `em`** for a reason worth keeping: in `em` the same
856
- `1.5em` drew 24px inside a plain button, 18px inside an `is-small` chip of
857
- the legend, and a labelled button left its icon at the inherited 16px — three
858
- sizes in two strips that are read as one thing. The legend under the toolbar
853
+ **One glyph size for every toolbar of the library** (`7.23.86`, moved to its
854
+ proper home in `7.23.87`): `YUI_TOOLBAR_ICON_SIZE` in `yui_toolbar.js`, with a
855
+ `yui_toolbar_icon()` that builds the `<i>`. It is in **`rem` and not `em`**
856
+ for a reason worth keeping: in `em` the same `1.5em` drew 24px inside a plain
857
+ button, 18px inside an `is-small` chip of the legend, and a labelled button
858
+ left its icon at the inherited 16px — three sizes in two strips that are read
859
+ as one thing. It is the toolbar's size and not the graph's: the JSON viewer,
860
+ the treedb topics row and the treedb table row take it too. The app BAR keeps
861
+ its own, bigger glyph (`.yui-toolbar-item .icon`, 1.35rem on 44px items) —
862
+ that is a different band, not drift. The legend under the toolbar
859
863
  follows it: topic name at `1rem`, count at `.875rem` (the one deliberate step
860
864
  down), glyphs at the shared size, and `align-items: stretch` so a chip's star
861
865
  and crosshair are as tall as its body.
@@ -10298,6 +10298,35 @@ function register_c_yui_uplot() {
10298
10298
  }
10299
10299
  //#endregion
10300
10300
  //#region src/yui_toolbar.js
10301
+ /************************************************************
10302
+ * ONE size for every glyph of a view's toolbar, in `rem`.
10303
+ *
10304
+ * It lives here because it belongs to the TOOLBAR and not to
10305
+ * any one view: it was born in the graph rows (7.23.86) and the
10306
+ * JSON viewer beside them still drew 16px, which is the same
10307
+ * drift one level up.
10308
+ *
10309
+ * `rem` and not `em` is the whole lesson: `em` is measured
10310
+ * against the button, so one declaration draws three icons --
10311
+ * `1.5em` is 24px in a plain button, 18px in an `is-small`
10312
+ * chip, and a labelled button that declares nothing keeps the
10313
+ * inherited 16px. `rem` is measured against the page, so a
10314
+ * chip deliberately shorter than a button still carries the
10315
+ * same glyph.
10316
+ *
10317
+ * 20px against a row's 16px text: an icon-only button is
10318
+ * legible at half its 40px height, and beside a label the
10319
+ * glyph reads as a marker rather than as a second word. The
10320
+ * app BAR is a different band and keeps its own, bigger size
10321
+ * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
10322
+ ************************************************************/
10323
+ var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
10324
+ function yui_toolbar_icon(icon_class, extra_style) {
10325
+ return ["i", {
10326
+ class: icon_class,
10327
+ style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
10328
+ }];
10329
+ }
10301
10330
  function yui_toolbar(attrs = {}, items = []) {
10302
10331
  function arrow_button(side, icon, label) {
10303
10332
  return [
@@ -10560,30 +10589,6 @@ function getPointPosition(count, index, margin = .2) {
10560
10589
  * All Rights Reserved.
10561
10590
  ***********************************************************************/
10562
10591
  /************************************************************
10563
- * ONE size for every glyph of a graph's toolbar ROW, in
10564
- * `rem` and not `em`.
10565
- *
10566
- * In `em` the same declaration draws three different icons:
10567
- * `1.5em` is 24px inside a plain button, 18px inside an
10568
- * `is-small` one, and a labelled button left its icon at the
10569
- * inherited 16px -- so one row held 16px, 18px and 24px
10570
- * glyphs and looked like three toolbars pushed together.
10571
- * `rem` is measured against the page, so a chip that is
10572
- * deliberately shorter than a button still carries the same
10573
- * glyph.
10574
- *
10575
- * 20px against the row's 16px text: an icon-only button is
10576
- * legible at half its 40px height, and beside a label the
10577
- * glyph reads as a marker rather than as a second word.
10578
- ************************************************************/
10579
- var YUI_GRAPH_ICON_SIZE = "1.25rem";
10580
- function yui_graph_icon(icon_class, extra_style) {
10581
- return ["i", {
10582
- class: icon_class,
10583
- style: `font-size:${YUI_GRAPH_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
10584
- }];
10585
- }
10586
- /************************************************************
10587
10592
  * One icon button that fires `event_name`.
10588
10593
  ************************************************************/
10589
10594
  function camera_button(gobj, icon, event_name, label_key, wide, extra_style) {
@@ -10601,7 +10606,7 @@ function camera_button(gobj, icon, event_name, label_key, wide, extra_style) {
10601
10606
  "aria-label": (0, i18next.t)(label_key),
10602
10607
  "data-i18n-aria-label": label_key
10603
10608
  },
10604
- yui_graph_icon(icon, extra_style),
10609
+ yui_toolbar_icon(icon, extra_style),
10605
10610
  { click: (evt) => {
10606
10611
  evt.stopPropagation();
10607
10612
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, event_name, { evt }, gobj);
@@ -11391,7 +11396,7 @@ var attrs_table$13 = [
11391
11396
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "json_data", 0, null, "JSON data to visualize"),
11392
11397
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
11393
11398
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
11394
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "wide", 0, "36px", "Height of header"),
11399
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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"),
11395
11400
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
11396
11401
  (0, _yuneta_gobj_js.SDATA_END)()
11397
11402
  ];
@@ -11694,7 +11699,7 @@ function make_toolbar$5(gobj) {
11694
11699
  [$find_input, [
11695
11700
  "span",
11696
11701
  { class: "icon is-left" },
11697
- [yui_graph_icon("yi-magnifying-glass")]
11702
+ [yui_toolbar_icon("yi-magnifying-glass")]
11698
11703
  ]]
11699
11704
  ]);
11700
11705
  attach_clear($find_control, $find_input);
@@ -11728,19 +11733,23 @@ function make_toolbar$5(gobj) {
11728
11733
  ];
11729
11734
  });
11730
11735
  let right_items = [(0, _yuneta_gobj_js.createElement2)([
11731
- "select",
11736
+ "div",
11732
11737
  {
11733
- class: "JSON_GRAPH_LAYOUT select",
11734
- style: {
11735
- height: toolbar_wide,
11736
- "margin-left": "0.5em"
11737
- },
11738
- title: (0, i18next.t)("layout"),
11739
- "data-i18n-title": "layout",
11740
- "aria-label": (0, i18next.t)("layout"),
11741
- "data-i18n-aria-label": "layout"
11738
+ class: "select",
11739
+ style: { "margin-left": "0.5em" }
11742
11740
  },
11743
- options,
11741
+ [[
11742
+ "select",
11743
+ {
11744
+ class: "JSON_GRAPH_LAYOUT",
11745
+ style: { height: toolbar_wide },
11746
+ title: (0, i18next.t)("layout"),
11747
+ "data-i18n-title": "layout",
11748
+ "aria-label": (0, i18next.t)("layout"),
11749
+ "data-i18n-aria-label": "layout"
11750
+ },
11751
+ options
11752
+ ]],
11744
11753
  { change: (evt) => {
11745
11754
  evt.stopPropagation();
11746
11755
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHANGE_LAYOUT", { layout: evt.target.value }, gobj);
@@ -13220,7 +13229,7 @@ function make_toolbar$4(gobj) {
13220
13229
  [$search_input, [
13221
13230
  "span",
13222
13231
  { class: "icon is-left" },
13223
- [["i", { class: "yi-magnifying-glass" }]]
13232
+ [yui_toolbar_icon("yi-magnifying-glass")]
13224
13233
  ]]
13225
13234
  ]);
13226
13235
  left_items.push(icon_button$1(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"), icon_button$1(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all"));
@@ -13270,7 +13279,7 @@ function icon_button$1(gobj, icon, event_name, label_key) {
13270
13279
  [[
13271
13280
  "span",
13272
13281
  { class: "icon" },
13273
- [["i", { class: icon }]]
13282
+ [yui_toolbar_icon(icon)]
13274
13283
  ]],
13275
13284
  { click: function(evt) {
13276
13285
  evt.stopPropagation();
@@ -13307,7 +13316,7 @@ function view_mode_switch$1(gobj) {
13307
13316
  [[
13308
13317
  "span",
13309
13318
  { class: "icon" },
13310
- [["i", { class: v.icon }]]
13319
+ [yui_toolbar_icon(v.icon)]
13311
13320
  ]],
13312
13321
  { click: function(evt) {
13313
13322
  evt.stopPropagation();
@@ -17483,7 +17492,7 @@ var attrs_table$9 = [
17483
17492
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
17484
17493
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
17485
17494
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
17486
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "wide", 0, "36px", "Height of header"),
17495
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.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"),
17487
17496
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
17488
17497
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
17489
17498
  (0, _yuneta_gobj_js.SDATA_END)()
@@ -18136,7 +18145,7 @@ function make_find_items(gobj) {
18136
18145
  [$find_input, [
18137
18146
  "span",
18138
18147
  { class: "icon is-left" },
18139
- [yui_graph_icon("yi-magnifying-glass")]
18148
+ [yui_toolbar_icon("yi-magnifying-glass")]
18140
18149
  ]]
18141
18150
  ]);
18142
18151
  attach_clear($find_control, $find_input);
@@ -18206,24 +18215,31 @@ function make_toolbar$1(gobj) {
18206
18215
  LAYOUTS[key].label
18207
18216
  ]);
18208
18217
  }
18209
- let $select = (0, _yuneta_gobj_js.createElement2)([
18210
- "select",
18218
+ let $wrap = (0, _yuneta_gobj_js.createElement2)([
18219
+ "div",
18211
18220
  {
18212
18221
  class: "select",
18213
- style: {
18214
- height: toolbar_wide,
18215
- "margin-left": "0.5em"
18216
- },
18217
- title: (0, i18next.t)("layout")
18222
+ style: { "margin-left": "0.5em" }
18218
18223
  },
18219
- options,
18224
+ [[
18225
+ "select",
18226
+ {
18227
+ class: "GOBJ_TREE_LAYOUT",
18228
+ style: { height: toolbar_wide },
18229
+ title: (0, i18next.t)("layout"),
18230
+ "data-i18n-title": "layout",
18231
+ "aria-label": (0, i18next.t)("layout"),
18232
+ "data-i18n-aria-label": "layout"
18233
+ },
18234
+ options
18235
+ ]],
18220
18236
  { change: (evt) => {
18221
18237
  let value = evt.target.value;
18222
18238
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHANGE_LAYOUT", { layout: value }, gobj);
18223
18239
  } }
18224
18240
  ]);
18225
- priv.$layout_select = $select;
18226
- right_items.push($select);
18241
+ priv.$layout_select = $wrap.querySelector("select");
18242
+ right_items.push($wrap);
18227
18243
  const $toolbar = yui_toolbar({}, [
18228
18244
  [
18229
18245
  "div",
@@ -21373,7 +21389,7 @@ function build_ui$6(gobj) {
21373
21389
  [[
21374
21390
  "span",
21375
21391
  { class: "icon" },
21376
- [["i", { class: "yi-arrow-left" }]]
21392
+ [yui_toolbar_icon("yi-arrow-left")]
21377
21393
  ], [
21378
21394
  "span",
21379
21395
  { i18n: "topics" },
@@ -21396,7 +21412,7 @@ function build_ui$6(gobj) {
21396
21412
  [[
21397
21413
  "span",
21398
21414
  { class: "icon" },
21399
- [["i", { class: "yi-hexagon-nodes" }]]
21415
+ [yui_toolbar_icon("yi-hexagon-nodes")]
21400
21416
  ], [
21401
21417
  "span",
21402
21418
  { i18n: "schema" },
@@ -21417,7 +21433,7 @@ function build_ui$6(gobj) {
21417
21433
  [[
21418
21434
  "span",
21419
21435
  { class: "icon" },
21420
- [["i", { class: "yi-cloudversify" }]]
21436
+ [yui_toolbar_icon("yi-cloudversify")]
21421
21437
  ], [
21422
21438
  "span",
21423
21439
  { class: "TREEDB_TOPICS_SOURCE_URL" },
@@ -21437,7 +21453,7 @@ function build_ui$6(gobj) {
21437
21453
  [[
21438
21454
  "span",
21439
21455
  { class: "icon" },
21440
- [["i", { class: "yi-eye" }]]
21456
+ [yui_toolbar_icon("yi-eye")]
21441
21457
  ], [
21442
21458
  "span",
21443
21459
  { i18n: "raw json" },
@@ -24057,7 +24073,7 @@ function build_ui$5(gobj) {
24057
24073
  id: ``,
24058
24074
  class: "button button-edit-record mr-1"
24059
24075
  },
24060
- [["i", { class: "yi-pen" }], [
24076
+ [yui_toolbar_icon("yi-pen"), [
24061
24077
  "span",
24062
24078
  {
24063
24079
  class: "is-hidden-mobile",
@@ -24080,7 +24096,7 @@ function build_ui$5(gobj) {
24080
24096
  class: "button button-new-record mr-1",
24081
24097
  disabled: true
24082
24098
  },
24083
- [["i", { class: "yi-plus" }], [
24099
+ [yui_toolbar_icon("yi-plus"), [
24084
24100
  "span",
24085
24101
  {
24086
24102
  class: "is-hidden-mobile",
@@ -24104,7 +24120,7 @@ function build_ui$5(gobj) {
24104
24120
  class: "button button-delete-record mr-1",
24105
24121
  disabled: true
24106
24122
  },
24107
- [["i", { class: "yi-trash" }], [
24123
+ [yui_toolbar_icon("yi-trash"), [
24108
24124
  "span",
24109
24125
  {
24110
24126
  class: "is-hidden-mobile",
@@ -24128,7 +24144,7 @@ function build_ui$5(gobj) {
24128
24144
  class: "button button-copy-record mr-1",
24129
24145
  disabled: true
24130
24146
  },
24131
- [["i", { class: "yi-copy" }], [
24147
+ [yui_toolbar_icon("yi-copy"), [
24132
24148
  "span",
24133
24149
  {
24134
24150
  class: "is-hidden-mobile",
@@ -24152,7 +24168,7 @@ function build_ui$5(gobj) {
24152
24168
  class: "button button-paste-record mr-1",
24153
24169
  disabled: true
24154
24170
  },
24155
- [["i", { class: "yi-paste" }], [
24171
+ [yui_toolbar_icon("yi-paste"), [
24156
24172
  "span",
24157
24173
  {
24158
24174
  class: "is-hidden-mobile",
@@ -24193,7 +24209,7 @@ function build_ui$5(gobj) {
24193
24209
  }], [
24194
24210
  "span",
24195
24211
  { class: "icon is-left" },
24196
- [["i", { class: "yi-magnifying-glass" }]]
24212
+ [yui_toolbar_icon("yi-magnifying-glass")]
24197
24213
  ]]
24198
24214
  ]);
24199
24215
  let $search_input = $search_box.querySelector(`#${search_id}`);
@@ -24211,7 +24227,7 @@ function build_ui$5(gobj) {
24211
24227
  title: (0, i18next.t)("refresh"),
24212
24228
  "data-i18n-title": "refresh"
24213
24229
  },
24214
- [["i", { class: "yi-arrows-rotate" }], [
24230
+ [yui_toolbar_icon("yi-arrows-rotate"), [
24215
24231
  "span",
24216
24232
  {
24217
24233
  class: "is-hidden-mobile",
@@ -24237,7 +24253,7 @@ function build_ui$5(gobj) {
24237
24253
  "aria-label": (0, i18next.t)("schema"),
24238
24254
  "data-i18n-aria-label": "schema"
24239
24255
  },
24240
- [["i", { class: "yi-hexagon-nodes" }], [
24256
+ [yui_toolbar_icon("yi-hexagon-nodes"), [
24241
24257
  "span",
24242
24258
  {
24243
24259
  class: "is-hidden-mobile",
@@ -24263,7 +24279,7 @@ function build_ui$5(gobj) {
24263
24279
  "aria-label": (0, i18next.t)("columns"),
24264
24280
  "data-i18n-aria-label": "columns"
24265
24281
  },
24266
- [["i", { class: "yi-table" }], [
24282
+ [yui_toolbar_icon("yi-table"), [
24267
24283
  "span",
24268
24284
  {
24269
24285
  class: "is-hidden-mobile",
@@ -24289,7 +24305,7 @@ function build_ui$5(gobj) {
24289
24305
  "aria-label": (0, i18next.t)("export"),
24290
24306
  "data-i18n-aria-label": "export"
24291
24307
  },
24292
- [["i", { class: "yi-download" }], [
24308
+ [yui_toolbar_icon("yi-download"), [
24293
24309
  "span",
24294
24310
  {
24295
24311
  class: "is-hidden-mobile",
@@ -62103,7 +62119,7 @@ function node_shape_items(gobj, wide) {
62103
62119
  "data-i18n-aria-label": key,
62104
62120
  "aria-pressed": "false"
62105
62121
  },
62106
- yui_graph_icon(NODE_MODE_ICONS[mode]),
62122
+ yui_toolbar_icon(NODE_MODE_ICONS[mode]),
62107
62123
  { click: (evt) => {
62108
62124
  evt.stopPropagation();
62109
62125
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
@@ -62125,7 +62141,7 @@ function node_shape_items(gobj, wide) {
62125
62141
  "data-i18n-aria-label": "node labels",
62126
62142
  "aria-pressed": "false"
62127
62143
  },
62128
- yui_graph_icon("yi-font"),
62144
+ yui_toolbar_icon("yi-font"),
62129
62145
  { click: (evt) => {
62130
62146
  evt.stopPropagation();
62131
62147
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
@@ -62219,7 +62235,7 @@ function make_toolbar(gobj) {
62219
62235
  [
62220
62236
  "button",
62221
62237
  { class: "GRAPH_REFRESH button" },
62222
- [yui_graph_icon("yi-arrows-rotate"), [
62238
+ [yui_toolbar_icon("yi-arrows-rotate"), [
62223
62239
  "span",
62224
62240
  {
62225
62241
  class: "is-hidden-mobile",
@@ -62244,7 +62260,7 @@ function make_toolbar(gobj) {
62244
62260
  "data-i18n-title": "raw json",
62245
62261
  "data-i18n-aria-label": "raw json"
62246
62262
  },
62247
- [yui_graph_icon("yi-eye"), [
62263
+ [yui_toolbar_icon("yi-eye"), [
62248
62264
  "span",
62249
62265
  {
62250
62266
  class: "is-hidden-mobile",
@@ -62289,7 +62305,7 @@ function make_toolbar(gobj) {
62289
62305
  [$find_input, [
62290
62306
  "span",
62291
62307
  { class: "icon is-left" },
62292
- [yui_graph_icon("yi-magnifying-glass")]
62308
+ [yui_toolbar_icon("yi-magnifying-glass")]
62293
62309
  ]]
62294
62310
  ]);
62295
62311
  attach_clear($find_control, $find_input);
@@ -63258,7 +63274,7 @@ function ac_set_operation_mode(gobj, event, kw, src) {
63258
63274
  * card's graph icon travels — as EV_TOPIC_SELECTED, which the host turns
63259
63275
  * into the URL, so what you are looking at stays linkable.
63260
63276
  ************************************************************/
63261
- var LEGEND_GLYPH_STYLE = `font-size:${YUI_GRAPH_ICON_SIZE}; line-height:1; color:inherit;`;
63277
+ var LEGEND_GLYPH_STYLE = `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;`;
63262
63278
  var LEGEND_NAME_STYLE = "font-size:1rem; line-height:1.2;";
63263
63279
  var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem;";
63264
63280
  function refresh_legend(gobj) {
@@ -10293,6 +10293,35 @@ function register_c_yui_uplot() {
10293
10293
  }
10294
10294
  //#endregion
10295
10295
  //#region src/yui_toolbar.js
10296
+ /************************************************************
10297
+ * ONE size for every glyph of a view's toolbar, in `rem`.
10298
+ *
10299
+ * It lives here because it belongs to the TOOLBAR and not to
10300
+ * any one view: it was born in the graph rows (7.23.86) and the
10301
+ * JSON viewer beside them still drew 16px, which is the same
10302
+ * drift one level up.
10303
+ *
10304
+ * `rem` and not `em` is the whole lesson: `em` is measured
10305
+ * against the button, so one declaration draws three icons --
10306
+ * `1.5em` is 24px in a plain button, 18px in an `is-small`
10307
+ * chip, and a labelled button that declares nothing keeps the
10308
+ * inherited 16px. `rem` is measured against the page, so a
10309
+ * chip deliberately shorter than a button still carries the
10310
+ * same glyph.
10311
+ *
10312
+ * 20px against a row's 16px text: an icon-only button is
10313
+ * legible at half its 40px height, and beside a label the
10314
+ * glyph reads as a marker rather than as a second word. The
10315
+ * app BAR is a different band and keeps its own, bigger size
10316
+ * (`.yui-toolbar-item .icon`, 1.35rem on 44px items).
10317
+ ************************************************************/
10318
+ var YUI_TOOLBAR_ICON_SIZE = "1.25rem";
10319
+ function yui_toolbar_icon(icon_class, extra_style) {
10320
+ return ["i", {
10321
+ class: icon_class,
10322
+ style: `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
10323
+ }];
10324
+ }
10296
10325
  function yui_toolbar(attrs = {}, items = []) {
10297
10326
  function arrow_button(side, icon, label) {
10298
10327
  return [
@@ -10555,30 +10584,6 @@ function getPointPosition(count, index, margin = .2) {
10555
10584
  * All Rights Reserved.
10556
10585
  ***********************************************************************/
10557
10586
  /************************************************************
10558
- * ONE size for every glyph of a graph's toolbar ROW, in
10559
- * `rem` and not `em`.
10560
- *
10561
- * In `em` the same declaration draws three different icons:
10562
- * `1.5em` is 24px inside a plain button, 18px inside an
10563
- * `is-small` one, and a labelled button left its icon at the
10564
- * inherited 16px -- so one row held 16px, 18px and 24px
10565
- * glyphs and looked like three toolbars pushed together.
10566
- * `rem` is measured against the page, so a chip that is
10567
- * deliberately shorter than a button still carries the same
10568
- * glyph.
10569
- *
10570
- * 20px against the row's 16px text: an icon-only button is
10571
- * legible at half its 40px height, and beside a label the
10572
- * glyph reads as a marker rather than as a second word.
10573
- ************************************************************/
10574
- var YUI_GRAPH_ICON_SIZE = "1.25rem";
10575
- function yui_graph_icon(icon_class, extra_style) {
10576
- return ["i", {
10577
- class: icon_class,
10578
- style: `font-size:${YUI_GRAPH_ICON_SIZE}; line-height:1; color:inherit;` + (extra_style || "")
10579
- }];
10580
- }
10581
- /************************************************************
10582
10587
  * One icon button that fires `event_name`.
10583
10588
  ************************************************************/
10584
10589
  function camera_button(gobj, icon, event_name, label_key, wide, extra_style) {
@@ -10596,7 +10601,7 @@ function camera_button(gobj, icon, event_name, label_key, wide, extra_style) {
10596
10601
  "aria-label": t(label_key),
10597
10602
  "data-i18n-aria-label": label_key
10598
10603
  },
10599
- yui_graph_icon(icon, extra_style),
10604
+ yui_toolbar_icon(icon, extra_style),
10600
10605
  { click: (evt) => {
10601
10606
  evt.stopPropagation();
10602
10607
  gobj_send_event(gobj, event_name, { evt }, gobj);
@@ -11386,7 +11391,7 @@ var attrs_table$13 = [
11386
11391
  SDATA(data_type_t.DTP_JSON, "json_data", 0, null, "JSON data to visualize"),
11387
11392
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
11388
11393
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
11389
- SDATA(data_type_t.DTP_STRING, "wide", 0, "36px", "Height of header"),
11394
+ 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"),
11390
11395
  SDATA(data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
11391
11396
  SDATA_END()
11392
11397
  ];
@@ -11689,7 +11694,7 @@ function make_toolbar$5(gobj) {
11689
11694
  [$find_input, [
11690
11695
  "span",
11691
11696
  { class: "icon is-left" },
11692
- [yui_graph_icon("yi-magnifying-glass")]
11697
+ [yui_toolbar_icon("yi-magnifying-glass")]
11693
11698
  ]]
11694
11699
  ]);
11695
11700
  attach_clear($find_control, $find_input);
@@ -11723,19 +11728,23 @@ function make_toolbar$5(gobj) {
11723
11728
  ];
11724
11729
  });
11725
11730
  let right_items = [createElement2([
11726
- "select",
11731
+ "div",
11727
11732
  {
11728
- class: "JSON_GRAPH_LAYOUT select",
11729
- style: {
11730
- height: toolbar_wide,
11731
- "margin-left": "0.5em"
11732
- },
11733
- title: t("layout"),
11734
- "data-i18n-title": "layout",
11735
- "aria-label": t("layout"),
11736
- "data-i18n-aria-label": "layout"
11733
+ class: "select",
11734
+ style: { "margin-left": "0.5em" }
11737
11735
  },
11738
- options,
11736
+ [[
11737
+ "select",
11738
+ {
11739
+ class: "JSON_GRAPH_LAYOUT",
11740
+ style: { height: toolbar_wide },
11741
+ title: t("layout"),
11742
+ "data-i18n-title": "layout",
11743
+ "aria-label": t("layout"),
11744
+ "data-i18n-aria-label": "layout"
11745
+ },
11746
+ options
11747
+ ]],
11739
11748
  { change: (evt) => {
11740
11749
  evt.stopPropagation();
11741
11750
  gobj_send_event(gobj, "EV_CHANGE_LAYOUT", { layout: evt.target.value }, gobj);
@@ -13215,7 +13224,7 @@ function make_toolbar$4(gobj) {
13215
13224
  [$search_input, [
13216
13225
  "span",
13217
13226
  { class: "icon is-left" },
13218
- [["i", { class: "yi-magnifying-glass" }]]
13227
+ [yui_toolbar_icon("yi-magnifying-glass")]
13219
13228
  ]]
13220
13229
  ]);
13221
13230
  left_items.push(icon_button$1(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"), icon_button$1(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all"));
@@ -13265,7 +13274,7 @@ function icon_button$1(gobj, icon, event_name, label_key) {
13265
13274
  [[
13266
13275
  "span",
13267
13276
  { class: "icon" },
13268
- [["i", { class: icon }]]
13277
+ [yui_toolbar_icon(icon)]
13269
13278
  ]],
13270
13279
  { click: function(evt) {
13271
13280
  evt.stopPropagation();
@@ -13302,7 +13311,7 @@ function view_mode_switch$1(gobj) {
13302
13311
  [[
13303
13312
  "span",
13304
13313
  { class: "icon" },
13305
- [["i", { class: v.icon }]]
13314
+ [yui_toolbar_icon(v.icon)]
13306
13315
  ]],
13307
13316
  { click: function(evt) {
13308
13317
  evt.stopPropagation();
@@ -17478,7 +17487,7 @@ var attrs_table$9 = [
17478
17487
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
17479
17488
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
17480
17489
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
17481
- SDATA(data_type_t.DTP_STRING, "wide", 0, "36px", "Height of header"),
17490
+ 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"),
17482
17491
  SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
17483
17492
  SDATA(data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
17484
17493
  SDATA_END()
@@ -18131,7 +18140,7 @@ function make_find_items(gobj) {
18131
18140
  [$find_input, [
18132
18141
  "span",
18133
18142
  { class: "icon is-left" },
18134
- [yui_graph_icon("yi-magnifying-glass")]
18143
+ [yui_toolbar_icon("yi-magnifying-glass")]
18135
18144
  ]]
18136
18145
  ]);
18137
18146
  attach_clear($find_control, $find_input);
@@ -18201,24 +18210,31 @@ function make_toolbar$1(gobj) {
18201
18210
  LAYOUTS[key].label
18202
18211
  ]);
18203
18212
  }
18204
- let $select = createElement2([
18205
- "select",
18213
+ let $wrap = createElement2([
18214
+ "div",
18206
18215
  {
18207
18216
  class: "select",
18208
- style: {
18209
- height: toolbar_wide,
18210
- "margin-left": "0.5em"
18211
- },
18212
- title: t("layout")
18217
+ style: { "margin-left": "0.5em" }
18213
18218
  },
18214
- options,
18219
+ [[
18220
+ "select",
18221
+ {
18222
+ class: "GOBJ_TREE_LAYOUT",
18223
+ style: { height: toolbar_wide },
18224
+ title: t("layout"),
18225
+ "data-i18n-title": "layout",
18226
+ "aria-label": t("layout"),
18227
+ "data-i18n-aria-label": "layout"
18228
+ },
18229
+ options
18230
+ ]],
18215
18231
  { change: (evt) => {
18216
18232
  let value = evt.target.value;
18217
18233
  gobj_send_event(gobj, "EV_CHANGE_LAYOUT", { layout: value }, gobj);
18218
18234
  } }
18219
18235
  ]);
18220
- priv.$layout_select = $select;
18221
- right_items.push($select);
18236
+ priv.$layout_select = $wrap.querySelector("select");
18237
+ right_items.push($wrap);
18222
18238
  const $toolbar = yui_toolbar({}, [
18223
18239
  [
18224
18240
  "div",
@@ -21368,7 +21384,7 @@ function build_ui$6(gobj) {
21368
21384
  [[
21369
21385
  "span",
21370
21386
  { class: "icon" },
21371
- [["i", { class: "yi-arrow-left" }]]
21387
+ [yui_toolbar_icon("yi-arrow-left")]
21372
21388
  ], [
21373
21389
  "span",
21374
21390
  { i18n: "topics" },
@@ -21391,7 +21407,7 @@ function build_ui$6(gobj) {
21391
21407
  [[
21392
21408
  "span",
21393
21409
  { class: "icon" },
21394
- [["i", { class: "yi-hexagon-nodes" }]]
21410
+ [yui_toolbar_icon("yi-hexagon-nodes")]
21395
21411
  ], [
21396
21412
  "span",
21397
21413
  { i18n: "schema" },
@@ -21412,7 +21428,7 @@ function build_ui$6(gobj) {
21412
21428
  [[
21413
21429
  "span",
21414
21430
  { class: "icon" },
21415
- [["i", { class: "yi-cloudversify" }]]
21431
+ [yui_toolbar_icon("yi-cloudversify")]
21416
21432
  ], [
21417
21433
  "span",
21418
21434
  { class: "TREEDB_TOPICS_SOURCE_URL" },
@@ -21432,7 +21448,7 @@ function build_ui$6(gobj) {
21432
21448
  [[
21433
21449
  "span",
21434
21450
  { class: "icon" },
21435
- [["i", { class: "yi-eye" }]]
21451
+ [yui_toolbar_icon("yi-eye")]
21436
21452
  ], [
21437
21453
  "span",
21438
21454
  { i18n: "raw json" },
@@ -24052,7 +24068,7 @@ function build_ui$5(gobj) {
24052
24068
  id: ``,
24053
24069
  class: "button button-edit-record mr-1"
24054
24070
  },
24055
- [["i", { class: "yi-pen" }], [
24071
+ [yui_toolbar_icon("yi-pen"), [
24056
24072
  "span",
24057
24073
  {
24058
24074
  class: "is-hidden-mobile",
@@ -24075,7 +24091,7 @@ function build_ui$5(gobj) {
24075
24091
  class: "button button-new-record mr-1",
24076
24092
  disabled: true
24077
24093
  },
24078
- [["i", { class: "yi-plus" }], [
24094
+ [yui_toolbar_icon("yi-plus"), [
24079
24095
  "span",
24080
24096
  {
24081
24097
  class: "is-hidden-mobile",
@@ -24099,7 +24115,7 @@ function build_ui$5(gobj) {
24099
24115
  class: "button button-delete-record mr-1",
24100
24116
  disabled: true
24101
24117
  },
24102
- [["i", { class: "yi-trash" }], [
24118
+ [yui_toolbar_icon("yi-trash"), [
24103
24119
  "span",
24104
24120
  {
24105
24121
  class: "is-hidden-mobile",
@@ -24123,7 +24139,7 @@ function build_ui$5(gobj) {
24123
24139
  class: "button button-copy-record mr-1",
24124
24140
  disabled: true
24125
24141
  },
24126
- [["i", { class: "yi-copy" }], [
24142
+ [yui_toolbar_icon("yi-copy"), [
24127
24143
  "span",
24128
24144
  {
24129
24145
  class: "is-hidden-mobile",
@@ -24147,7 +24163,7 @@ function build_ui$5(gobj) {
24147
24163
  class: "button button-paste-record mr-1",
24148
24164
  disabled: true
24149
24165
  },
24150
- [["i", { class: "yi-paste" }], [
24166
+ [yui_toolbar_icon("yi-paste"), [
24151
24167
  "span",
24152
24168
  {
24153
24169
  class: "is-hidden-mobile",
@@ -24188,7 +24204,7 @@ function build_ui$5(gobj) {
24188
24204
  }], [
24189
24205
  "span",
24190
24206
  { class: "icon is-left" },
24191
- [["i", { class: "yi-magnifying-glass" }]]
24207
+ [yui_toolbar_icon("yi-magnifying-glass")]
24192
24208
  ]]
24193
24209
  ]);
24194
24210
  let $search_input = $search_box.querySelector(`#${search_id}`);
@@ -24206,7 +24222,7 @@ function build_ui$5(gobj) {
24206
24222
  title: t("refresh"),
24207
24223
  "data-i18n-title": "refresh"
24208
24224
  },
24209
- [["i", { class: "yi-arrows-rotate" }], [
24225
+ [yui_toolbar_icon("yi-arrows-rotate"), [
24210
24226
  "span",
24211
24227
  {
24212
24228
  class: "is-hidden-mobile",
@@ -24232,7 +24248,7 @@ function build_ui$5(gobj) {
24232
24248
  "aria-label": t("schema"),
24233
24249
  "data-i18n-aria-label": "schema"
24234
24250
  },
24235
- [["i", { class: "yi-hexagon-nodes" }], [
24251
+ [yui_toolbar_icon("yi-hexagon-nodes"), [
24236
24252
  "span",
24237
24253
  {
24238
24254
  class: "is-hidden-mobile",
@@ -24258,7 +24274,7 @@ function build_ui$5(gobj) {
24258
24274
  "aria-label": t("columns"),
24259
24275
  "data-i18n-aria-label": "columns"
24260
24276
  },
24261
- [["i", { class: "yi-table" }], [
24277
+ [yui_toolbar_icon("yi-table"), [
24262
24278
  "span",
24263
24279
  {
24264
24280
  class: "is-hidden-mobile",
@@ -24284,7 +24300,7 @@ function build_ui$5(gobj) {
24284
24300
  "aria-label": t("export"),
24285
24301
  "data-i18n-aria-label": "export"
24286
24302
  },
24287
- [["i", { class: "yi-download" }], [
24303
+ [yui_toolbar_icon("yi-download"), [
24288
24304
  "span",
24289
24305
  {
24290
24306
  class: "is-hidden-mobile",
@@ -62098,7 +62114,7 @@ function node_shape_items(gobj, wide) {
62098
62114
  "data-i18n-aria-label": key,
62099
62115
  "aria-pressed": "false"
62100
62116
  },
62101
- yui_graph_icon(NODE_MODE_ICONS[mode]),
62117
+ yui_toolbar_icon(NODE_MODE_ICONS[mode]),
62102
62118
  { click: (evt) => {
62103
62119
  evt.stopPropagation();
62104
62120
  gobj_send_event(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
@@ -62120,7 +62136,7 @@ function node_shape_items(gobj, wide) {
62120
62136
  "data-i18n-aria-label": "node labels",
62121
62137
  "aria-pressed": "false"
62122
62138
  },
62123
- yui_graph_icon("yi-font"),
62139
+ yui_toolbar_icon("yi-font"),
62124
62140
  { click: (evt) => {
62125
62141
  evt.stopPropagation();
62126
62142
  gobj_send_event(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
@@ -62214,7 +62230,7 @@ function make_toolbar(gobj) {
62214
62230
  [
62215
62231
  "button",
62216
62232
  { class: "GRAPH_REFRESH button" },
62217
- [yui_graph_icon("yi-arrows-rotate"), [
62233
+ [yui_toolbar_icon("yi-arrows-rotate"), [
62218
62234
  "span",
62219
62235
  {
62220
62236
  class: "is-hidden-mobile",
@@ -62239,7 +62255,7 @@ function make_toolbar(gobj) {
62239
62255
  "data-i18n-title": "raw json",
62240
62256
  "data-i18n-aria-label": "raw json"
62241
62257
  },
62242
- [yui_graph_icon("yi-eye"), [
62258
+ [yui_toolbar_icon("yi-eye"), [
62243
62259
  "span",
62244
62260
  {
62245
62261
  class: "is-hidden-mobile",
@@ -62284,7 +62300,7 @@ function make_toolbar(gobj) {
62284
62300
  [$find_input, [
62285
62301
  "span",
62286
62302
  { class: "icon is-left" },
62287
- [yui_graph_icon("yi-magnifying-glass")]
62303
+ [yui_toolbar_icon("yi-magnifying-glass")]
62288
62304
  ]]
62289
62305
  ]);
62290
62306
  attach_clear($find_control, $find_input);
@@ -63253,7 +63269,7 @@ function ac_set_operation_mode(gobj, event, kw, src) {
63253
63269
  * card's graph icon travels — as EV_TOPIC_SELECTED, which the host turns
63254
63270
  * into the URL, so what you are looking at stays linkable.
63255
63271
  ************************************************************/
63256
- var LEGEND_GLYPH_STYLE = `font-size:${YUI_GRAPH_ICON_SIZE}; line-height:1; color:inherit;`;
63272
+ var LEGEND_GLYPH_STYLE = `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;`;
63257
63273
  var LEGEND_NAME_STYLE = "font-size:1rem; line-height:1.2;";
63258
63274
  var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem;";
63259
63275
  function refresh_legend(gobj) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.86",
3
+ "version": "7.23.87",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -54,7 +54,7 @@ import {
54
54
  } from "./yui_gclass_view.js";
55
55
  import {yui_shell_of} from "./c_yui_shell.js";
56
56
 
57
- import {yui_toolbar} from "./yui_toolbar.js";
57
+ import {yui_toolbar, yui_toolbar_icon} from "./yui_toolbar.js";
58
58
  import {attach_clear} from "./yui_inputs.js";
59
59
  import {
60
60
  yui_graph_camera_items,
@@ -62,7 +62,6 @@ import {
62
62
  yui_graph_update_anchor,
63
63
  yui_graph_center_on,
64
64
  yui_graph_fold_items,
65
- yui_graph_icon,
66
65
  yui_graph_refresh_item,
67
66
  yui_graph_update_zoom,
68
67
  } from "./yui_graph_camera.js";
@@ -99,7 +98,7 @@ SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container eleme
99
98
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
100
99
 
101
100
  /*---------------- Graph Settings ----------------*/
102
- SDATA(data_type_t.DTP_STRING, "wide", 0, "36px", "Height of header"),
101
+ 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"),
103
102
  SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
104
103
  SDATA(data_type_t.DTP_INTEGER, "collapse_threshold", 0, 10, "Auto-collapse a node whose direct children exceed this number. 0 disables auto-collapse."),
105
104
 
@@ -907,7 +906,7 @@ function make_find_items(gobj)
907
906
  style: 'margin-left:.5rem; margin-right:.5rem; ' +
908
907
  'max-width:12rem; min-width:7rem;'}, [
909
908
  $find_input,
910
- ['span', {class: 'icon is-left'}, [yui_graph_icon('yi-magnifying-glass')]]
909
+ ['span', {class: 'icon is-left'}, [yui_toolbar_icon('yi-magnifying-glass')]]
911
910
  ]]);
912
911
  attach_clear($find_control, $find_input);
913
912
 
@@ -1019,23 +1018,27 @@ function make_toolbar(gobj)
1019
1018
  options.push(['option', opt_attrs, LAYOUTS[key].label]);
1020
1019
  }
1021
1020
 
1022
- let $select = createElement2(
1023
- ['select', {
1024
- class: 'select',
1025
- style: {height: toolbar_wide, "margin-left": "0.5em"},
1026
- title: t("layout"),
1027
- },
1028
- options,
1029
- {
1030
- change: (evt) => {
1031
- let value = evt.target.value;
1032
- gobj_send_event(gobj, "EV_CHANGE_LAYOUT", {layout: value}, gobj);
1033
- }
1021
+ /* `.select` on the WRAPPER and not on the control: Bulma styles
1022
+ * `.select select`, so the class on the `<select>` itself matched
1023
+ * nothing and the box kept the browser's 13.3px font in a row of
1024
+ * 16px controls. */
1025
+ let $wrap = createElement2(
1026
+ ['div', {class: 'select', style: {"margin-left": "0.5em"}}, [
1027
+ ['select', {
1028
+ class: 'GOBJ_TREE_LAYOUT',
1029
+ style: {height: toolbar_wide},
1030
+ title: t("layout"), 'data-i18n-title': "layout",
1031
+ 'aria-label': t("layout"), 'data-i18n-aria-label': "layout",
1032
+ }, options]
1033
+ ], {
1034
+ change: (evt) => {
1035
+ let value = evt.target.value;
1036
+ gobj_send_event(gobj, "EV_CHANGE_LAYOUT", {layout: value}, gobj);
1034
1037
  }
1035
- ]
1038
+ }]
1036
1039
  );
1037
- priv.$layout_select = $select;
1038
- right_items.push($select);
1040
+ priv.$layout_select = $wrap.querySelector("select");
1041
+ right_items.push($wrap);
1039
1042
 
1040
1043
  const $toolbar = yui_toolbar({}, [
1041
1044
  ['div', {class: 'yui-horizontal-toolbar-section left'}, left_items],
package/src/c_yui_json.js CHANGED
@@ -102,7 +102,7 @@ import {
102
102
  container_label,
103
103
  } from "./json_view_helpers.js";
104
104
 
105
- import {yui_toolbar} from "./yui_toolbar.js";
105
+ import {yui_toolbar, yui_toolbar_icon} from "./yui_toolbar.js";
106
106
  import {register_c_yui_json_graph} from "./c_yui_json_graph.js";
107
107
  import {attach_clear} from "./yui_inputs.js";
108
108
 
@@ -388,7 +388,7 @@ function make_toolbar(gobj)
388
388
  ['div', {class: 'control has-icons-left JSON_SEARCH_CONTROL',
389
389
  style: 'max-width:22em;'}, [
390
390
  $search_input,
391
- ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
391
+ ['span', {class: 'icon is-left'}, [yui_toolbar_icon('yi-magnifying-glass')]]
392
392
  ]]);
393
393
  /* The GLOBAL fold leads the row, ahead of the find box — the same
394
394
  * place both graphs put theirs. It opens the whole document; the
@@ -426,7 +426,7 @@ function icon_button(gobj, icon, event_name, label_key)
426
426
  return ['button', {class: `button ${event_name}`, style: 'width:2.5em;',
427
427
  title: t(label_key), 'data-i18n-title': label_key,
428
428
  'aria-label': t(label_key), 'data-i18n-aria-label': label_key}, [
429
- ['span', {class: 'icon'}, [['i', {class: icon}]]]
429
+ ['span', {class: 'icon'}, [yui_toolbar_icon(icon)]]
430
430
  ], {
431
431
  click: function(evt) {
432
432
  evt.stopPropagation();
@@ -452,7 +452,7 @@ function view_mode_switch(gobj)
452
452
  type: 'button', style: 'width:2.5em;',
453
453
  title: label, 'data-i18n-title': v.key,
454
454
  'aria-label': label, 'data-i18n-aria-label': v.key}, [
455
- ['span', {class: 'icon'}, [['i', {class: v.icon}]]]
455
+ ['span', {class: 'icon'}, [yui_toolbar_icon(v.icon)]]
456
456
  ], {
457
457
  click: function(evt) {
458
458
  evt.stopPropagation();
@@ -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,
@@ -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
 
@@ -2468,7 +2465,7 @@ function ac_set_operation_mode(gobj, event, kw, src)
2468
2465
  *
2469
2466
  * The count is the one deliberate step down: it is the number beside
2470
2467
  * the name, not the name. */
2471
- const LEGEND_GLYPH_STYLE = `font-size:${YUI_GRAPH_ICON_SIZE}; line-height:1; color:inherit;`;
2468
+ const LEGEND_GLYPH_STYLE = `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;`;
2472
2469
  const LEGEND_NAME_STYLE = 'font-size:1rem; line-height:1.2;';
2473
2470
  const LEGEND_COUNT_STYLE = 'margin-left:.4rem; font-size:.875rem;';
2474
2471
 
@@ -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};