@hgdc/ui 0.59.0 → 0.60.0

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/dist/app-shell.js CHANGED
@@ -16,7 +16,7 @@ import { AssistantButton, AssistantPanel, ASSISTANT_SIDE_BY_SIDE, useAssistantSh
16
16
  import { ShellContext } from "./shell-context.js";
17
17
  import { familyProductName } from "./shell-frame.js";
18
18
  import { OtherViewLink, ShellCommonLinks } from "./shell-links.js";
19
- import { rememberShellNavHeight } from "./shell-memory.js";
19
+ import { rememberLastProduct, rememberShellNavHeight } from "./shell-memory.js";
20
20
  import { ProductRailShownContext, ShellLeaveContext, StatusPageContext } from "./shell-placement.js";
21
21
  import { SidebarHead } from "./sidebar-head.js";
22
22
  import { useToggleShortcut } from "./sidebar-rail.js";
@@ -73,6 +73,7 @@ export function AppShell({ product, organization, productRail: productRailOption
73
73
  // barre latérale à la prochaine arrivée sur ce produit.
74
74
  useIsomorphicLayoutEffect(() => {
75
75
  document.documentElement.dataset.hgdcProduct = product;
76
+ rememberLastProduct(product);
76
77
  }, [product]);
77
78
  const navHeight = useRef(0);
78
79
  useEffect(() => {
@@ -2,6 +2,8 @@
2
2
  export declare const SHELL_ORG_KEY = "hgdc-shell:org";
3
3
  /** Hauteur en pixels de la navigation d'un produit : `hgdc-shell:nav:<produit>`. */
4
4
  export declare const SHELL_NAV_KEY_PREFIX = "hgdc-shell:nav:";
5
+ /** Dernier produit ouvert (son mot), en `localStorage` : l'accueil d'`app.hgdc.ch` y renvoie. */
6
+ export declare const SHELL_LAST_PRODUCT_KEY = "hgdc-shell:last";
5
7
  /** Passage d'un produit à l'autre (horodatage), en `sessionStorage`. */
6
8
  export declare const SHELL_SWITCH_KEY = "hgdc-shell:switch";
7
9
  /** Au-delà, un passage noté n'est plus celui qu'on vit (onglet laissé, retour bien plus tard). */
@@ -63,6 +65,8 @@ export declare function rememberShellOrganization(org: {
63
65
  export declare function forgetShellOrganization(): void;
64
66
  /** Retient la hauteur de la navigation d'un produit (`AppShell` le fait après l'affichage). */
65
67
  export declare function rememberShellNavHeight(product: string, height: number): void;
68
+ /** Retient le produit affiché (`AppShell` le fait), pour que l'accueil d'`app.hgdc.ch` y renvoie. */
69
+ export declare function rememberLastProduct(product: string): void;
66
70
  /** Note le départ vers un autre produit (clic dans la barre des produits). */
67
71
  export declare function markProductSwitch(now?: number): void;
68
72
  /** Lit et efface la note : vrai si la page vient d'un passage depuis la barre, il y a peu. */
@@ -18,6 +18,8 @@ import { PRODUCT_ORIGINS } from "./products.js";
18
18
  export const SHELL_ORG_KEY = "hgdc-shell:org";
19
19
  /** Hauteur en pixels de la navigation d'un produit : `hgdc-shell:nav:<produit>`. */
20
20
  export const SHELL_NAV_KEY_PREFIX = "hgdc-shell:nav:";
21
+ /** Dernier produit ouvert (son mot), en `localStorage` : l'accueil d'`app.hgdc.ch` y renvoie. */
22
+ export const SHELL_LAST_PRODUCT_KEY = "hgdc-shell:last";
21
23
  /** Passage d'un produit à l'autre (horodatage), en `sessionStorage`. */
22
24
  export const SHELL_SWITCH_KEY = "hgdc-shell:switch";
23
25
  /** Au-delà, un passage noté n'est plus celui qu'on vit (onglet laissé, retour bien plus tard). */
@@ -162,6 +164,12 @@ export function rememberShellNavHeight(product, height) {
162
164
  return;
163
165
  storageSet("localStorage", SHELL_NAV_KEY_PREFIX + product, String(Math.round(height)));
164
166
  }
167
+ /** Retient le produit affiché (`AppShell` le fait), pour que l'accueil d'`app.hgdc.ch` y renvoie. */
168
+ export function rememberLastProduct(product) {
169
+ if (!browser())
170
+ return;
171
+ storageSet("localStorage", SHELL_LAST_PRODUCT_KEY, product);
172
+ }
165
173
  /** Note le départ vers un autre produit (clic dans la barre des produits). */
166
174
  export function markProductSwitch(now = Date.now()) {
167
175
  if (!browser())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hgdc/ui",
3
- "version": "0.59.0",
3
+ "version": "0.60.0",
4
4
  "description": "Interface de la H Collection : jetons de la DA, thèmes, polices et composants.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/hugogebel-boop/hgdc-kit/tree/main/packages/ui#readme",