@yuneta/gobj-ui 7.23.85 → 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,6 +850,20 @@ 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 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
863
+ follows it: topic name at `1rem`, count at `.875rem` (the one deliberate step
864
+ down), glyphs at the shared size, and `align-items: stretch` so a chip's star
865
+ and crosshair are as tall as its body.
866
+
853
867
  `C_G6_NODES_TREE` floats a vertical toolbar over the canvas:
854
868
 
855
869
  | control | what it does |
@@ -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 [
@@ -10577,10 +10606,7 @@ function camera_button(gobj, icon, event_name, label_key, wide, extra_style) {
10577
10606
  "aria-label": (0, i18next.t)(label_key),
10578
10607
  "data-i18n-aria-label": label_key
10579
10608
  },
10580
- ["i", {
10581
- style: "font-size:1.5em; color:inherit;" + (extra_style || ""),
10582
- class: icon
10583
- }],
10609
+ yui_toolbar_icon(icon, extra_style),
10584
10610
  { click: (evt) => {
10585
10611
  evt.stopPropagation();
10586
10612
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, event_name, { evt }, gobj);
@@ -11370,7 +11396,7 @@ var attrs_table$13 = [
11370
11396
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "json_data", 0, null, "JSON data to visualize"),
11371
11397
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
11372
11398
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
11373
- (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"),
11374
11400
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
11375
11401
  (0, _yuneta_gobj_js.SDATA_END)()
11376
11402
  ];
@@ -11673,7 +11699,7 @@ function make_toolbar$5(gobj) {
11673
11699
  [$find_input, [
11674
11700
  "span",
11675
11701
  { class: "icon is-left" },
11676
- [["i", { class: "yi-magnifying-glass" }]]
11702
+ [yui_toolbar_icon("yi-magnifying-glass")]
11677
11703
  ]]
11678
11704
  ]);
11679
11705
  attach_clear($find_control, $find_input);
@@ -11707,19 +11733,23 @@ function make_toolbar$5(gobj) {
11707
11733
  ];
11708
11734
  });
11709
11735
  let right_items = [(0, _yuneta_gobj_js.createElement2)([
11710
- "select",
11736
+ "div",
11711
11737
  {
11712
- class: "JSON_GRAPH_LAYOUT select",
11713
- style: {
11714
- height: toolbar_wide,
11715
- "margin-left": "0.5em"
11716
- },
11717
- title: (0, i18next.t)("layout"),
11718
- "data-i18n-title": "layout",
11719
- "aria-label": (0, i18next.t)("layout"),
11720
- "data-i18n-aria-label": "layout"
11738
+ class: "select",
11739
+ style: { "margin-left": "0.5em" }
11721
11740
  },
11722
- 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
+ ]],
11723
11753
  { change: (evt) => {
11724
11754
  evt.stopPropagation();
11725
11755
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHANGE_LAYOUT", { layout: evt.target.value }, gobj);
@@ -13199,7 +13229,7 @@ function make_toolbar$4(gobj) {
13199
13229
  [$search_input, [
13200
13230
  "span",
13201
13231
  { class: "icon is-left" },
13202
- [["i", { class: "yi-magnifying-glass" }]]
13232
+ [yui_toolbar_icon("yi-magnifying-glass")]
13203
13233
  ]]
13204
13234
  ]);
13205
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"));
@@ -13249,7 +13279,7 @@ function icon_button$1(gobj, icon, event_name, label_key) {
13249
13279
  [[
13250
13280
  "span",
13251
13281
  { class: "icon" },
13252
- [["i", { class: icon }]]
13282
+ [yui_toolbar_icon(icon)]
13253
13283
  ]],
13254
13284
  { click: function(evt) {
13255
13285
  evt.stopPropagation();
@@ -13286,7 +13316,7 @@ function view_mode_switch$1(gobj) {
13286
13316
  [[
13287
13317
  "span",
13288
13318
  { class: "icon" },
13289
- [["i", { class: v.icon }]]
13319
+ [yui_toolbar_icon(v.icon)]
13290
13320
  ]],
13291
13321
  { click: function(evt) {
13292
13322
  evt.stopPropagation();
@@ -17462,7 +17492,7 @@ var attrs_table$9 = [
17462
17492
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
17463
17493
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
17464
17494
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
17465
- (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"),
17466
17496
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
17467
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."),
17468
17498
  (0, _yuneta_gobj_js.SDATA_END)()
@@ -18115,7 +18145,7 @@ function make_find_items(gobj) {
18115
18145
  [$find_input, [
18116
18146
  "span",
18117
18147
  { class: "icon is-left" },
18118
- [["i", { class: "yi-magnifying-glass" }]]
18148
+ [yui_toolbar_icon("yi-magnifying-glass")]
18119
18149
  ]]
18120
18150
  ]);
18121
18151
  attach_clear($find_control, $find_input);
@@ -18185,24 +18215,31 @@ function make_toolbar$1(gobj) {
18185
18215
  LAYOUTS[key].label
18186
18216
  ]);
18187
18217
  }
18188
- let $select = (0, _yuneta_gobj_js.createElement2)([
18189
- "select",
18218
+ let $wrap = (0, _yuneta_gobj_js.createElement2)([
18219
+ "div",
18190
18220
  {
18191
18221
  class: "select",
18192
- style: {
18193
- height: toolbar_wide,
18194
- "margin-left": "0.5em"
18195
- },
18196
- title: (0, i18next.t)("layout")
18222
+ style: { "margin-left": "0.5em" }
18197
18223
  },
18198
- 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
+ ]],
18199
18236
  { change: (evt) => {
18200
18237
  let value = evt.target.value;
18201
18238
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHANGE_LAYOUT", { layout: value }, gobj);
18202
18239
  } }
18203
18240
  ]);
18204
- priv.$layout_select = $select;
18205
- right_items.push($select);
18241
+ priv.$layout_select = $wrap.querySelector("select");
18242
+ right_items.push($wrap);
18206
18243
  const $toolbar = yui_toolbar({}, [
18207
18244
  [
18208
18245
  "div",
@@ -21352,7 +21389,7 @@ function build_ui$6(gobj) {
21352
21389
  [[
21353
21390
  "span",
21354
21391
  { class: "icon" },
21355
- [["i", { class: "yi-arrow-left" }]]
21392
+ [yui_toolbar_icon("yi-arrow-left")]
21356
21393
  ], [
21357
21394
  "span",
21358
21395
  { i18n: "topics" },
@@ -21375,7 +21412,7 @@ function build_ui$6(gobj) {
21375
21412
  [[
21376
21413
  "span",
21377
21414
  { class: "icon" },
21378
- [["i", { class: "yi-hexagon-nodes" }]]
21415
+ [yui_toolbar_icon("yi-hexagon-nodes")]
21379
21416
  ], [
21380
21417
  "span",
21381
21418
  { i18n: "schema" },
@@ -21396,7 +21433,7 @@ function build_ui$6(gobj) {
21396
21433
  [[
21397
21434
  "span",
21398
21435
  { class: "icon" },
21399
- [["i", { class: "yi-cloudversify" }]]
21436
+ [yui_toolbar_icon("yi-cloudversify")]
21400
21437
  ], [
21401
21438
  "span",
21402
21439
  { class: "TREEDB_TOPICS_SOURCE_URL" },
@@ -21416,7 +21453,7 @@ function build_ui$6(gobj) {
21416
21453
  [[
21417
21454
  "span",
21418
21455
  { class: "icon" },
21419
- [["i", { class: "yi-eye" }]]
21456
+ [yui_toolbar_icon("yi-eye")]
21420
21457
  ], [
21421
21458
  "span",
21422
21459
  { i18n: "raw json" },
@@ -24036,7 +24073,7 @@ function build_ui$5(gobj) {
24036
24073
  id: ``,
24037
24074
  class: "button button-edit-record mr-1"
24038
24075
  },
24039
- [["i", { class: "yi-pen" }], [
24076
+ [yui_toolbar_icon("yi-pen"), [
24040
24077
  "span",
24041
24078
  {
24042
24079
  class: "is-hidden-mobile",
@@ -24059,7 +24096,7 @@ function build_ui$5(gobj) {
24059
24096
  class: "button button-new-record mr-1",
24060
24097
  disabled: true
24061
24098
  },
24062
- [["i", { class: "yi-plus" }], [
24099
+ [yui_toolbar_icon("yi-plus"), [
24063
24100
  "span",
24064
24101
  {
24065
24102
  class: "is-hidden-mobile",
@@ -24083,7 +24120,7 @@ function build_ui$5(gobj) {
24083
24120
  class: "button button-delete-record mr-1",
24084
24121
  disabled: true
24085
24122
  },
24086
- [["i", { class: "yi-trash" }], [
24123
+ [yui_toolbar_icon("yi-trash"), [
24087
24124
  "span",
24088
24125
  {
24089
24126
  class: "is-hidden-mobile",
@@ -24107,7 +24144,7 @@ function build_ui$5(gobj) {
24107
24144
  class: "button button-copy-record mr-1",
24108
24145
  disabled: true
24109
24146
  },
24110
- [["i", { class: "yi-copy" }], [
24147
+ [yui_toolbar_icon("yi-copy"), [
24111
24148
  "span",
24112
24149
  {
24113
24150
  class: "is-hidden-mobile",
@@ -24131,7 +24168,7 @@ function build_ui$5(gobj) {
24131
24168
  class: "button button-paste-record mr-1",
24132
24169
  disabled: true
24133
24170
  },
24134
- [["i", { class: "yi-paste" }], [
24171
+ [yui_toolbar_icon("yi-paste"), [
24135
24172
  "span",
24136
24173
  {
24137
24174
  class: "is-hidden-mobile",
@@ -24172,7 +24209,7 @@ function build_ui$5(gobj) {
24172
24209
  }], [
24173
24210
  "span",
24174
24211
  { class: "icon is-left" },
24175
- [["i", { class: "yi-magnifying-glass" }]]
24212
+ [yui_toolbar_icon("yi-magnifying-glass")]
24176
24213
  ]]
24177
24214
  ]);
24178
24215
  let $search_input = $search_box.querySelector(`#${search_id}`);
@@ -24190,7 +24227,7 @@ function build_ui$5(gobj) {
24190
24227
  title: (0, i18next.t)("refresh"),
24191
24228
  "data-i18n-title": "refresh"
24192
24229
  },
24193
- [["i", { class: "yi-arrows-rotate" }], [
24230
+ [yui_toolbar_icon("yi-arrows-rotate"), [
24194
24231
  "span",
24195
24232
  {
24196
24233
  class: "is-hidden-mobile",
@@ -24216,7 +24253,7 @@ function build_ui$5(gobj) {
24216
24253
  "aria-label": (0, i18next.t)("schema"),
24217
24254
  "data-i18n-aria-label": "schema"
24218
24255
  },
24219
- [["i", { class: "yi-hexagon-nodes" }], [
24256
+ [yui_toolbar_icon("yi-hexagon-nodes"), [
24220
24257
  "span",
24221
24258
  {
24222
24259
  class: "is-hidden-mobile",
@@ -24242,7 +24279,7 @@ function build_ui$5(gobj) {
24242
24279
  "aria-label": (0, i18next.t)("columns"),
24243
24280
  "data-i18n-aria-label": "columns"
24244
24281
  },
24245
- [["i", { class: "yi-table" }], [
24282
+ [yui_toolbar_icon("yi-table"), [
24246
24283
  "span",
24247
24284
  {
24248
24285
  class: "is-hidden-mobile",
@@ -24268,7 +24305,7 @@ function build_ui$5(gobj) {
24268
24305
  "aria-label": (0, i18next.t)("export"),
24269
24306
  "data-i18n-aria-label": "export"
24270
24307
  },
24271
- [["i", { class: "yi-download" }], [
24308
+ [yui_toolbar_icon("yi-download"), [
24272
24309
  "span",
24273
24310
  {
24274
24311
  class: "is-hidden-mobile",
@@ -62082,10 +62119,7 @@ function node_shape_items(gobj, wide) {
62082
62119
  "data-i18n-aria-label": key,
62083
62120
  "aria-pressed": "false"
62084
62121
  },
62085
- ["i", {
62086
- style: "font-size:1.5em; color:inherit;",
62087
- class: NODE_MODE_ICONS[mode]
62088
- }],
62122
+ yui_toolbar_icon(NODE_MODE_ICONS[mode]),
62089
62123
  { click: (evt) => {
62090
62124
  evt.stopPropagation();
62091
62125
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
@@ -62107,10 +62141,7 @@ function node_shape_items(gobj, wide) {
62107
62141
  "data-i18n-aria-label": "node labels",
62108
62142
  "aria-pressed": "false"
62109
62143
  },
62110
- ["i", {
62111
- style: "font-size:1.5em; color:inherit;",
62112
- class: "yi-font"
62113
- }],
62144
+ yui_toolbar_icon("yi-font"),
62114
62145
  { click: (evt) => {
62115
62146
  evt.stopPropagation();
62116
62147
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
@@ -62204,7 +62235,7 @@ function make_toolbar(gobj) {
62204
62235
  [
62205
62236
  "button",
62206
62237
  { class: "GRAPH_REFRESH button" },
62207
- [["i", { class: "yi-arrows-rotate" }], [
62238
+ [yui_toolbar_icon("yi-arrows-rotate"), [
62208
62239
  "span",
62209
62240
  {
62210
62241
  class: "is-hidden-mobile",
@@ -62229,7 +62260,7 @@ function make_toolbar(gobj) {
62229
62260
  "data-i18n-title": "raw json",
62230
62261
  "data-i18n-aria-label": "raw json"
62231
62262
  },
62232
- [["i", { class: "yi-eye" }], [
62263
+ [yui_toolbar_icon("yi-eye"), [
62233
62264
  "span",
62234
62265
  {
62235
62266
  class: "is-hidden-mobile",
@@ -62274,7 +62305,7 @@ function make_toolbar(gobj) {
62274
62305
  [$find_input, [
62275
62306
  "span",
62276
62307
  { class: "icon is-left" },
62277
- [["i", { class: "yi-magnifying-glass" }]]
62308
+ [yui_toolbar_icon("yi-magnifying-glass")]
62278
62309
  ]]
62279
62310
  ]);
62280
62311
  attach_clear($find_control, $find_input);
@@ -63243,9 +63274,9 @@ function ac_set_operation_mode(gobj, event, kw, src) {
63243
63274
  * card's graph icon travels — as EV_TOPIC_SELECTED, which the host turns
63244
63275
  * into the URL, so what you are looking at stays linkable.
63245
63276
  ************************************************************/
63246
- var LEGEND_GLYPH_STYLE = "font-size:1.5em; line-height:1; color:inherit;";
63247
- var LEGEND_NAME_STYLE = "font-size:1.2em; line-height:1.2;";
63248
- var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:1em;";
63277
+ var LEGEND_GLYPH_STYLE = `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;`;
63278
+ var LEGEND_NAME_STYLE = "font-size:1rem; line-height:1.2;";
63279
+ var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem;";
63249
63280
  function refresh_legend(gobj) {
63250
63281
  let priv = gobj.priv;
63251
63282
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
@@ -63418,7 +63449,7 @@ function refresh_legend(gobj) {
63418
63449
  "div",
63419
63450
  {
63420
63451
  class: "GRAPH_LEGEND_CHIP buttons has-addons",
63421
- style: "margin:0; flex:0 0 auto; flex-wrap:nowrap;"
63452
+ style: "margin:0; flex:0 0 auto; flex-wrap:nowrap; align-items:stretch;"
63422
63453
  },
63423
63454
  [$body].concat(extras.map((spec) => (0, _yuneta_gobj_js.createElement2)(spec)))
63424
63455
  ]);
@@ -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 [
@@ -10572,10 +10601,7 @@ function camera_button(gobj, icon, event_name, label_key, wide, extra_style) {
10572
10601
  "aria-label": t(label_key),
10573
10602
  "data-i18n-aria-label": label_key
10574
10603
  },
10575
- ["i", {
10576
- style: "font-size:1.5em; color:inherit;" + (extra_style || ""),
10577
- class: icon
10578
- }],
10604
+ yui_toolbar_icon(icon, extra_style),
10579
10605
  { click: (evt) => {
10580
10606
  evt.stopPropagation();
10581
10607
  gobj_send_event(gobj, event_name, { evt }, gobj);
@@ -11365,7 +11391,7 @@ var attrs_table$13 = [
11365
11391
  SDATA(data_type_t.DTP_JSON, "json_data", 0, null, "JSON data to visualize"),
11366
11392
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
11367
11393
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
11368
- 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"),
11369
11395
  SDATA(data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
11370
11396
  SDATA_END()
11371
11397
  ];
@@ -11668,7 +11694,7 @@ function make_toolbar$5(gobj) {
11668
11694
  [$find_input, [
11669
11695
  "span",
11670
11696
  { class: "icon is-left" },
11671
- [["i", { class: "yi-magnifying-glass" }]]
11697
+ [yui_toolbar_icon("yi-magnifying-glass")]
11672
11698
  ]]
11673
11699
  ]);
11674
11700
  attach_clear($find_control, $find_input);
@@ -11702,19 +11728,23 @@ function make_toolbar$5(gobj) {
11702
11728
  ];
11703
11729
  });
11704
11730
  let right_items = [createElement2([
11705
- "select",
11731
+ "div",
11706
11732
  {
11707
- class: "JSON_GRAPH_LAYOUT select",
11708
- style: {
11709
- height: toolbar_wide,
11710
- "margin-left": "0.5em"
11711
- },
11712
- title: t("layout"),
11713
- "data-i18n-title": "layout",
11714
- "aria-label": t("layout"),
11715
- "data-i18n-aria-label": "layout"
11733
+ class: "select",
11734
+ style: { "margin-left": "0.5em" }
11716
11735
  },
11717
- 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
+ ]],
11718
11748
  { change: (evt) => {
11719
11749
  evt.stopPropagation();
11720
11750
  gobj_send_event(gobj, "EV_CHANGE_LAYOUT", { layout: evt.target.value }, gobj);
@@ -13194,7 +13224,7 @@ function make_toolbar$4(gobj) {
13194
13224
  [$search_input, [
13195
13225
  "span",
13196
13226
  { class: "icon is-left" },
13197
- [["i", { class: "yi-magnifying-glass" }]]
13227
+ [yui_toolbar_icon("yi-magnifying-glass")]
13198
13228
  ]]
13199
13229
  ]);
13200
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"));
@@ -13244,7 +13274,7 @@ function icon_button$1(gobj, icon, event_name, label_key) {
13244
13274
  [[
13245
13275
  "span",
13246
13276
  { class: "icon" },
13247
- [["i", { class: icon }]]
13277
+ [yui_toolbar_icon(icon)]
13248
13278
  ]],
13249
13279
  { click: function(evt) {
13250
13280
  evt.stopPropagation();
@@ -13281,7 +13311,7 @@ function view_mode_switch$1(gobj) {
13281
13311
  [[
13282
13312
  "span",
13283
13313
  { class: "icon" },
13284
- [["i", { class: v.icon }]]
13314
+ [yui_toolbar_icon(v.icon)]
13285
13315
  ]],
13286
13316
  { click: function(evt) {
13287
13317
  evt.stopPropagation();
@@ -17457,7 +17487,7 @@ var attrs_table$9 = [
17457
17487
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
17458
17488
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container element"),
17459
17489
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
17460
- 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"),
17461
17491
  SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
17462
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."),
17463
17493
  SDATA_END()
@@ -18110,7 +18140,7 @@ function make_find_items(gobj) {
18110
18140
  [$find_input, [
18111
18141
  "span",
18112
18142
  { class: "icon is-left" },
18113
- [["i", { class: "yi-magnifying-glass" }]]
18143
+ [yui_toolbar_icon("yi-magnifying-glass")]
18114
18144
  ]]
18115
18145
  ]);
18116
18146
  attach_clear($find_control, $find_input);
@@ -18180,24 +18210,31 @@ function make_toolbar$1(gobj) {
18180
18210
  LAYOUTS[key].label
18181
18211
  ]);
18182
18212
  }
18183
- let $select = createElement2([
18184
- "select",
18213
+ let $wrap = createElement2([
18214
+ "div",
18185
18215
  {
18186
18216
  class: "select",
18187
- style: {
18188
- height: toolbar_wide,
18189
- "margin-left": "0.5em"
18190
- },
18191
- title: t("layout")
18217
+ style: { "margin-left": "0.5em" }
18192
18218
  },
18193
- 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
+ ]],
18194
18231
  { change: (evt) => {
18195
18232
  let value = evt.target.value;
18196
18233
  gobj_send_event(gobj, "EV_CHANGE_LAYOUT", { layout: value }, gobj);
18197
18234
  } }
18198
18235
  ]);
18199
- priv.$layout_select = $select;
18200
- right_items.push($select);
18236
+ priv.$layout_select = $wrap.querySelector("select");
18237
+ right_items.push($wrap);
18201
18238
  const $toolbar = yui_toolbar({}, [
18202
18239
  [
18203
18240
  "div",
@@ -21347,7 +21384,7 @@ function build_ui$6(gobj) {
21347
21384
  [[
21348
21385
  "span",
21349
21386
  { class: "icon" },
21350
- [["i", { class: "yi-arrow-left" }]]
21387
+ [yui_toolbar_icon("yi-arrow-left")]
21351
21388
  ], [
21352
21389
  "span",
21353
21390
  { i18n: "topics" },
@@ -21370,7 +21407,7 @@ function build_ui$6(gobj) {
21370
21407
  [[
21371
21408
  "span",
21372
21409
  { class: "icon" },
21373
- [["i", { class: "yi-hexagon-nodes" }]]
21410
+ [yui_toolbar_icon("yi-hexagon-nodes")]
21374
21411
  ], [
21375
21412
  "span",
21376
21413
  { i18n: "schema" },
@@ -21391,7 +21428,7 @@ function build_ui$6(gobj) {
21391
21428
  [[
21392
21429
  "span",
21393
21430
  { class: "icon" },
21394
- [["i", { class: "yi-cloudversify" }]]
21431
+ [yui_toolbar_icon("yi-cloudversify")]
21395
21432
  ], [
21396
21433
  "span",
21397
21434
  { class: "TREEDB_TOPICS_SOURCE_URL" },
@@ -21411,7 +21448,7 @@ function build_ui$6(gobj) {
21411
21448
  [[
21412
21449
  "span",
21413
21450
  { class: "icon" },
21414
- [["i", { class: "yi-eye" }]]
21451
+ [yui_toolbar_icon("yi-eye")]
21415
21452
  ], [
21416
21453
  "span",
21417
21454
  { i18n: "raw json" },
@@ -24031,7 +24068,7 @@ function build_ui$5(gobj) {
24031
24068
  id: ``,
24032
24069
  class: "button button-edit-record mr-1"
24033
24070
  },
24034
- [["i", { class: "yi-pen" }], [
24071
+ [yui_toolbar_icon("yi-pen"), [
24035
24072
  "span",
24036
24073
  {
24037
24074
  class: "is-hidden-mobile",
@@ -24054,7 +24091,7 @@ function build_ui$5(gobj) {
24054
24091
  class: "button button-new-record mr-1",
24055
24092
  disabled: true
24056
24093
  },
24057
- [["i", { class: "yi-plus" }], [
24094
+ [yui_toolbar_icon("yi-plus"), [
24058
24095
  "span",
24059
24096
  {
24060
24097
  class: "is-hidden-mobile",
@@ -24078,7 +24115,7 @@ function build_ui$5(gobj) {
24078
24115
  class: "button button-delete-record mr-1",
24079
24116
  disabled: true
24080
24117
  },
24081
- [["i", { class: "yi-trash" }], [
24118
+ [yui_toolbar_icon("yi-trash"), [
24082
24119
  "span",
24083
24120
  {
24084
24121
  class: "is-hidden-mobile",
@@ -24102,7 +24139,7 @@ function build_ui$5(gobj) {
24102
24139
  class: "button button-copy-record mr-1",
24103
24140
  disabled: true
24104
24141
  },
24105
- [["i", { class: "yi-copy" }], [
24142
+ [yui_toolbar_icon("yi-copy"), [
24106
24143
  "span",
24107
24144
  {
24108
24145
  class: "is-hidden-mobile",
@@ -24126,7 +24163,7 @@ function build_ui$5(gobj) {
24126
24163
  class: "button button-paste-record mr-1",
24127
24164
  disabled: true
24128
24165
  },
24129
- [["i", { class: "yi-paste" }], [
24166
+ [yui_toolbar_icon("yi-paste"), [
24130
24167
  "span",
24131
24168
  {
24132
24169
  class: "is-hidden-mobile",
@@ -24167,7 +24204,7 @@ function build_ui$5(gobj) {
24167
24204
  }], [
24168
24205
  "span",
24169
24206
  { class: "icon is-left" },
24170
- [["i", { class: "yi-magnifying-glass" }]]
24207
+ [yui_toolbar_icon("yi-magnifying-glass")]
24171
24208
  ]]
24172
24209
  ]);
24173
24210
  let $search_input = $search_box.querySelector(`#${search_id}`);
@@ -24185,7 +24222,7 @@ function build_ui$5(gobj) {
24185
24222
  title: t("refresh"),
24186
24223
  "data-i18n-title": "refresh"
24187
24224
  },
24188
- [["i", { class: "yi-arrows-rotate" }], [
24225
+ [yui_toolbar_icon("yi-arrows-rotate"), [
24189
24226
  "span",
24190
24227
  {
24191
24228
  class: "is-hidden-mobile",
@@ -24211,7 +24248,7 @@ function build_ui$5(gobj) {
24211
24248
  "aria-label": t("schema"),
24212
24249
  "data-i18n-aria-label": "schema"
24213
24250
  },
24214
- [["i", { class: "yi-hexagon-nodes" }], [
24251
+ [yui_toolbar_icon("yi-hexagon-nodes"), [
24215
24252
  "span",
24216
24253
  {
24217
24254
  class: "is-hidden-mobile",
@@ -24237,7 +24274,7 @@ function build_ui$5(gobj) {
24237
24274
  "aria-label": t("columns"),
24238
24275
  "data-i18n-aria-label": "columns"
24239
24276
  },
24240
- [["i", { class: "yi-table" }], [
24277
+ [yui_toolbar_icon("yi-table"), [
24241
24278
  "span",
24242
24279
  {
24243
24280
  class: "is-hidden-mobile",
@@ -24263,7 +24300,7 @@ function build_ui$5(gobj) {
24263
24300
  "aria-label": t("export"),
24264
24301
  "data-i18n-aria-label": "export"
24265
24302
  },
24266
- [["i", { class: "yi-download" }], [
24303
+ [yui_toolbar_icon("yi-download"), [
24267
24304
  "span",
24268
24305
  {
24269
24306
  class: "is-hidden-mobile",
@@ -62077,10 +62114,7 @@ function node_shape_items(gobj, wide) {
62077
62114
  "data-i18n-aria-label": key,
62078
62115
  "aria-pressed": "false"
62079
62116
  },
62080
- ["i", {
62081
- style: "font-size:1.5em; color:inherit;",
62082
- class: NODE_MODE_ICONS[mode]
62083
- }],
62117
+ yui_toolbar_icon(NODE_MODE_ICONS[mode]),
62084
62118
  { click: (evt) => {
62085
62119
  evt.stopPropagation();
62086
62120
  gobj_send_event(gobj, "EV_SET_NODE_MODE", { node_mode: mode }, gobj);
@@ -62102,10 +62136,7 @@ function node_shape_items(gobj, wide) {
62102
62136
  "data-i18n-aria-label": "node labels",
62103
62137
  "aria-pressed": "false"
62104
62138
  },
62105
- ["i", {
62106
- style: "font-size:1.5em; color:inherit;",
62107
- class: "yi-font"
62108
- }],
62139
+ yui_toolbar_icon("yi-font"),
62109
62140
  { click: (evt) => {
62110
62141
  evt.stopPropagation();
62111
62142
  gobj_send_event(gobj, "EV_TOGGLE_NODE_LABELS", {}, gobj);
@@ -62199,7 +62230,7 @@ function make_toolbar(gobj) {
62199
62230
  [
62200
62231
  "button",
62201
62232
  { class: "GRAPH_REFRESH button" },
62202
- [["i", { class: "yi-arrows-rotate" }], [
62233
+ [yui_toolbar_icon("yi-arrows-rotate"), [
62203
62234
  "span",
62204
62235
  {
62205
62236
  class: "is-hidden-mobile",
@@ -62224,7 +62255,7 @@ function make_toolbar(gobj) {
62224
62255
  "data-i18n-title": "raw json",
62225
62256
  "data-i18n-aria-label": "raw json"
62226
62257
  },
62227
- [["i", { class: "yi-eye" }], [
62258
+ [yui_toolbar_icon("yi-eye"), [
62228
62259
  "span",
62229
62260
  {
62230
62261
  class: "is-hidden-mobile",
@@ -62269,7 +62300,7 @@ function make_toolbar(gobj) {
62269
62300
  [$find_input, [
62270
62301
  "span",
62271
62302
  { class: "icon is-left" },
62272
- [["i", { class: "yi-magnifying-glass" }]]
62303
+ [yui_toolbar_icon("yi-magnifying-glass")]
62273
62304
  ]]
62274
62305
  ]);
62275
62306
  attach_clear($find_control, $find_input);
@@ -63238,9 +63269,9 @@ function ac_set_operation_mode(gobj, event, kw, src) {
63238
63269
  * card's graph icon travels — as EV_TOPIC_SELECTED, which the host turns
63239
63270
  * into the URL, so what you are looking at stays linkable.
63240
63271
  ************************************************************/
63241
- var LEGEND_GLYPH_STYLE = "font-size:1.5em; line-height:1; color:inherit;";
63242
- var LEGEND_NAME_STYLE = "font-size:1.2em; line-height:1.2;";
63243
- var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:1em;";
63272
+ var LEGEND_GLYPH_STYLE = `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;`;
63273
+ var LEGEND_NAME_STYLE = "font-size:1rem; line-height:1.2;";
63274
+ var LEGEND_COUNT_STYLE = "margin-left:.4rem; font-size:.875rem;";
63244
63275
  function refresh_legend(gobj) {
63245
63276
  let priv = gobj.priv;
63246
63277
  let $container = gobj_read_attr(gobj, "$container");
@@ -63413,7 +63444,7 @@ function refresh_legend(gobj) {
63413
63444
  "div",
63414
63445
  {
63415
63446
  class: "GRAPH_LEGEND_CHIP buttons has-addons",
63416
- style: "margin:0; flex:0 0 auto; flex-wrap:nowrap;"
63447
+ style: "margin:0; flex:0 0 auto; flex-wrap:nowrap; align-items:stretch;"
63417
63448
  },
63418
63449
  [$body].concat(extras.map((spec) => createElement2(spec)))
63419
63450
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.85",
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,
@@ -98,7 +98,7 @@ SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container eleme
98
98
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
99
99
 
100
100
  /*---------------- Graph Settings ----------------*/
101
- 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"),
102
102
  SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical-compact", "Current layout key"),
103
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."),
104
104
 
@@ -906,7 +906,7 @@ function make_find_items(gobj)
906
906
  style: 'margin-left:.5rem; margin-right:.5rem; ' +
907
907
  'max-width:12rem; min-width:7rem;'}, [
908
908
  $find_input,
909
- ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
909
+ ['span', {class: 'icon is-left'}, [yui_toolbar_icon('yi-magnifying-glass')]]
910
910
  ]]);
911
911
  attach_clear($find_control, $find_input);
912
912
 
@@ -1018,23 +1018,27 @@ function make_toolbar(gobj)
1018
1018
  options.push(['option', opt_attrs, LAYOUTS[key].label]);
1019
1019
  }
1020
1020
 
1021
- let $select = createElement2(
1022
- ['select', {
1023
- class: 'select',
1024
- style: {height: toolbar_wide, "margin-left": "0.5em"},
1025
- title: t("layout"),
1026
- },
1027
- options,
1028
- {
1029
- change: (evt) => {
1030
- let value = evt.target.value;
1031
- gobj_send_event(gobj, "EV_CHANGE_LAYOUT", {layout: value}, gobj);
1032
- }
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);
1033
1037
  }
1034
- ]
1038
+ }]
1035
1039
  );
1036
- priv.$layout_select = $select;
1037
- right_items.push($select);
1040
+ priv.$layout_select = $wrap.querySelector("select");
1041
+ right_items.push($wrap);
1038
1042
 
1039
1043
  const $toolbar = yui_toolbar({}, [
1040
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,
@@ -176,7 +176,7 @@ SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Container eleme
176
176
  SDATA(data_type_t.DTP_STRING, "canvas_id", 0, "", "Canvas ID"),
177
177
 
178
178
  /*---------------- Graph Settings ----------------*/
179
- 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"),
180
180
  SDATA(data_type_t.DTP_STRING, "layout", 0, "json-tree", "Layout key (see LAYOUTS)"),
181
181
 
182
182
  SDATA_END()
@@ -585,7 +585,7 @@ function make_toolbar(gobj)
585
585
  ['div', {class: 'JSON_GRAPH_FIND control has-icons-left',
586
586
  style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
587
587
  $find_input,
588
- ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
588
+ ['span', {class: 'icon is-left'}, [yui_toolbar_icon('yi-magnifying-glass')]]
589
589
  ]]);
590
590
  attach_clear($find_control, $find_input);
591
591
 
@@ -656,13 +656,20 @@ function make_toolbar(gobj)
656
656
  return ['option', attrs, layout_label(key)];
657
657
  });
658
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. */
659
664
  let $layout_select = createElement2(
660
- ['select', {
661
- class: 'JSON_GRAPH_LAYOUT select',
662
- style: {height: toolbar_wide, "margin-left": "0.5em"},
663
- title: t("layout"), 'data-i18n-title': "layout",
664
- 'aria-label': t("layout"), 'data-i18n-aria-label': "layout"
665
- }, 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
+ ], {
666
673
  change: (evt) => {
667
674
  evt.stopPropagation();
668
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,10 +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
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";
86
87
  import {
87
88
  removeChildElements,
88
89
  disableElements,
@@ -574,7 +575,7 @@ function node_shape_items(gobj, wide)
574
575
  title: t(key), 'data-i18n-title': key,
575
576
  'aria-label': t(key), 'data-i18n-aria-label': key,
576
577
  'aria-pressed': 'false'},
577
- ['i', {style: 'font-size:1.5em; color:inherit;', class: NODE_MODE_ICONS[mode]}],
578
+ yui_toolbar_icon(NODE_MODE_ICONS[mode]),
578
579
  {
579
580
  click: (evt) => {
580
581
  evt.stopPropagation();
@@ -591,7 +592,7 @@ function node_shape_items(gobj, wide)
591
592
  title: t('node labels'), 'data-i18n-title': 'node labels',
592
593
  'aria-label': t('node labels'), 'data-i18n-aria-label': 'node labels',
593
594
  'aria-pressed': 'false'},
594
- ['i', {style: 'font-size:1.5em; color:inherit;', class: 'yi-font'}],
595
+ yui_toolbar_icon('yi-font'),
595
596
  {
596
597
  click: (evt) => {
597
598
  evt.stopPropagation();
@@ -693,7 +694,7 @@ function make_toolbar(gobj)
693
694
  }],
694
695
 
695
696
  ['button', {class: 'GRAPH_REFRESH button'}, [
696
- ['i', {class: 'yi-arrows-rotate'}],
697
+ yui_toolbar_icon('yi-arrows-rotate'),
697
698
  ['span', {class: 'is-hidden-mobile', style: 'padding-left:5px;', i18n: 'refresh'}, 'refresh']
698
699
  ], {
699
700
  click: (evt) => {
@@ -718,7 +719,7 @@ function make_toolbar(gobj)
718
719
  ['button', {class: 'button ml-2 TREEDB_JSON_BTN',
719
720
  title: t('raw json'), 'aria-label': t('raw json'),
720
721
  'data-i18n-title': 'raw json', 'data-i18n-aria-label': 'raw json'}, [
721
- ['i', {class: 'yi-eye'}],
722
+ yui_toolbar_icon('yi-eye'),
722
723
  ['span', {class: 'is-hidden-mobile', style: 'padding-left:5px;', i18n: 'raw json'}, 'raw json']
723
724
  ], {
724
725
  click: (evt) => {
@@ -775,7 +776,7 @@ function make_toolbar(gobj)
775
776
  ['div', {class: 'GRAPH_FIND control has-icons-left',
776
777
  style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
777
778
  $find_input,
778
- ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
779
+ ['span', {class: 'icon is-left'}, [yui_toolbar_icon('yi-magnifying-glass')]]
779
780
  ]]);
780
781
  attach_clear($find_control, $find_input);
781
782
 
@@ -2453,19 +2454,20 @@ function ac_set_operation_mode(gobj, event, kw, src)
2453
2454
  * card's graph icon travels — as EV_TOPIC_SELECTED, which the host turns
2454
2455
  * into the URL, so what you are looking at stays linkable.
2455
2456
  ************************************************************/
2456
- /* The glyphs of a chip's small buttons: `is-small` sets a 0.75rem
2457
- * font and a star or a crosshair at that size is a speck. The BUTTON
2458
- * stays small so the strip keeps its height; the glyph inside grows. */
2459
- const LEGEND_GLYPH_STYLE = 'font-size:1.5em; line-height:1; color:inherit;';
2460
-
2461
- /* And the same for what a chip SAYS. The legend is a layer control --
2462
- * a gadget somebody uses, not a footnote somebody glances at -- and a
2463
- * topic name is the thing it is read for, so 0.75rem is the wrong
2464
- * size for it. The button stays `is-small` because the strip has to
2465
- * hold a chip per topic on one row; the name and the count come back
2466
- * up inside it, exactly as the glyphs did. */
2467
- const LEGEND_NAME_STYLE = 'font-size:1.2em; line-height:1.2;';
2468
- const LEGEND_COUNT_STYLE = 'margin-left:.4rem; font-size:1em;';
2457
+ /* The legend is the strip UNDER the toolbar, and the two are read as
2458
+ * one thing: what they say has to be the same size, or the lower one
2459
+ * reads as a footnote to the upper. `is-small` earns its place in the
2460
+ * PADDING -- a chip per topic has to fit on one row -- and nowhere
2461
+ * else, so the text and the glyphs are given back in `rem`, which is
2462
+ * measured against the page instead of against the 0.75rem the class
2463
+ * sets. In `em` they were 18px and 14.4px against the toolbar's 24px
2464
+ * and 16px: three sizes in two strips.
2465
+ *
2466
+ * The count is the one deliberate step down: it is the number beside
2467
+ * the name, not the name. */
2468
+ const LEGEND_GLYPH_STYLE = `font-size:${YUI_TOOLBAR_ICON_SIZE}; line-height:1; color:inherit;`;
2469
+ const LEGEND_NAME_STYLE = 'font-size:1rem; line-height:1.2;';
2470
+ const LEGEND_COUNT_STYLE = 'margin-left:.4rem; font-size:.875rem;';
2469
2471
 
2470
2472
  /* The focused chip is HIGHLIGHTED, not pressed. The body of a chip is
2471
2473
  * the show/hide toggle, and that is what its `aria-pressed` says;
@@ -2653,8 +2655,15 @@ function refresh_legend(gobj)
2653
2655
  }
2654
2656
 
2655
2657
  let $chip = createElement2(
2658
+ /* `align-items: stretch`: Bulma's `.buttons` centres its
2659
+ * children, so the star and the crosshair -- a glyph and
2660
+ * nothing else -- stood 20px tall beside a 30px chip body
2661
+ * that carries a swatch, a name and a count. In a
2662
+ * `has-addons` group that reads as three buttons of three
2663
+ * heights welded together. */
2656
2664
  ['div', {class: 'GRAPH_LEGEND_CHIP buttons has-addons',
2657
- style: 'margin:0; flex:0 0 auto; flex-wrap:nowrap;'},
2665
+ style: 'margin:0; flex:0 0 auto; flex-wrap:nowrap; ' +
2666
+ 'align-items:stretch;'},
2658
2667
  [$body].concat(extras.map((spec) => createElement2(spec)))]
2659
2668
  );
2660
2669
  $legend.appendChild($chip);
@@ -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,6 +40,9 @@ 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
48
  /************************************************************
@@ -51,8 +54,7 @@ function camera_button(gobj, icon, event_name, label_key, wide, extra_style)
51
54
  style: {height: wide, width: '2.5em'},
52
55
  title: t(label_key), 'data-i18n-title': label_key,
53
56
  'aria-label': t(label_key), 'data-i18n-aria-label': label_key},
54
- ['i', {style: 'font-size:1.5em; color:inherit;' + (extra_style || ''),
55
- class: icon}],
57
+ yui_toolbar_icon(icon, extra_style),
56
58
  {
57
59
  click: (evt) => {
58
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};