@yuneta/gobj-ui 7.23.164 → 7.23.166

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.
@@ -24551,10 +24551,16 @@ function ac_select_topic_card(gobj, event, kw, src) {
24551
24551
  * Falls back to an in-view flip only when no routes were supplied.
24552
24552
  ************************************************************/
24553
24553
  function ac_toggle_landing_view(gobj, event, kw, src) {
24554
- let target = gobj.priv._landing_view === "schema" ? "cards" : "schema";
24554
+ let priv = gobj.priv;
24555
+ let target = priv._landing_view === "schema" ? "cards" : "schema";
24555
24556
  let routes = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "landing_routes");
24556
24557
  let href = (0, _yuneta_gobj_js.is_object)(routes) ? routes[target] : null;
24557
24558
  if (href && typeof window !== "undefined") {
24559
+ if (window.location.hash === href) {
24560
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: landing view '${priv._landing_view}' on screen under the '${target}' url (${href}): following the url`);
24561
+ set_landing_view(gobj, target);
24562
+ return 0;
24563
+ }
24558
24564
  window.location.hash = href;
24559
24565
  return 0;
24560
24566
  }
@@ -24580,6 +24586,12 @@ function ac_set_landing_view(gobj, event, kw, src) {
24580
24586
  * Back from a topic to the cards-landing grid (the section index).
24581
24587
  ************************************************************/
24582
24588
  function ac_back_to_topics(gobj, event, kw, src) {
24589
+ let routes = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "landing_routes");
24590
+ let href = (0, _yuneta_gobj_js.is_object)(routes) ? routes[gobj.priv._landing_view] : null;
24591
+ if (href && typeof window !== "undefined") {
24592
+ window.location.hash = href;
24593
+ return 0;
24594
+ }
24583
24595
  show_topics_landing(gobj);
24584
24596
  (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TOPIC_SELECTED", { topic: "" });
24585
24597
  return 0;
@@ -24546,10 +24546,16 @@ function ac_select_topic_card(gobj, event, kw, src) {
24546
24546
  * Falls back to an in-view flip only when no routes were supplied.
24547
24547
  ************************************************************/
24548
24548
  function ac_toggle_landing_view(gobj, event, kw, src) {
24549
- let target = gobj.priv._landing_view === "schema" ? "cards" : "schema";
24549
+ let priv = gobj.priv;
24550
+ let target = priv._landing_view === "schema" ? "cards" : "schema";
24550
24551
  let routes = gobj_read_attr(gobj, "landing_routes");
24551
24552
  let href = is_object(routes) ? routes[target] : null;
24552
24553
  if (href && typeof window !== "undefined") {
24554
+ if (window.location.hash === href) {
24555
+ log_error(`${gobj_short_name(gobj)}: landing view '${priv._landing_view}' on screen under the '${target}' url (${href}): following the url`);
24556
+ set_landing_view(gobj, target);
24557
+ return 0;
24558
+ }
24553
24559
  window.location.hash = href;
24554
24560
  return 0;
24555
24561
  }
@@ -24575,6 +24581,12 @@ function ac_set_landing_view(gobj, event, kw, src) {
24575
24581
  * Back from a topic to the cards-landing grid (the section index).
24576
24582
  ************************************************************/
24577
24583
  function ac_back_to_topics(gobj, event, kw, src) {
24584
+ let routes = gobj_read_attr(gobj, "landing_routes");
24585
+ let href = is_object(routes) ? routes[gobj.priv._landing_view] : null;
24586
+ if (href && typeof window !== "undefined") {
24587
+ window.location.hash = href;
24588
+ return 0;
24589
+ }
24578
24590
  show_topics_landing(gobj);
24579
24591
  gobj_publish_event(gobj, "EV_TOPIC_SELECTED", { topic: "" });
24580
24592
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.164",
3
+ "version": "7.23.166",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -2185,6 +2185,17 @@ function ac_toggle_landing_view(gobj, event, kw, src)
2185
2185
  let routes = gobj_read_attr(gobj, "landing_routes");
2186
2186
  let href = is_object(routes) ? routes[target] : null;
2187
2187
  if(href && typeof window !== "undefined") {
2188
+ /* The url already says `target` while the screen shows the other
2189
+ * view: assigning the same hash fires no route change, so the
2190
+ * switch would never come and the button would do nothing. The
2191
+ * screen and the url disagreeing is a broken invariant -- said,
2192
+ * and then the screen follows the url. */
2193
+ if(window.location.hash === href) {
2194
+ log_error(`${gobj_short_name(gobj)}: landing view '${priv._landing_view}' ` +
2195
+ `on screen under the '${target}' url (${href}): following the url`);
2196
+ set_landing_view(gobj, target);
2197
+ return 0;
2198
+ }
2188
2199
  window.location.hash = href; /* push; route drives the switch */
2189
2200
  return 0;
2190
2201
  }
@@ -2217,9 +2228,25 @@ function ac_set_landing_view(gobj, event, kw, src)
2217
2228
  ************************************************************/
2218
2229
  function ac_back_to_topics(gobj, event, kw, src)
2219
2230
  {
2231
+ /* With host routes the landing is a POSITION, so Back GOES there, the
2232
+ * way the toggle does, and the route drives the switch.
2233
+ *
2234
+ * It used to paint the landing it remembered and tell the host "no
2235
+ * topic", which the host turns into the BARE route -- always the
2236
+ * cards. After a click on a node of the SCHEMA landing that left the
2237
+ * schema on screen under a cards url, and from then on the toggle
2238
+ * navigated to the url the page already had: no route change came and
2239
+ * the button did nothing. There was no way out of the schema. */
2240
+ let routes = gobj_read_attr(gobj, "landing_routes");
2241
+ let href = is_object(routes) ? routes[gobj.priv._landing_view] : null;
2242
+ if(href && typeof window !== "undefined") {
2243
+ window.location.hash = href; /* push; route drives the switch */
2244
+ return 0;
2245
+ }
2246
+
2247
+ /* Legacy: no routes. Paint it here, and tell the host the topic
2248
+ * segment is gone so a reload re-lands on the grid. */
2220
2249
  show_topics_landing(gobj);
2221
- /* Tell the host the topic segment is gone so a reload re-lands on the
2222
- * grid (empty topic ⇒ the host drops the <topic> from the URL). */
2223
2250
  gobj_publish_event(gobj, "EV_TOPIC_SELECTED", {topic: ""});
2224
2251
  return 0;
2225
2252
  }
@@ -98,7 +98,14 @@ export function yunetaHtmlPlugin(options = {}) {
98
98
  worker-src 'self' blob:;
99
99
  child-src 'self' blob:;
100
100
  img-src 'self' data: blob:;
101
+ media-src 'self' data: blob:;
101
102
  font-src 'self' data:;">`;
103
+ /* media-src: a treedb `file` column shows video and audio
104
+ * too (yui_asset.js). A picked file is previewed from a
105
+ * blob: url and a stored one arrives as a data: url when
106
+ * no web server signs one. Without the directive both fell
107
+ * back to default-src 'self' and the browser refused them,
108
+ * while the same bytes as an image or a PDF showed. */
102
109
  }
103
110
 
104
111
  /*------------------------------------------*