@molecule/app-ui-react 1.3.3 → 1.3.5

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
@@ -3,20 +3,20 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-16T00:37:43.433Z
6
+ Generated: 2026-10-18T20:39:38.844Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-ui-react
10
10
 
11
- > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
- > It is written to be read by coding agents as much as by people, and is generated from this
13
- > package's source — edit `src/index.ts` JSDoc, not this file.
14
-
15
11
  React UI components for molecule.dev.
16
12
 
17
13
  Provides React implementations of the `@molecule/app-ui` component
18
14
  interfaces using the UIClassMap abstraction from `@molecule/app-ui`.
19
15
 
16
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
17
+ > It is written to be read by coding agents as much as by people, and is generated from this
18
+ > package's source — edit `src/index.ts` JSDoc, not this file.
19
+
20
20
  ## Quick Start
21
21
 
22
22
  ```tsx
@@ -1328,10 +1328,10 @@ forking the component.
1328
1328
  ```typescript
1329
1329
  interface AuthGuardProps {
1330
1330
  /**
1331
- * Element rendered while `useAuth().state.initialized` is `false`.
1332
- * Overrides the default `<div data-mol-id="auth-guard-loading">…</div>`
1333
- * loading tag — pass a full-page spinner or any other UI you want
1334
- * during the auth bootstrap window.
1331
+ * Element rendered while `useAuth().status` is `'loading'` — no session
1332
+ * decision yet. Overrides the default
1333
+ * `<div data-mol-id="auth-guard-loading">…</div>` loading tag — pass a
1334
+ * full-page spinner or any other UI you want during the auth bootstrap window.
1335
1335
  */
1336
1336
  loadingFallback?: ReactNode
1337
1337
  /**
@@ -2142,12 +2142,18 @@ type ShellSidebarWidth = 'sm' | 'md' | 'lg' | number
2142
2142
 
2143
2143
  Route-element guard for authenticated sections of a React Router tree.
2144
2144
 
2145
- - While `useAuth().state.initialized` is `false`, renders the
2145
+ - While `useAuth().status` is `'loading'` (no session decision yet), renders the
2146
2146
  `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
2147
2147
  - If the user is not authenticated, redirects to `loginPath` carrying
2148
2148
  the attempted location in `state.from` for post-login restoration.
2149
2149
  - Otherwise renders `children` (or `<Outlet />` if none).
2150
2150
 
2151
+ The guard reads `status`, not `initialized`: a stored token AND user make the
2152
+ FIRST render `'authenticated'`, so a protected page paints immediately instead
2153
+ of waiting for the background verification (`validateSession()`) or a
2154
+ current-user round trip. `'unavailable'` (a stored session the server could not
2155
+ confirm) counts as signed in — the page renders and the API decides.
2156
+
2151
2157
  The default loading tag carries `data-mol-id="auth-guard-loading"`
2152
2158
  so AI agents and e2e tests can target it reliably. When the caller
2153
2159
  passes a custom `loadingFallback`, it's the caller's responsibility
@@ -9,10 +9,10 @@ import { type ReactNode } from 'react';
9
9
  */
10
10
  export interface AuthGuardProps {
11
11
  /**
12
- * Element rendered while `useAuth().state.initialized` is `false`.
13
- * Overrides the default `<div data-mol-id="auth-guard-loading">…</div>`
14
- * loading tag — pass a full-page spinner or any other UI you want
15
- * during the auth bootstrap window.
12
+ * Element rendered while `useAuth().status` is `'loading'` — no session
13
+ * decision yet. Overrides the default
14
+ * `<div data-mol-id="auth-guard-loading">…</div>` loading tag — pass a
15
+ * full-page spinner or any other UI you want during the auth bootstrap window.
16
16
  */
17
17
  loadingFallback?: ReactNode;
18
18
  /**
@@ -49,12 +49,18 @@ export interface AuthGuardProps {
49
49
  /**
50
50
  * Route-element guard for authenticated sections of a React Router tree.
51
51
  *
52
- * - While `useAuth().state.initialized` is `false`, renders the
52
+ * - While `useAuth().status` is `'loading'` (no session decision yet), renders the
53
53
  * `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
54
54
  * - If the user is not authenticated, redirects to `loginPath` carrying
55
55
  * the attempted location in `state.from` for post-login restoration.
56
56
  * - Otherwise renders `children` (or `<Outlet />` if none).
57
57
  *
58
+ * The guard reads `status`, not `initialized`: a stored token AND user make the
59
+ * FIRST render `'authenticated'`, so a protected page paints immediately instead
60
+ * of waiting for the background verification (`validateSession()`) or a
61
+ * current-user round trip. `'unavailable'` (a stored session the server could not
62
+ * confirm) counts as signed in — the page renders and the API decides.
63
+ *
58
64
  * The default loading tag carries `data-mol-id="auth-guard-loading"`
59
65
  * so AI agents and e2e tests can target it reliably. When the caller
60
66
  * passes a custom `loadingFallback`, it's the caller's responsibility
@@ -1 +1 @@
1
- {"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAKzD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,UAA6B,EAC7B,cAA6B,EAC7B,SAAoB,EACpB,eAAe,EACf,QAAQ,GACT,GAAE,cAAmB,GAAG,SAAS,CA2BjC"}
1
+ {"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAKzD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,UAA6B,EAC7B,cAA6B,EAC7B,SAAoB,EACpB,eAAe,EACf,QAAQ,GACT,GAAE,cAAmB,GAAG,SAAS,CA2BjC"}
@@ -5,12 +5,18 @@ import { useAuth, useTranslation } from '@molecule/app-react';
5
5
  /**
6
6
  * Route-element guard for authenticated sections of a React Router tree.
7
7
  *
8
- * - While `useAuth().state.initialized` is `false`, renders the
8
+ * - While `useAuth().status` is `'loading'` (no session decision yet), renders the
9
9
  * `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
10
10
  * - If the user is not authenticated, redirects to `loginPath` carrying
11
11
  * the attempted location in `state.from` for post-login restoration.
12
12
  * - Otherwise renders `children` (or `<Outlet />` if none).
13
13
  *
14
+ * The guard reads `status`, not `initialized`: a stored token AND user make the
15
+ * FIRST render `'authenticated'`, so a protected page paints immediately instead
16
+ * of waiting for the background verification (`validateSession()`) or a
17
+ * current-user round trip. `'unavailable'` (a stored session the server could not
18
+ * confirm) counts as signed in — the page renders and the API decides.
19
+ *
14
20
  * The default loading tag carries `data-mol-id="auth-guard-loading"`
15
21
  * so AI agents and e2e tests can target it reliably. When the caller
16
22
  * passes a custom `loadingFallback`, it's the caller's responsibility
@@ -19,7 +25,7 @@ import { useAuth, useTranslation } from '@molecule/app-react';
19
25
  * @param props - {@link AuthGuardProps}
20
26
  */
21
27
  export function AuthGuard({ loadingFallback, loadingKey = 'common.loading', loadingDefault = 'Loading...', loginPath = '/login', onAuthenticated, children, } = {}) {
22
- const { isAuthenticated, state } = useAuth();
28
+ const { isAuthenticated, status } = useAuth();
23
29
  const { t } = useTranslation();
24
30
  const location = useLocation();
25
31
  const lastAuthRef = useRef(false);
@@ -31,7 +37,7 @@ export function AuthGuard({ loadingFallback, loadingKey = 'common.loading', load
31
37
  }
32
38
  lastAuthRef.current = isAuthenticated;
33
39
  }, [isAuthenticated, onAuthenticated]);
34
- if (!state.initialized) {
40
+ if (status === 'loading') {
35
41
  return (loadingFallback ?? (_jsx("div", { "data-mol-id": "auth-guard-loading", children: t(loadingKey, {}, { defaultValue: loadingDefault }) })));
36
42
  }
37
43
  if (!isAuthenticated) {
@@ -1 +1 @@
1
- {"version":3,"file":"AuthGuard.js","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAkD7D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,eAAe,EACf,UAAU,GAAG,gBAAgB,EAC7B,cAAc,GAAG,YAAY,EAC7B,SAAS,GAAG,QAAQ,EACpB,eAAe,EACf,QAAQ,MACU,EAAE;IACpB,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAA;IAC5C,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,WAAW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pB,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAA;IAC7C,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAEjC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe;YAAE,OAAM;QAC5B,IAAI,eAAe,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC5C,eAAe,EAAE,CAAA;QACnB,CAAC;QACD,WAAW,CAAC,OAAO,GAAG,eAAe,CAAA;IACvC,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAA;IAEtC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,CACL,eAAe,IAAI,CACjB,6BAAiB,oBAAoB,YAClC,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,GAChD,CACP,CACF,CAAA;IACH,CAAC;IACD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,KAAC,QAAQ,IAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,SAAG,CAAA;IACvE,CAAC;IACD,OAAO,4BAAG,QAAQ,IAAI,KAAC,MAAM,KAAG,GAAI,CAAA;AACtC,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@molecule/app-ui-react",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "React UI components for molecule.dev",
5
5
  "type": "module",
6
+ "sideEffects": false,
6
7
  "main": "dist/index.js",
7
8
  "types": "dist/index.d.ts",
8
9
  "exports": {
@@ -43,7 +44,7 @@
43
44
  "devDependencies": {
44
45
  "@molecule/app-i18n": "1.0.3",
45
46
  "@molecule/app-icons": "1.0.2",
46
- "@molecule/app-react": "1.6.3",
47
+ "@molecule/app-react": "1.6.6",
47
48
  "@testing-library/react": "16.3.2",
48
49
  "@types/node": "26.1.2",
49
50
  "@types/react": "19.2.17",