@yuneta/gobj-ui 6.2.0 → 6.2.1
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/package.json +1 -1
- package/src/c_yui_node.js +26 -6
package/package.json
CHANGED
package/src/c_yui_node.js
CHANGED
|
@@ -632,6 +632,27 @@ function clear_navs(gobj)
|
|
|
632
632
|
* "index" — I am the tip: the projection is the page.
|
|
633
633
|
* "chrome" — a child is showing: the projection is its chrome.
|
|
634
634
|
************************************************************/
|
|
635
|
+
/************************************************************
|
|
636
|
+
* WHERE A CHILD'S NAV ITEM POINTS.
|
|
637
|
+
*
|
|
638
|
+
* One function, because two things read it and they must not
|
|
639
|
+
* disagree: the item's own href, and the `active_route` the nav
|
|
640
|
+
* is told to highlight — C_YUI_NAV matches by EXACT route, so an
|
|
641
|
+
* item pointing at a remembered position while the active route
|
|
642
|
+
* stayed canonical is an item that is never marked active.
|
|
643
|
+
************************************************************/
|
|
644
|
+
function child_nav_route(gobj, id)
|
|
645
|
+
{
|
|
646
|
+
let my_route = route_of(gobj);
|
|
647
|
+
let base = my_route === "/" ? "" : my_route;
|
|
648
|
+
let route = `${base}/${id}`;
|
|
649
|
+
|
|
650
|
+
if(!gobj_read_bool_attr(gobj, "remember_position")) {
|
|
651
|
+
return route;
|
|
652
|
+
}
|
|
653
|
+
return nav_route_with_tail(route, gobj.priv.remembered[id]);
|
|
654
|
+
}
|
|
655
|
+
|
|
635
656
|
function render_projection(gobj, mode, $where, active_route, active_id, zones_only)
|
|
636
657
|
{
|
|
637
658
|
let priv = gobj.priv;
|
|
@@ -662,11 +683,7 @@ function render_projection(gobj, mode, $where, active_route, active_id, zones_on
|
|
|
662
683
|
* contract either way: what the item carries is a real position,
|
|
663
684
|
* so clicking it is a navigation and not a restore that would then
|
|
664
685
|
* have to argue with the url. */
|
|
665
|
-
let
|
|
666
|
-
let items = child_nav_items(specs, (id) => {
|
|
667
|
-
let route = `${base}/${id}`;
|
|
668
|
-
return remember ? nav_route_with_tail(route, priv.remembered[id]) : route;
|
|
669
|
-
});
|
|
686
|
+
let items = child_nav_items(specs, (id) => child_nav_route(gobj, id));
|
|
670
687
|
|
|
671
688
|
let i = 0;
|
|
672
689
|
for(let render of renders) {
|
|
@@ -892,7 +909,10 @@ function render_child(gobj, child)
|
|
|
892
909
|
* level. `chrome_depth` is how a node caps that for its corner
|
|
893
910
|
* of the tree (see resolve_chrome_depth). */
|
|
894
911
|
if(chrome_visible(priv.distance, priv.chrome_depth)) {
|
|
895
|
-
|
|
912
|
+
/* The SAME route the item carries, or the nav has nothing to
|
|
913
|
+
* match: it highlights by exact route. */
|
|
914
|
+
render_projection(gobj, "chrome", priv.$chrome,
|
|
915
|
+
child_nav_route(gobj, gobj_read_attr(child, "node_id")),
|
|
896
916
|
gobj_read_attr(child, "node_id"));
|
|
897
917
|
}
|
|
898
918
|
render_path(gobj, priv.$chrome);
|