@yuneta/gobj-ui 7.32.10 → 7.32.12

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/index.js CHANGED
@@ -63,8 +63,26 @@ export {
63
63
  yui_shell_register_overlay,
64
64
  yui_shell_overlay_dismissed,
65
65
  yui_shell_unpark_route,
66
+ yui_shell_nav_mode,
67
+ yui_shell_set_nav_mode,
66
68
  } from "./src/c_yui_shell.js";
67
69
  export { register_c_yui_nav } from "./src/c_yui_nav.js";
70
+ /*
71
+ * Preferences: the page every app shows at /preferences (theme,
72
+ * language, navigation), whole or in parts.
73
+ */
74
+ export { register_c_yui_preferences } from "./src/c_yui_preferences.js";
75
+ export {
76
+ YUI_PREFERENCES_I18N_KEYS,
77
+ yui_preferences_setup,
78
+ yui_pref_header,
79
+ yui_pref_box,
80
+ yui_pref_field,
81
+ yui_pref_segment,
82
+ yui_pref_appearance_fields,
83
+ yui_pref_sections,
84
+ yui_pref_apply,
85
+ } from "./src/yui_preferences.js";
68
86
  /*
69
87
  * Site map: the whole navigation surface (toolbar + account menu +
70
88
  * nav + dynamic tabs + view-contributed sub-routes) as a clickable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.32.10",
3
+ "version": "7.32.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/gobj-ui.cjs.js",
package/src/c_yui_node.js CHANGED
@@ -144,6 +144,7 @@ import {
144
144
  yui_shell_navigate,
145
145
  yui_shell_set_sub_routes,
146
146
  yui_shell_translate,
147
+ yui_shell_nav_mode,
147
148
  } from "./c_yui_shell.js";
148
149
 
149
150
  import "./c_yui_node.css";
@@ -180,7 +181,7 @@ SDATA(data_type_t.DTP_JSON, "children", 0, null, "Declared child spec
180
181
 
181
182
  SDATA(data_type_t.DTP_STRING, "base_route", 0, "", "ROOT only: the declared route the whole tree hangs from"),
182
183
  SDATA(data_type_t.DTP_STRING, "tree_version", 0, "", "ROOT only: version of the tree CONTRACT (its paths are public urls)"),
183
- SDATA(data_type_t.DTP_STRING, "nav_mode", 0, "stack","ROOT only: how the way in is shown — stack|back|path"),
184
+ SDATA(data_type_t.DTP_STRING, "nav_mode", 0, "", "ROOT only: how the way in is shown — stack|back|path. Empty: the reader's choice for the app, the shell's navigation preference (yui_shell_nav_mode), followed when it changes"),
184
185
  SDATA(data_type_t.DTP_BOOLEAN, "remember_position", 0, false, "A nav item points at WHERE THE OPERATOR LEFT that child, not at its bare route: the tail last active under each child is remembered and appended. For a tree whose children are workspaces with a position inside them (a treedb and its open topic); off for one whose children are pages, where the item IS the destination"),
185
186
 
186
187
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTMLElement (shell view contract)"),
@@ -297,6 +298,9 @@ function mt_start(gobj)
297
298
  return -1;
298
299
  }
299
300
  gobj_subscribe_event(shell, "EV_ROUTE_CHANGED", {}, gobj);
301
+ /* The reader's navigation preference: followed while the tree has
302
+ * no `nav_mode` of its own (ac_nav_mode_changed). */
303
+ gobj_subscribe_event(shell, "EV_NAV_MODE_CHANGED", {}, gobj);
300
304
  publish_sub_routes(gobj);
301
305
  }
302
306
 
@@ -311,6 +315,7 @@ function mt_stop(gobj)
311
315
  let shell = yui_shell_of(gobj);
312
316
  if(shell) {
313
317
  gobj_unsubscribe_event(shell, "EV_ROUTE_CHANGED", {}, gobj);
318
+ gobj_unsubscribe_event(shell, "EV_NAV_MODE_CHANGED", {}, gobj);
314
319
  yui_shell_set_sub_routes(shell, gobj_read_attr(gobj, "base_route"), null);
315
320
  }
316
321
  }
@@ -420,7 +425,13 @@ function tree_root_of(gobj)
420
425
  ************************************************************/
421
426
  function nav_mode_of(gobj)
422
427
  {
423
- let mode = gobj_read_attr(tree_root_of(gobj), "nav_mode") || "stack";
428
+ let root = tree_root_of(gobj);
429
+ let mode = gobj_read_attr(root, "nav_mode");
430
+ if(!mode) {
431
+ /* No mode of its own: the reader's, for the whole app (7.32.11). */
432
+ let shell = yui_shell_of(root);
433
+ mode = shell ? yui_shell_nav_mode(shell) : "stack";
434
+ }
424
435
 
425
436
  if(!is_nav_mode(mode)) {
426
437
  log_error(
@@ -1624,7 +1635,8 @@ function ac_set_nav_mode(gobj, event, kw, src)
1624
1635
  let priv = gobj.priv;
1625
1636
  let mode = kw.nav_mode || "";
1626
1637
 
1627
- if(!is_nav_mode(mode)) {
1638
+ /* "" is no mode of its own: follow the reader's (yui_shell_nav_mode). */
1639
+ if(mode !== "" && !is_nav_mode(mode)) {
1628
1640
  log_error(
1629
1641
  `${GCLASS_NAME} '${node_path_str(gobj)}': unknown nav_mode ` +
1630
1642
  `'${mode}' — expected one of ${NAV_MODES.join("|")}`
@@ -1639,17 +1651,38 @@ function ac_set_nav_mode(gobj, event, kw, src)
1639
1651
  return -1;
1640
1652
  }
1641
1653
  gobj_write_attr(gobj, "nav_mode", mode);
1654
+ reapply_route(gobj);
1655
+ return 0;
1656
+ }
1657
+
1658
+ /************************************************************
1659
+ * The reader chose another way in for the whole app (the shell's
1660
+ * EV_NAV_MODE_CHANGED, from Preferences). A root with a
1661
+ * `nav_mode` of its own keeps it: the host pinned it.
1662
+ ************************************************************/
1663
+ function ac_nav_mode_changed(gobj, event, kw, src)
1664
+ {
1665
+ let priv = gobj.priv;
1666
+ if(!priv.is_root || gobj_read_attr(gobj, "nav_mode")) {
1667
+ return 0;
1668
+ }
1669
+ reapply_route(gobj);
1670
+ return 0;
1671
+ }
1642
1672
 
1643
- /* Same reason as EV_SET_CHROME_DEPTH: what changes is the shape
1644
- * of the ACTIVE PATH, whose strips are painted by the ancestors,
1645
- * so the tree is asked to re-apply the current route instead of
1646
- * repainting one node. */
1673
+ /************************************************************
1674
+ * Same reason as EV_SET_CHROME_DEPTH: what changes with the
1675
+ * mode is the shape of the ACTIVE PATH, whose strips are
1676
+ * painted by the ancestors, so the tree is asked to re-apply
1677
+ * the current route instead of repainting one node.
1678
+ ************************************************************/
1679
+ function reapply_route(gobj)
1680
+ {
1647
1681
  let shell = yui_shell_of(gobj);
1648
1682
  if(shell) {
1649
1683
  yui_shell_navigate(shell, gobj_read_attr(shell, "current_route") ||
1650
1684
  route_of(gobj), {replace: true});
1651
1685
  }
1652
- return 0;
1653
1686
  }
1654
1687
 
1655
1688
  /************************************************************
@@ -1746,7 +1779,8 @@ function yui_node_set_nav_mode(node, mode)
1746
1779
 
1747
1780
  function yui_node_nav_mode(node)
1748
1781
  {
1749
- return gobj_read_attr(tree_root_of(node), "nav_mode") || "stack";
1782
+ /* The mode the tree draws in: its own, else the reader's. */
1783
+ return nav_mode_of(node);
1750
1784
  }
1751
1785
 
1752
1786
  /************************************************************
@@ -1838,6 +1872,7 @@ function create_gclass(gclass_name)
1838
1872
  ["EV_SET_PROJECTION", ac_set_projection, null],
1839
1873
  ["EV_SET_CHROME_DEPTH", ac_set_chrome_depth, null],
1840
1874
  ["EV_SET_NAV_MODE", ac_set_nav_mode, null],
1875
+ ["EV_NAV_MODE_CHANGED", ac_nav_mode_changed, null],
1841
1876
  ["EV_SET_CONTENT", ac_set_content, null],
1842
1877
  ["EV_NODE_TREE_CHANGED", ac_tree_changed, null],
1843
1878
  ["EV_DESTROY_NAVS", ac_destroy_navs, null]
@@ -1854,6 +1889,7 @@ function create_gclass(gclass_name)
1854
1889
  ["EV_SET_PROJECTION", ac_set_projection, null],
1855
1890
  ["EV_SET_CHROME_DEPTH", ac_set_chrome_depth, null],
1856
1891
  ["EV_SET_NAV_MODE", ac_set_nav_mode, null],
1892
+ ["EV_NAV_MODE_CHANGED", ac_nav_mode_changed, null],
1857
1893
  ["EV_SET_CONTENT", ac_set_content, null],
1858
1894
  ["EV_NODE_TREE_CHANGED", ac_tree_changed, null],
1859
1895
  ["EV_DESTROY_NAVS", ac_destroy_navs, null]
@@ -1870,6 +1906,7 @@ function create_gclass(gclass_name)
1870
1906
  ["EV_SET_PROJECTION", ac_set_projection, null],
1871
1907
  ["EV_SET_CHROME_DEPTH", ac_set_chrome_depth, null],
1872
1908
  ["EV_SET_NAV_MODE", ac_set_nav_mode, null],
1909
+ ["EV_NAV_MODE_CHANGED", ac_nav_mode_changed, null],
1873
1910
  ["EV_SET_CONTENT", ac_set_content, null],
1874
1911
  ["EV_NODE_TREE_CHANGED", ac_tree_changed, null],
1875
1912
  ["EV_DESTROY_NAVS", ac_destroy_navs, null]
@@ -1891,6 +1928,7 @@ function create_gclass(gclass_name)
1891
1928
  ["EV_SET_PROJECTION", 0],
1892
1929
  ["EV_SET_CHROME_DEPTH", 0],
1893
1930
  ["EV_SET_NAV_MODE", 0],
1931
+ ["EV_NAV_MODE_CHANGED", 0],
1894
1932
  ["EV_SET_CONTENT", 0],
1895
1933
  ["EV_NODE_TREE_CHANGED", 0],
1896
1934
  /* internal: posted to itself, the navs a render left */
@@ -0,0 +1,295 @@
1
+ /***********************************************************************
2
+ * c_yui_preferences.js
3
+ * C_YUI_PREFERENCES GClass.
4
+ *
5
+ * The Preferences page of an app, whole: a view the shell
6
+ * mounts at /preferences (a route target of the app config).
7
+ *
8
+ * "/preferences": {"target": {"gclass": "C_YUI_PREFERENCES"}}
9
+ *
10
+ * It draws the three rows every app shows -- theme, language,
11
+ * navigation (yui_preferences.js) -- and then the boxes the
12
+ * app adds in its yui_preferences_setup(). A press applies at
13
+ * once and is kept in this browser; the page is drawn again
14
+ * to mark the new choice, and when the language or the theme
15
+ * changes from elsewhere (the toolbar), because which option
16
+ * is marked is markup. The theme has no event of the shell:
17
+ * the page watches data-theme (yui_watch_theme). Up to 7.32.11
18
+ * a theme chosen on the toolbar left the Theme row marking the
19
+ * old one until the page was drawn again.
20
+ *
21
+ * An app whose page has fields with actions of its own keeps
22
+ * its own view and draws the same rows with the parts of
23
+ * yui_preferences.js.
24
+ *
25
+ * Copyright (c) 2026, ArtGins.
26
+ * All Rights Reserved.
27
+ ***********************************************************************/
28
+ import {
29
+ SDATA,
30
+ SDATA_END,
31
+ data_type_t,
32
+ gclass_create,
33
+ log_error,
34
+ gobj_parent,
35
+ gobj_read_attr,
36
+ gobj_write_attr,
37
+ gobj_read_pointer_attr,
38
+ gobj_subscribe_event,
39
+ gobj_unsubscribe_event,
40
+ createElement2,
41
+ refresh_language,
42
+ } from "@yuneta/gobj-js";
43
+
44
+ import {t} from "i18next";
45
+
46
+ import {yui_shell_of} from "./c_yui_shell.js";
47
+ import {yui_watch_theme} from "./yui_theme.js";
48
+ import {
49
+ yui_pref_header,
50
+ yui_pref_box,
51
+ yui_pref_appearance_fields,
52
+ yui_pref_sections,
53
+ yui_pref_apply,
54
+ } from "./yui_preferences.js";
55
+
56
+ /***************************************************************
57
+ * Constants
58
+ ***************************************************************/
59
+ const GCLASS_NAME = "C_YUI_PREFERENCES";
60
+
61
+ /***************************************************************
62
+ * Data
63
+ ***************************************************************/
64
+ const attrs_table = [
65
+ SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
66
+ SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTMLElement (shell view contract)"),
67
+ SDATA_END()
68
+ ];
69
+
70
+ /*
71
+ * A field named like an attribute is written by the framework on every
72
+ * write of that attribute.
73
+ */
74
+ let PRIVATE_DATA = {
75
+ shell: null,
76
+ theme_watch: null, /* data-theme, as an EV_THEME */
77
+ };
78
+
79
+ let __gclass__ = null;
80
+
81
+
82
+
83
+
84
+ /******************************
85
+ * Framework Methods
86
+ ******************************/
87
+
88
+
89
+
90
+
91
+ /***************************************************************
92
+ * Framework Method: Create
93
+ ***************************************************************/
94
+ function mt_create(gobj)
95
+ {
96
+ let $container = createElement2(
97
+ ["div", {class: "C_YUI_PREFERENCES PREF_PAGE p-4"}, []]
98
+ );
99
+ gobj_write_attr(gobj, "$container", $container);
100
+
101
+ /*
102
+ * CHILD subscription model
103
+ */
104
+ let subscriber = gobj_read_pointer_attr(gobj, "subscriber");
105
+ if(!subscriber) {
106
+ subscriber = gobj_parent(gobj);
107
+ }
108
+ gobj_subscribe_event(gobj, null, {}, subscriber);
109
+ }
110
+
111
+ /***************************************************************
112
+ * Framework Method: Start
113
+ ***************************************************************/
114
+ function mt_start(gobj)
115
+ {
116
+ let priv = gobj.priv;
117
+
118
+ /* The language can change from the toolbar while the page is
119
+ * open: which option is marked is markup, drawn again. */
120
+ priv.shell = yui_shell_of(gobj);
121
+ if(priv.shell) {
122
+ gobj_subscribe_event(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
123
+ }
124
+ priv.theme_watch = yui_watch_theme(gobj);
125
+ render(gobj);
126
+ }
127
+
128
+ /***************************************************************
129
+ * Framework Method: Stop
130
+ ***************************************************************/
131
+ function mt_stop(gobj)
132
+ {
133
+ let priv = gobj.priv;
134
+
135
+ if(priv.shell) {
136
+ gobj_unsubscribe_event(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
137
+ priv.shell = null;
138
+ }
139
+ if(priv.theme_watch) {
140
+ priv.theme_watch.disconnect();
141
+ priv.theme_watch = null;
142
+ }
143
+ }
144
+
145
+ /***************************************************************
146
+ * Framework Method: Destroy
147
+ ***************************************************************/
148
+ function mt_destroy(gobj)
149
+ {
150
+ let $container = gobj_read_attr(gobj, "$container");
151
+ if($container && $container.parentNode) {
152
+ $container.parentNode.removeChild($container);
153
+ }
154
+ gobj_write_attr(gobj, "$container", null);
155
+ }
156
+
157
+
158
+
159
+
160
+ /***************************
161
+ * Local Methods
162
+ ***************************/
163
+
164
+
165
+
166
+
167
+ /***************************************************************
168
+ * Draw the page: the header, the box of the three rows, the
169
+ * boxes of the app.
170
+ ***************************************************************/
171
+ function render(gobj)
172
+ {
173
+ let $container = gobj_read_attr(gobj, "$container");
174
+ if(!$container) {
175
+ return;
176
+ }
177
+ $container.replaceChildren();
178
+ $container.appendChild(createElement2(yui_pref_header()));
179
+ $container.appendChild(createElement2(
180
+ yui_pref_box(yui_pref_appearance_fields(gobj), "PREF_APPEARANCE")
181
+ ));
182
+ for(let box of yui_pref_sections(gobj)) {
183
+ $container.appendChild((box && box.nodeType) ? box : createElement2(box));
184
+ }
185
+ refresh_language($container, t);
186
+ }
187
+
188
+
189
+
190
+
191
+ /***************************
192
+ * Actions
193
+ ***************************/
194
+
195
+
196
+
197
+
198
+ /***************************************************************
199
+ * EV_SET_THEME / EV_SET_LANGUAGE / EV_SET_NAV_MODE {value}:
200
+ * a press on one of the three rows.
201
+ ***************************************************************/
202
+ function ac_set_preference(gobj, event, kw, src)
203
+ {
204
+ let ret = yui_pref_apply(gobj, event, kw);
205
+ render(gobj);
206
+ return ret;
207
+ }
208
+
209
+ /***************************************************************
210
+ * The language (EV_LANGUAGE_CHANGED) or the theme (EV_THEME)
211
+ * changed somewhere else: the toolbar.
212
+ ***************************************************************/
213
+ function ac_changed_elsewhere(gobj, event, kw, src)
214
+ {
215
+ render(gobj);
216
+ return 0;
217
+ }
218
+
219
+ /***************************************************************
220
+ * FSM
221
+ ***************************************************************/
222
+ /*---------------------------------------------*
223
+ * Global methods table
224
+ *---------------------------------------------*/
225
+ const gmt = {
226
+ mt_create: mt_create,
227
+ mt_start: mt_start,
228
+ mt_stop: mt_stop,
229
+ mt_destroy: mt_destroy
230
+ };
231
+
232
+ /***************************************************************
233
+ * Create the GClass
234
+ ***************************************************************/
235
+ function create_gclass(gclass_name)
236
+ {
237
+ if(__gclass__) {
238
+ log_error(`GClass ALREADY created: ${gclass_name}`);
239
+ return -1;
240
+ }
241
+
242
+ /*---------------------------------------------*
243
+ * States
244
+ *---------------------------------------------*/
245
+ const states = [
246
+ ["ST_IDLE", [
247
+ ["EV_SET_THEME", ac_set_preference, null],
248
+ ["EV_SET_LANGUAGE", ac_set_preference, null],
249
+ ["EV_SET_NAV_MODE", ac_set_preference, null],
250
+ ["EV_LANGUAGE_CHANGED", ac_changed_elsewhere, null],
251
+ ["EV_THEME", ac_changed_elsewhere, null]
252
+ ]]
253
+ ];
254
+
255
+ /*---------------------------------------------*
256
+ * Events
257
+ *---------------------------------------------*/
258
+ const event_types = [
259
+ ["EV_SET_THEME", 0],
260
+ ["EV_SET_LANGUAGE", 0],
261
+ ["EV_SET_NAV_MODE", 0],
262
+ ["EV_LANGUAGE_CHANGED", 0],
263
+ ["EV_THEME", 0]
264
+ ];
265
+
266
+ __gclass__ = gclass_create(
267
+ gclass_name,
268
+ event_types,
269
+ states,
270
+ gmt,
271
+ 0, // lmt,
272
+ attrs_table,
273
+ PRIVATE_DATA,
274
+ 0, // authz_table,
275
+ 0, // command_table,
276
+ 0, // s_user_trace_level
277
+ 0 // gclass_flag
278
+ );
279
+
280
+ if(!__gclass__) {
281
+ return -1;
282
+ }
283
+
284
+ return 0;
285
+ }
286
+
287
+ /***************************************************************
288
+ * Register GClass
289
+ ***************************************************************/
290
+ function register_c_yui_preferences()
291
+ {
292
+ return create_gclass(GCLASS_NAME);
293
+ }
294
+
295
+ export { register_c_yui_preferences };
@@ -49,8 +49,12 @@ import {
49
49
  gobj_short_name,
50
50
  gobj_is_destroying,
51
51
  gobj_post_event,
52
+ kw_get_local_storage_value,
53
+ kw_set_local_storage_value,
52
54
  } from "@yuneta/gobj-js";
53
55
 
56
+ import {NAV_MODES, is_nav_mode} from "./node_tree_model.js";
57
+
54
58
  import {
55
59
  BULMA_BP_ORDER,
56
60
  breakpoints_from_expr,
@@ -4359,7 +4363,7 @@ function yui_shell_set_submenu(shell_gobj, parent_item_id, items)
4359
4363
  * EV_ICONS_CHANGED). So they reach only the subscribers that
4360
4364
  * declare them. Every other event of the shell goes out as before.
4361
4365
  ***************************************************************/
4362
- const OPTIONAL_EVENTS = new Set(["EV_CONNECTION_STATE", "EV_ICONS_CHANGED"]);
4366
+ const OPTIONAL_EVENTS = new Set(["EV_CONNECTION_STATE", "EV_ICONS_CHANGED", "EV_NAV_MODE_CHANGED"]);
4363
4367
 
4364
4368
  function mt_publication_pre_filter(gobj, subs, event, kw)
4365
4369
  {
@@ -4446,6 +4450,15 @@ function create_gclass(gclass_name)
4446
4450
  * icon cell of a table -- has to decide again. Delivered only to
4447
4451
  * the subscribers that declare it: see
4448
4452
  * mt_publication_pre_filter(). */
4453
+ /* The reader chose another way in for the trees of nodes
4454
+ * (yui_shell_set_nav_mode, the Navigation row of Preferences).
4455
+ * Every C_YUI_NODE root that has no mode of its own follows it.
4456
+ * Delivered only to the subscribers that declare it: see
4457
+ * mt_publication_pre_filter(). */
4458
+ ["EV_NAV_MODE_CHANGED", event_flag_t.EVF_OUTPUT_EVENT
4459
+ |event_flag_t.EVF_PUBLIC_EVENT
4460
+ |event_flag_t.EVF_NO_WARN_SUBS],
4461
+
4449
4462
  ["EV_ICONS_CHANGED", event_flag_t.EVF_OUTPUT_EVENT
4450
4463
  |event_flag_t.EVF_PUBLIC_EVENT
4451
4464
  |event_flag_t.EVF_NO_WARN_SUBS],
@@ -5159,6 +5172,47 @@ function yui_shell_language_changed(shell_gobj)
5159
5172
  gobj_publish_event(shell_gobj, "EV_LANGUAGE_CHANGED", {});
5160
5173
  }
5161
5174
 
5175
+ /************************************************************
5176
+ * How the trees of nodes show the way in: the reader's choice
5177
+ * for the whole app, one of NAV_MODES (C_YUI_NODE):
5178
+ *
5179
+ * "stack" a strip of tabs per level, stacked (the default)
5180
+ * "back" one "back to parent" link
5181
+ * "path" a breadcrumb
5182
+ *
5183
+ * Kept in this browser (localStorage), like the theme and the
5184
+ * language. Every C_YUI_NODE root that has no `nav_mode` of its
5185
+ * own reads it, and follows a change: yui_shell_set_nav_mode()
5186
+ * publishes EV_NAV_MODE_CHANGED. Up to gobj-ui 7.32.10 each app
5187
+ * kept its own (gui_agent one for the app, yunovatios one per
5188
+ * tree) and handed it to its trees.
5189
+ ************************************************************/
5190
+ const NAV_MODE_KEY = "yui_nav_mode";
5191
+
5192
+ function yui_shell_nav_mode(shell_gobj)
5193
+ {
5194
+ let mode = kw_get_local_storage_value(NAV_MODE_KEY, NAV_MODES[0], false);
5195
+ return is_nav_mode(mode) ? mode : NAV_MODES[0];
5196
+ }
5197
+
5198
+ function yui_shell_set_nav_mode(shell_gobj, mode)
5199
+ {
5200
+ if(!shell_gobj || !is_gobj(shell_gobj)) {
5201
+ log_error(`yui_shell_set_nav_mode(): no shell`);
5202
+ return -1;
5203
+ }
5204
+ if(!is_nav_mode(mode)) {
5205
+ log_error(`yui_shell_set_nav_mode(): unknown nav_mode '${mode}' — ` +
5206
+ `expected one of ${NAV_MODES.join("|")}`);
5207
+ return -1;
5208
+ }
5209
+ if(kw_set_local_storage_value(NAV_MODE_KEY, mode) < 0) {
5210
+ return -1; // Error already logged
5211
+ }
5212
+ gobj_publish_event(shell_gobj, "EV_NAV_MODE_CHANGED", {nav_mode: mode});
5213
+ return 0;
5214
+ }
5215
+
5162
5216
  /************************************************************
5163
5217
  * The user icons changed (lib_icons.js: yui_icons_set_user,
5164
5218
  * yui_icons_put_user, yui_icons_remove_user): PUBLISH it, so
@@ -5415,6 +5469,8 @@ export {
5415
5469
  yui_shell_set_translator,
5416
5470
  yui_shell_translate,
5417
5471
  yui_shell_language_changed,
5472
+ yui_shell_nav_mode,
5473
+ yui_shell_set_nav_mode,
5418
5474
  yui_shell_icons_changed,
5419
5475
  yui_shell_set_connection_state,
5420
5476
  yui_shell_set_toolbar_item_icon,
@@ -313,4 +313,10 @@ export const I18N_KEY_FUNCTIONS = Object.freeze([
313
313
  {module: "c_yui_shell.js", name: "announce_badge", exported: false, keys: ["1"]},
314
314
  /* shell_route_map.js -- a node of the route map */
315
315
  {module: "shell_route_map.js", name: "render_node", exported: false, keys: ["0.label"]},
316
+ /* yui_preferences.js -- the parts of a Preferences page an app
317
+ * uses for its own fields: the label of a field, the options of a
318
+ * segment (an option with a `text` and no `key` is data: a
319
+ * language named in its own words) */
320
+ {module: "yui_preferences.js", name: "yui_pref_field", exported: true, keys: ["0"]},
321
+ {module: "yui_preferences.js", name: "yui_pref_segment", exported: true, keys: ["2[].key"]},
316
322
  ]);