@yuneta/gobj-ui 7.32.11 → 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/README.md CHANGED
@@ -413,6 +413,17 @@ navigation needs nothing from the app: every `C_YUI_NODE` tree with no mode
413
413
  of its own follows it, and an app with no tree keeps the choice for the day
414
414
  it has one.
415
415
 
416
+ The page marks a choice made somewhere else too: a language changed on the
417
+ toolbar (`EV_LANGUAGE_CHANGED` of the shell) and a theme changed on the
418
+ toolbar (7.32.12+). The shell has no event for the theme, so the page
419
+ watches `data-theme` with `yui_watch_theme()`, which sends it `EV_THEME`. An
420
+ app that draws the rows in its own view does the same:
421
+
422
+ ```js
423
+ priv.theme_watch = yui_watch_theme(gobj); // mt_start; disconnect() in mt_stop
424
+ // FSM: ["EV_THEME", ac_redraw, null]
425
+ ```
426
+
416
427
  An app whose page has fields with actions of its own (a font size, a buffer)
417
428
  keeps its own view and draws the same rows with the parts:
418
429
  `yui_pref_header()`, `yui_pref_box(fields)`, `yui_pref_field(label_key,
@@ -7058,7 +7058,7 @@ function ac_shell_changed$1(gobj, event, kw, src) {
7058
7058
  * language the window was opened in (a reader took the
7059
7059
  * aria-labelledby, which changed; the tooltip did not).
7060
7060
  ************************************************************/
7061
- function ac_language_changed$14(gobj, event, kw, src) {
7061
+ function ac_language_changed$13(gobj, event, kw, src) {
7062
7062
  let priv = gobj.priv;
7063
7063
  for (let entry of priv.windows) {
7064
7064
  if (!entry.title_prefix || !entry.$chip) continue;
@@ -7129,7 +7129,7 @@ function create_gclass$22(gclass_name) {
7129
7129
  ],
7130
7130
  [
7131
7131
  "EV_LANGUAGE_CHANGED",
7132
- ac_language_changed$14,
7132
+ ac_language_changed$13,
7133
7133
  null
7134
7134
  ]
7135
7135
  ]]], gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, 0);
@@ -7698,7 +7698,7 @@ function ac_shell_changed(gobj, event, kw, src) {
7698
7698
  * the shell's container, where the app's refresh does not
7699
7699
  * reach.
7700
7700
  ************************************************************/
7701
- function ac_language_changed$13(gobj, event, kw, src) {
7701
+ function ac_language_changed$12(gobj, event, kw, src) {
7702
7702
  let priv = gobj.priv;
7703
7703
  if (priv.$bar) (0, _yuneta_gobj_js.refresh_language)(priv.$bar, i18next.t);
7704
7704
  return 0;
@@ -7748,7 +7748,7 @@ function create_gclass$21(gclass_name) {
7748
7748
  ],
7749
7749
  [
7750
7750
  "EV_LANGUAGE_CHANGED",
7751
- ac_language_changed$13,
7751
+ ac_language_changed$12,
7752
7752
  null
7753
7753
  ]
7754
7754
  ]], ["ST_STALE", [
@@ -7794,7 +7794,7 @@ function create_gclass$21(gclass_name) {
7794
7794
  ],
7795
7795
  [
7796
7796
  "EV_LANGUAGE_CHANGED",
7797
- ac_language_changed$13,
7797
+ ac_language_changed$12,
7798
7798
  null
7799
7799
  ]
7800
7800
  ]]];
@@ -14902,7 +14902,7 @@ function ac_name_json_editors(gobj, event, kw, src) {
14902
14902
  * in the old language until it draws it again, so each is told to
14903
14903
  * (a new onRenderMenu), and the render names it again.
14904
14904
  ************************************************************/
14905
- function ac_language_changed$12(gobj, event, kw, src) {
14905
+ function ac_language_changed$11(gobj, event, kw, src) {
14906
14906
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
14907
14907
  if (!$container) return 0;
14908
14908
  for (let $editor of $container.querySelectorAll(".jsoneditor")) {
@@ -15091,7 +15091,7 @@ function create_gclass$18(gclass_name) {
15091
15091
  ],
15092
15092
  [
15093
15093
  "EV_LANGUAGE_CHANGED",
15094
- ac_language_changed$12,
15094
+ ac_language_changed$11,
15095
15095
  null
15096
15096
  ]
15097
15097
  ]]];
@@ -15485,7 +15485,7 @@ function mt_create$17(gobj) {
15485
15485
  * rewritten in place, and the map's locale with them so a
15486
15486
  * control or a popup built later is right too.
15487
15487
  ***************************************************************/
15488
- function ac_language_changed$11(gobj, event, kw, src) {
15488
+ function ac_language_changed$10(gobj, event, kw, src) {
15489
15489
  let priv = gobj.priv;
15490
15490
  if (priv.xmap) yui_maplibre_relocalize(priv.xmap, i18next.t);
15491
15491
  return 0;
@@ -16053,7 +16053,7 @@ function create_gclass$17(gclass_name) {
16053
16053
  ], [["ST_IDLE", [
16054
16054
  [
16055
16055
  "EV_LANGUAGE_CHANGED",
16056
- ac_language_changed$11,
16056
+ ac_language_changed$10,
16057
16057
  null
16058
16058
  ],
16059
16059
  [
@@ -16591,7 +16591,7 @@ function ac_theme$4(gobj, event, kw, src) {
16591
16591
  * reading of the legend ask for it when they are written,
16592
16592
  * so they are written again.
16593
16593
  ******************************************************/
16594
- function ac_language_changed$10(gobj, event, kw, src) {
16594
+ function ac_language_changed$9(gobj, event, kw, src) {
16595
16595
  let uplot = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "uplot");
16596
16596
  if (!uplot) return 0;
16597
16597
  try {
@@ -16680,7 +16680,7 @@ function create_gclass$16(gclass_name) {
16680
16680
  ],
16681
16681
  [
16682
16682
  "EV_LANGUAGE_CHANGED",
16683
- ac_language_changed$10,
16683
+ ac_language_changed$9,
16684
16684
  null
16685
16685
  ]
16686
16686
  ]]], gmt$16, 0, attrs_table$16, PRIVATE_DATA$16, 0, 0, 0, 0);
@@ -47785,7 +47785,7 @@ function ac_json_item_clicked(gobj, event, kw, src) {
47785
47785
  * and loading the graph again would throw away the reader's
47786
47786
  * camera for nothing.
47787
47787
  ************************************************************/
47788
- function ac_language_changed$9(gobj, event, kw, src) {
47788
+ function ac_language_changed$8(gobj, event, kw, src) {
47789
47789
  let priv = gobj.priv;
47790
47790
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
47791
47791
  if ($container) {
@@ -47846,7 +47846,7 @@ function create_gclass$14(gclass_name) {
47846
47846
  ],
47847
47847
  [
47848
47848
  "EV_LANGUAGE_CHANGED",
47849
- ac_language_changed$9,
47849
+ ac_language_changed$8,
47850
47850
  null
47851
47851
  ],
47852
47852
  [
@@ -47932,7 +47932,7 @@ function create_gclass$14(gclass_name) {
47932
47932
  ],
47933
47933
  [
47934
47934
  "EV_LANGUAGE_CHANGED",
47935
- ac_language_changed$9,
47935
+ ac_language_changed$8,
47936
47936
  null
47937
47937
  ],
47938
47938
  [
@@ -50168,7 +50168,7 @@ function ac_theme_changed(gobj, event, kw, src) {
50168
50168
  * inside an innerHTML string, where refresh_language()
50169
50169
  * cannot reach.
50170
50170
  ************************************************************/
50171
- function ac_language_changed$8(gobj, event, kw, src) {
50171
+ function ac_language_changed$7(gobj, event, kw, src) {
50172
50172
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
50173
50173
  if ($container) (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
50174
50174
  load_fsm(gobj);
@@ -50275,7 +50275,7 @@ function create_gclass$12(gclass_name) {
50275
50275
  ],
50276
50276
  [
50277
50277
  "EV_LANGUAGE_CHANGED",
50278
- ac_language_changed$8,
50278
+ ac_language_changed$7,
50279
50279
  null
50280
50280
  ],
50281
50281
  [
@@ -52186,7 +52186,7 @@ function refresh_zone(gobj, zone_id) {
52186
52186
  * is. Re-rendering is the only way both end up in the same
52187
52187
  * language.
52188
52188
  ************************************************************/
52189
- function ac_language_changed$7(gobj, event, kw, src) {
52189
+ function ac_language_changed$6(gobj, event, kw, src) {
52190
52190
  let priv = gobj.priv;
52191
52191
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
52192
52192
  if ($container) {
@@ -52268,7 +52268,7 @@ function create_gclass$11(gclass_name) {
52268
52268
  ],
52269
52269
  [
52270
52270
  "EV_LANGUAGE_CHANGED",
52271
- ac_language_changed$7,
52271
+ ac_language_changed$6,
52272
52272
  null
52273
52273
  ],
52274
52274
  [
@@ -55644,7 +55644,7 @@ function ac_open_yuno_traces(gobj, event, kw, src) {
55644
55644
  * A rebuild, not a re-translation: the words live inside the
55645
55645
  * innerHTML of G6 nodes, where refresh_language() cannot go.
55646
55646
  ************************************************************/
55647
- function ac_language_changed$6(gobj, event, kw, src) {
55647
+ function ac_language_changed$5(gobj, event, kw, src) {
55648
55648
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
55649
55649
  if ($container) (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
55650
55650
  hide_popover(gobj);
@@ -55767,7 +55767,7 @@ function create_gclass$10(gclass_name) {
55767
55767
  ],
55768
55768
  [
55769
55769
  "EV_LANGUAGE_CHANGED",
55770
- ac_language_changed$6,
55770
+ ac_language_changed$5,
55771
55771
  null
55772
55772
  ],
55773
55773
  [
@@ -57517,9 +57517,12 @@ function yui_pref_apply(gobj, event, kw) {
57517
57517
  * navigation (yui_preferences.js) -- and then the boxes the
57518
57518
  * app adds in its yui_preferences_setup(). A press applies at
57519
57519
  * once and is kept in this browser; the page is drawn again
57520
- * to mark the new choice, and when the language changes from
57521
- * elsewhere (the toolbar), because which option is marked is
57522
- * markup.
57520
+ * to mark the new choice, and when the language or the theme
57521
+ * changes from elsewhere (the toolbar), because which option
57522
+ * is marked is markup. The theme has no event of the shell:
57523
+ * the page watches data-theme (yui_watch_theme). Up to 7.32.11
57524
+ * a theme chosen on the toolbar left the Theme row marking the
57525
+ * old one until the page was drawn again.
57523
57526
  *
57524
57527
  * An app whose page has fields with actions of its own keeps
57525
57528
  * its own view and draws the same rows with the parts of
@@ -57540,7 +57543,10 @@ var attrs_table$7 = [
57540
57543
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Root HTMLElement (shell view contract)"),
57541
57544
  (0, _yuneta_gobj_js.SDATA_END)()
57542
57545
  ];
57543
- var PRIVATE_DATA$7 = { shell: null };
57546
+ var PRIVATE_DATA$7 = {
57547
+ shell: null,
57548
+ theme_watch: null
57549
+ };
57544
57550
  var __gclass__$7 = null;
57545
57551
  /******************************
57546
57552
  * Framework Methods
@@ -57566,6 +57572,7 @@ function mt_start$7(gobj) {
57566
57572
  let priv = gobj.priv;
57567
57573
  priv.shell = yui_shell_of(gobj);
57568
57574
  if (priv.shell) (0, _yuneta_gobj_js.gobj_subscribe_event)(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
57575
+ priv.theme_watch = yui_watch_theme(gobj);
57569
57576
  render$1(gobj);
57570
57577
  }
57571
57578
  /***************************************************************
@@ -57577,6 +57584,10 @@ function mt_stop$7(gobj) {
57577
57584
  (0, _yuneta_gobj_js.gobj_unsubscribe_event)(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
57578
57585
  priv.shell = null;
57579
57586
  }
57587
+ if (priv.theme_watch) {
57588
+ priv.theme_watch.disconnect();
57589
+ priv.theme_watch = null;
57590
+ }
57580
57591
  }
57581
57592
  /***************************************************************
57582
57593
  * Framework Method: Destroy
@@ -57615,9 +57626,10 @@ function ac_set_preference(gobj, event, kw, src) {
57615
57626
  return ret;
57616
57627
  }
57617
57628
  /***************************************************************
57618
- * The language changed somewhere else (the toolbar).
57629
+ * The language (EV_LANGUAGE_CHANGED) or the theme (EV_THEME)
57630
+ * changed somewhere else: the toolbar.
57619
57631
  ***************************************************************/
57620
- function ac_language_changed$5(gobj, event, kw, src) {
57632
+ function ac_changed_elsewhere(gobj, event, kw, src) {
57621
57633
  render$1(gobj);
57622
57634
  return 0;
57623
57635
  }
@@ -57642,7 +57654,8 @@ function create_gclass$7(gclass_name) {
57642
57654
  ["EV_SET_THEME", 0],
57643
57655
  ["EV_SET_LANGUAGE", 0],
57644
57656
  ["EV_SET_NAV_MODE", 0],
57645
- ["EV_LANGUAGE_CHANGED", 0]
57657
+ ["EV_LANGUAGE_CHANGED", 0],
57658
+ ["EV_THEME", 0]
57646
57659
  ], [["ST_IDLE", [
57647
57660
  [
57648
57661
  "EV_SET_THEME",
@@ -57661,7 +57674,12 @@ function create_gclass$7(gclass_name) {
57661
57674
  ],
57662
57675
  [
57663
57676
  "EV_LANGUAGE_CHANGED",
57664
- ac_language_changed$5,
57677
+ ac_changed_elsewhere,
57678
+ null
57679
+ ],
57680
+ [
57681
+ "EV_THEME",
57682
+ ac_changed_elsewhere,
57665
57683
  null
57666
57684
  ]
57667
57685
  ]]], gmt$7, 0, attrs_table$7, PRIVATE_DATA$7, 0, 0, 0, 0);
@@ -7053,7 +7053,7 @@ function ac_shell_changed$1(gobj, event, kw, src) {
7053
7053
  * language the window was opened in (a reader took the
7054
7054
  * aria-labelledby, which changed; the tooltip did not).
7055
7055
  ************************************************************/
7056
- function ac_language_changed$14(gobj, event, kw, src) {
7056
+ function ac_language_changed$13(gobj, event, kw, src) {
7057
7057
  let priv = gobj.priv;
7058
7058
  for (let entry of priv.windows) {
7059
7059
  if (!entry.title_prefix || !entry.$chip) continue;
@@ -7124,7 +7124,7 @@ function create_gclass$22(gclass_name) {
7124
7124
  ],
7125
7125
  [
7126
7126
  "EV_LANGUAGE_CHANGED",
7127
- ac_language_changed$14,
7127
+ ac_language_changed$13,
7128
7128
  null
7129
7129
  ]
7130
7130
  ]]], gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, 0);
@@ -7693,7 +7693,7 @@ function ac_shell_changed(gobj, event, kw, src) {
7693
7693
  * the shell's container, where the app's refresh does not
7694
7694
  * reach.
7695
7695
  ************************************************************/
7696
- function ac_language_changed$13(gobj, event, kw, src) {
7696
+ function ac_language_changed$12(gobj, event, kw, src) {
7697
7697
  let priv = gobj.priv;
7698
7698
  if (priv.$bar) refresh_language(priv.$bar, t);
7699
7699
  return 0;
@@ -7743,7 +7743,7 @@ function create_gclass$21(gclass_name) {
7743
7743
  ],
7744
7744
  [
7745
7745
  "EV_LANGUAGE_CHANGED",
7746
- ac_language_changed$13,
7746
+ ac_language_changed$12,
7747
7747
  null
7748
7748
  ]
7749
7749
  ]], ["ST_STALE", [
@@ -7789,7 +7789,7 @@ function create_gclass$21(gclass_name) {
7789
7789
  ],
7790
7790
  [
7791
7791
  "EV_LANGUAGE_CHANGED",
7792
- ac_language_changed$13,
7792
+ ac_language_changed$12,
7793
7793
  null
7794
7794
  ]
7795
7795
  ]]];
@@ -14897,7 +14897,7 @@ function ac_name_json_editors(gobj, event, kw, src) {
14897
14897
  * in the old language until it draws it again, so each is told to
14898
14898
  * (a new onRenderMenu), and the render names it again.
14899
14899
  ************************************************************/
14900
- function ac_language_changed$12(gobj, event, kw, src) {
14900
+ function ac_language_changed$11(gobj, event, kw, src) {
14901
14901
  let $container = gobj_read_attr(gobj, "$container");
14902
14902
  if (!$container) return 0;
14903
14903
  for (let $editor of $container.querySelectorAll(".jsoneditor")) {
@@ -15086,7 +15086,7 @@ function create_gclass$18(gclass_name) {
15086
15086
  ],
15087
15087
  [
15088
15088
  "EV_LANGUAGE_CHANGED",
15089
- ac_language_changed$12,
15089
+ ac_language_changed$11,
15090
15090
  null
15091
15091
  ]
15092
15092
  ]]];
@@ -15480,7 +15480,7 @@ function mt_create$17(gobj) {
15480
15480
  * rewritten in place, and the map's locale with them so a
15481
15481
  * control or a popup built later is right too.
15482
15482
  ***************************************************************/
15483
- function ac_language_changed$11(gobj, event, kw, src) {
15483
+ function ac_language_changed$10(gobj, event, kw, src) {
15484
15484
  let priv = gobj.priv;
15485
15485
  if (priv.xmap) yui_maplibre_relocalize(priv.xmap, t);
15486
15486
  return 0;
@@ -16048,7 +16048,7 @@ function create_gclass$17(gclass_name) {
16048
16048
  ], [["ST_IDLE", [
16049
16049
  [
16050
16050
  "EV_LANGUAGE_CHANGED",
16051
- ac_language_changed$11,
16051
+ ac_language_changed$10,
16052
16052
  null
16053
16053
  ],
16054
16054
  [
@@ -16586,7 +16586,7 @@ function ac_theme$4(gobj, event, kw, src) {
16586
16586
  * reading of the legend ask for it when they are written,
16587
16587
  * so they are written again.
16588
16588
  ******************************************************/
16589
- function ac_language_changed$10(gobj, event, kw, src) {
16589
+ function ac_language_changed$9(gobj, event, kw, src) {
16590
16590
  let uplot = gobj_read_attr(gobj, "uplot");
16591
16591
  if (!uplot) return 0;
16592
16592
  try {
@@ -16675,7 +16675,7 @@ function create_gclass$16(gclass_name) {
16675
16675
  ],
16676
16676
  [
16677
16677
  "EV_LANGUAGE_CHANGED",
16678
- ac_language_changed$10,
16678
+ ac_language_changed$9,
16679
16679
  null
16680
16680
  ]
16681
16681
  ]]], gmt$16, 0, attrs_table$16, PRIVATE_DATA$16, 0, 0, 0, 0);
@@ -47780,7 +47780,7 @@ function ac_json_item_clicked(gobj, event, kw, src) {
47780
47780
  * and loading the graph again would throw away the reader's
47781
47781
  * camera for nothing.
47782
47782
  ************************************************************/
47783
- function ac_language_changed$9(gobj, event, kw, src) {
47783
+ function ac_language_changed$8(gobj, event, kw, src) {
47784
47784
  let priv = gobj.priv;
47785
47785
  let $container = gobj_read_attr(gobj, "$container");
47786
47786
  if ($container) {
@@ -47841,7 +47841,7 @@ function create_gclass$14(gclass_name) {
47841
47841
  ],
47842
47842
  [
47843
47843
  "EV_LANGUAGE_CHANGED",
47844
- ac_language_changed$9,
47844
+ ac_language_changed$8,
47845
47845
  null
47846
47846
  ],
47847
47847
  [
@@ -47927,7 +47927,7 @@ function create_gclass$14(gclass_name) {
47927
47927
  ],
47928
47928
  [
47929
47929
  "EV_LANGUAGE_CHANGED",
47930
- ac_language_changed$9,
47930
+ ac_language_changed$8,
47931
47931
  null
47932
47932
  ],
47933
47933
  [
@@ -50163,7 +50163,7 @@ function ac_theme_changed(gobj, event, kw, src) {
50163
50163
  * inside an innerHTML string, where refresh_language()
50164
50164
  * cannot reach.
50165
50165
  ************************************************************/
50166
- function ac_language_changed$8(gobj, event, kw, src) {
50166
+ function ac_language_changed$7(gobj, event, kw, src) {
50167
50167
  let $container = gobj_read_attr(gobj, "$container");
50168
50168
  if ($container) refresh_language($container, t);
50169
50169
  load_fsm(gobj);
@@ -50270,7 +50270,7 @@ function create_gclass$12(gclass_name) {
50270
50270
  ],
50271
50271
  [
50272
50272
  "EV_LANGUAGE_CHANGED",
50273
- ac_language_changed$8,
50273
+ ac_language_changed$7,
50274
50274
  null
50275
50275
  ],
50276
50276
  [
@@ -52181,7 +52181,7 @@ function refresh_zone(gobj, zone_id) {
52181
52181
  * is. Re-rendering is the only way both end up in the same
52182
52182
  * language.
52183
52183
  ************************************************************/
52184
- function ac_language_changed$7(gobj, event, kw, src) {
52184
+ function ac_language_changed$6(gobj, event, kw, src) {
52185
52185
  let priv = gobj.priv;
52186
52186
  let $container = gobj_read_attr(gobj, "$container");
52187
52187
  if ($container) {
@@ -52263,7 +52263,7 @@ function create_gclass$11(gclass_name) {
52263
52263
  ],
52264
52264
  [
52265
52265
  "EV_LANGUAGE_CHANGED",
52266
- ac_language_changed$7,
52266
+ ac_language_changed$6,
52267
52267
  null
52268
52268
  ],
52269
52269
  [
@@ -55639,7 +55639,7 @@ function ac_open_yuno_traces(gobj, event, kw, src) {
55639
55639
  * A rebuild, not a re-translation: the words live inside the
55640
55640
  * innerHTML of G6 nodes, where refresh_language() cannot go.
55641
55641
  ************************************************************/
55642
- function ac_language_changed$6(gobj, event, kw, src) {
55642
+ function ac_language_changed$5(gobj, event, kw, src) {
55643
55643
  let $container = gobj_read_attr(gobj, "$container");
55644
55644
  if ($container) refresh_language($container, t);
55645
55645
  hide_popover(gobj);
@@ -55762,7 +55762,7 @@ function create_gclass$10(gclass_name) {
55762
55762
  ],
55763
55763
  [
55764
55764
  "EV_LANGUAGE_CHANGED",
55765
- ac_language_changed$6,
55765
+ ac_language_changed$5,
55766
55766
  null
55767
55767
  ],
55768
55768
  [
@@ -57512,9 +57512,12 @@ function yui_pref_apply(gobj, event, kw) {
57512
57512
  * navigation (yui_preferences.js) -- and then the boxes the
57513
57513
  * app adds in its yui_preferences_setup(). A press applies at
57514
57514
  * once and is kept in this browser; the page is drawn again
57515
- * to mark the new choice, and when the language changes from
57516
- * elsewhere (the toolbar), because which option is marked is
57517
- * markup.
57515
+ * to mark the new choice, and when the language or the theme
57516
+ * changes from elsewhere (the toolbar), because which option
57517
+ * is marked is markup. The theme has no event of the shell:
57518
+ * the page watches data-theme (yui_watch_theme). Up to 7.32.11
57519
+ * a theme chosen on the toolbar left the Theme row marking the
57520
+ * old one until the page was drawn again.
57518
57521
  *
57519
57522
  * An app whose page has fields with actions of its own keeps
57520
57523
  * its own view and draws the same rows with the parts of
@@ -57535,7 +57538,10 @@ var attrs_table$7 = [
57535
57538
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTMLElement (shell view contract)"),
57536
57539
  SDATA_END()
57537
57540
  ];
57538
- var PRIVATE_DATA$7 = { shell: null };
57541
+ var PRIVATE_DATA$7 = {
57542
+ shell: null,
57543
+ theme_watch: null
57544
+ };
57539
57545
  var __gclass__$7 = null;
57540
57546
  /******************************
57541
57547
  * Framework Methods
@@ -57561,6 +57567,7 @@ function mt_start$7(gobj) {
57561
57567
  let priv = gobj.priv;
57562
57568
  priv.shell = yui_shell_of(gobj);
57563
57569
  if (priv.shell) gobj_subscribe_event(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
57570
+ priv.theme_watch = yui_watch_theme(gobj);
57564
57571
  render$1(gobj);
57565
57572
  }
57566
57573
  /***************************************************************
@@ -57572,6 +57579,10 @@ function mt_stop$7(gobj) {
57572
57579
  gobj_unsubscribe_event(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
57573
57580
  priv.shell = null;
57574
57581
  }
57582
+ if (priv.theme_watch) {
57583
+ priv.theme_watch.disconnect();
57584
+ priv.theme_watch = null;
57585
+ }
57575
57586
  }
57576
57587
  /***************************************************************
57577
57588
  * Framework Method: Destroy
@@ -57610,9 +57621,10 @@ function ac_set_preference(gobj, event, kw, src) {
57610
57621
  return ret;
57611
57622
  }
57612
57623
  /***************************************************************
57613
- * The language changed somewhere else (the toolbar).
57624
+ * The language (EV_LANGUAGE_CHANGED) or the theme (EV_THEME)
57625
+ * changed somewhere else: the toolbar.
57614
57626
  ***************************************************************/
57615
- function ac_language_changed$5(gobj, event, kw, src) {
57627
+ function ac_changed_elsewhere(gobj, event, kw, src) {
57616
57628
  render$1(gobj);
57617
57629
  return 0;
57618
57630
  }
@@ -57637,7 +57649,8 @@ function create_gclass$7(gclass_name) {
57637
57649
  ["EV_SET_THEME", 0],
57638
57650
  ["EV_SET_LANGUAGE", 0],
57639
57651
  ["EV_SET_NAV_MODE", 0],
57640
- ["EV_LANGUAGE_CHANGED", 0]
57652
+ ["EV_LANGUAGE_CHANGED", 0],
57653
+ ["EV_THEME", 0]
57641
57654
  ], [["ST_IDLE", [
57642
57655
  [
57643
57656
  "EV_SET_THEME",
@@ -57656,7 +57669,12 @@ function create_gclass$7(gclass_name) {
57656
57669
  ],
57657
57670
  [
57658
57671
  "EV_LANGUAGE_CHANGED",
57659
- ac_language_changed$5,
57672
+ ac_changed_elsewhere,
57673
+ null
57674
+ ],
57675
+ [
57676
+ "EV_THEME",
57677
+ ac_changed_elsewhere,
57660
57678
  null
57661
57679
  ]
57662
57680
  ]]], gmt$7, 0, attrs_table$7, PRIVATE_DATA$7, 0, 0, 0, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.32.11",
3
+ "version": "7.32.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/gobj-ui.cjs.js",
@@ -11,9 +11,12 @@
11
11
  * navigation (yui_preferences.js) -- and then the boxes the
12
12
  * app adds in its yui_preferences_setup(). A press applies at
13
13
  * once and is kept in this browser; the page is drawn again
14
- * to mark the new choice, and when the language changes from
15
- * elsewhere (the toolbar), because which option is marked is
16
- * markup.
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.
17
20
  *
18
21
  * An app whose page has fields with actions of its own keeps
19
22
  * its own view and draws the same rows with the parts of
@@ -41,6 +44,7 @@ import {
41
44
  import {t} from "i18next";
42
45
 
43
46
  import {yui_shell_of} from "./c_yui_shell.js";
47
+ import {yui_watch_theme} from "./yui_theme.js";
44
48
  import {
45
49
  yui_pref_header,
46
50
  yui_pref_box,
@@ -69,6 +73,7 @@ SDATA_END()
69
73
  */
70
74
  let PRIVATE_DATA = {
71
75
  shell: null,
76
+ theme_watch: null, /* data-theme, as an EV_THEME */
72
77
  };
73
78
 
74
79
  let __gclass__ = null;
@@ -116,6 +121,7 @@ function mt_start(gobj)
116
121
  if(priv.shell) {
117
122
  gobj_subscribe_event(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
118
123
  }
124
+ priv.theme_watch = yui_watch_theme(gobj);
119
125
  render(gobj);
120
126
  }
121
127
 
@@ -130,6 +136,10 @@ function mt_stop(gobj)
130
136
  gobj_unsubscribe_event(priv.shell, "EV_LANGUAGE_CHANGED", {}, gobj);
131
137
  priv.shell = null;
132
138
  }
139
+ if(priv.theme_watch) {
140
+ priv.theme_watch.disconnect();
141
+ priv.theme_watch = null;
142
+ }
133
143
  }
134
144
 
135
145
  /***************************************************************
@@ -197,9 +207,10 @@ function ac_set_preference(gobj, event, kw, src)
197
207
  }
198
208
 
199
209
  /***************************************************************
200
- * The language changed somewhere else (the toolbar).
210
+ * The language (EV_LANGUAGE_CHANGED) or the theme (EV_THEME)
211
+ * changed somewhere else: the toolbar.
201
212
  ***************************************************************/
202
- function ac_language_changed(gobj, event, kw, src)
213
+ function ac_changed_elsewhere(gobj, event, kw, src)
203
214
  {
204
215
  render(gobj);
205
216
  return 0;
@@ -236,7 +247,8 @@ function create_gclass(gclass_name)
236
247
  ["EV_SET_THEME", ac_set_preference, null],
237
248
  ["EV_SET_LANGUAGE", ac_set_preference, null],
238
249
  ["EV_SET_NAV_MODE", ac_set_preference, null],
239
- ["EV_LANGUAGE_CHANGED", ac_language_changed, null]
250
+ ["EV_LANGUAGE_CHANGED", ac_changed_elsewhere, null],
251
+ ["EV_THEME", ac_changed_elsewhere, null]
240
252
  ]]
241
253
  ];
242
254
 
@@ -247,7 +259,8 @@ function create_gclass(gclass_name)
247
259
  ["EV_SET_THEME", 0],
248
260
  ["EV_SET_LANGUAGE", 0],
249
261
  ["EV_SET_NAV_MODE", 0],
250
- ["EV_LANGUAGE_CHANGED", 0]
262
+ ["EV_LANGUAGE_CHANGED", 0],
263
+ ["EV_THEME", 0]
251
264
  ];
252
265
 
253
266
  __gclass__ = gclass_create(
@@ -8,6 +8,8 @@
8
8
  * current choice;
9
9
  * - a press applies through what the app registered
10
10
  * (yui_preferences_setup), and the page marks the new choice;
11
+ * - a theme changed elsewhere (EV_THEME, from yui_watch_theme) is
12
+ * marked too;
11
13
  * - the navigation is the shell's (yui_shell_nav_mode): a
12
14
  * C_YUI_NODE tree with no mode of its own follows it, one with
13
15
  * its own keeps it;
@@ -129,6 +131,18 @@ test("a press applies through the app and the page marks it", () => {
129
131
  expect(errors()).toEqual([]);
130
132
  });
131
133
 
134
+ test("a theme chosen elsewhere (the toolbar) is marked: EV_THEME draws the page again", () => {
135
+ const {page, $c} = new_page();
136
+ expect(marked($c, "PREF_THEME")).toBe("light theme");
137
+ /* The toolbar wrote data-theme; yui_watch_theme() sends EV_THEME. */
138
+ state.theme = "dark";
139
+ gobj_send_event(page, "EV_THEME", {theme: "dark"}, page);
140
+ expect(marked($c, "PREF_THEME")).toBe("dark theme");
141
+ expect(applied).toEqual([]);
142
+ state.theme = "light";
143
+ expect(errors()).toEqual([]);
144
+ });
145
+
132
146
  test("the navigation is the shell's, and a tree with no mode of its own follows it", () => {
133
147
  const {shell, page, $c} = new_page();
134
148
  const follows = gobj_create_pure_child(`pref_tree_a_${seq}`, "C_YUI_NODE", {