akanjs 3.3.0-rc.4 → 3.3.0-rc.6

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/CHANGELOG.md CHANGED
@@ -12,9 +12,14 @@
12
12
 
13
13
  The api report lists additions only: `Device.keyboardAnimationMs`, `Device.keyboardHeight` and `Device.subscribeKeyboard`, the optional `KeyboardFrameState.avoidsContent` and `isPageKeyboardAvoidance` from `akanjs/webkit`; no upgrade step is needed. An iOS app gets the new behavior once it is built with this shell; a page that lifted its own composer by the keyboard's height under the old pan should drop that lift.
14
14
 
15
+ - 4040f2d: `overlay: true` (or `"top"` / `"bottom"`) in a route's `.config()` lays the page under that side's safe area and inset instead of below them, so a translucent bar (a frosted tab bar, a glass header) has the page's content scrolling beneath it. On an overlaid side the page's padding is 0, `--akan-overlay-top` / `--akan-overlay-bottom` carry the chrome's height for the page's scrollers to pad by, the top inset's container stops painting the background, and the safe area strip is transparent and lets touches through unless the route sets its color. Until now every bar sat over a reserved band of plain background, so a backdrop blur had nothing to show.
16
+
17
+ The key defaults to off, so existing pages are unchanged. The api report lists the new `PageOverlayConfig` type and one new optional property on `PageConfig` and on `CsrState`; no upgrade step is needed.
18
+
15
19
  ### Patch Changes
16
20
 
17
21
  - c44d068: A coding agent reads less to build its first app: the `akanjs` README keeps the path to a first app and links the rest on akanjs.com (17 KB to 7 KB), the `akan-page` and `akan-service` skills ship the API reference one section at a time with every entry named in the skill's index (`Link` now lists the anchor attributes it takes and `Link.Back`, `Link.Close` and `Link.Lang`), the `akan-page` skill holds what a first page looks up while `pageRule` keeps the deeper contract, and each rule is stated once across AGENTS.md, the path rules and the skills. Run `akan agent install` in a workspace to pick up the new files.
22
+ - af09c4f: `router.backOrFallback()` and `Link.Back` with a `fallback` close a browser tab the app itself opened instead of replacing to the fallback, when there is nothing to go back to. The tab counts as opened by the app when it holds one history entry and has an opener or a same-origin referrer, so a `window.open(href, "_blank", "noopener")` or `target="_blank"` link qualifies. A tab the person opened (a bookmark, a typed URL), one another site opened, and an iOS, Android or desktop shell keep going to the fallback, as does a tab the browser refuses to close.
18
23
  - 24315d1: A page asks for its stylesheet before its client chunks. The preload tags for the chunks a page's first screen imports are written at the end of `<head>` instead of at its top, so the stylesheet link comes first; the bootstrap module, the dictionary and the import map stay at the top. On a throttled mobile connection (Lighthouse's slow 4G applied in the browser, over HTTP/2) a 56-chunk page first paints about 160 ms sooner (1.83 s to 1.67 s), and a page whose largest element is a small image shows it about 140 ms sooner; a large image still shares the connection with the chunks and arrives when it did. Every chunk still starts loading with the document, so the page hydrates when it did.
19
24
  - bf582c1: A page stored in the HTML cache is kept as the bytes it streamed, instead of being decoded to text and encoded again before compression. Storing a 600 KB page takes about a fifth of the main-thread time it did, and the stored page and every response from it are unchanged.
20
25
  - c10f7cf: A loader sends its store at most 500 distinct keys per query and splits a larger batch into several queries that run together. A `load<Model>Many` or a nested list with more ids than a database takes in one statement now loads instead of failing: Postgres refused more than 65,534 values, and SQLite refused a `byQuery` batch of about 1,000 keys.
@@ -0,0 +1,12 @@
1
+ import { Href } from "./href";
2
+ import { isNativeShell } from "./nativeHost";
3
+
4
+ export const closeAppOpenedTab = (): boolean => {
5
+ const win = globalThis.window;
6
+ if (!win || isNativeShell() || win.history?.length !== 1 || typeof win.close !== "function") return false;
7
+
8
+ const referrer = globalThis.document?.referrer ?? "";
9
+ if (!win.opener && (!referrer || Href.leavesOrigin(referrer, win.location.href))) return false;
10
+ win.close();
11
+ return win.closed === true;
12
+ };
@@ -19,6 +19,8 @@ export type PageSafeAreaConfig =
19
19
  bottom?: boolean;
20
20
  android?: "auto" | "edge-to-edge" | "none";
21
21
  };
22
+ /** The sides whose chrome the page runs under instead of below. */
23
+ export type PageOverlayConfig = boolean | "top" | "bottom";
22
24
  /** `"stream"` flushes the shell (`Loading` included) then streams; a redirect in suspended content becomes a client one.
23
25
  * `"block"` buffers the whole document, so an error in slow content can still render a clean error page. */
24
26
  export type SsrRenderMode = "stream" | "block";
@@ -34,6 +36,12 @@ export interface PageConfig {
34
36
  topInset?: number | boolean | ResponsiveInset;
35
37
  /** Bottom chrome reservation in px, or px per breakpoint. Use true for the default 48px reservation. */
36
38
  bottomInset?: number | boolean | ResponsiveInset;
39
+ /**
40
+ * Lays the page under its top or bottom chrome (safe area and inset) instead of below it, so a translucent bar has
41
+ * content scrolling beneath it. The page pads its own scrollers by `--akan-overlay-top` / `--akan-overlay-bottom`,
42
+ * and an overlaid side's safe area defaults to transparent.
43
+ */
44
+ overlay?: PageOverlayConfig;
37
45
  gesture?: boolean;
38
46
  cache?: boolean;
39
47
  /** Initial full-document SSR strategy. Defaults to `"stream"`. */
@@ -64,6 +72,7 @@ export interface CsrState {
64
72
  responsiveInset?: { top: ResponsiveInset; bottom: ResponsiveInset };
65
73
  /** Web only: the sides whose safe area `env(safe-area-inset-*)` measures, since a browser tells script nothing. */
66
74
  safeAreaEnv?: { top: boolean; bottom: boolean };
75
+ overlay?: { top: boolean; bottom: boolean };
67
76
  gesture: boolean;
68
77
  cache: boolean;
69
78
  ssr: SsrRenderMode;
@@ -1,5 +1,12 @@
1
1
  import { isRecord, trimSlashes } from "akanjs/common";
2
- import type { PageConfig, PageSafeAreaConfig, PageState, ResponsiveInset, SsrRenderMode } from "./csrTypes";
2
+ import type {
3
+ PageConfig,
4
+ PageOverlayConfig,
5
+ PageSafeAreaConfig,
6
+ PageState,
7
+ ResponsiveInset,
8
+ SsrRenderMode,
9
+ } from "./csrTypes";
3
10
  import { transitionTypes } from "./transitionTypes";
4
11
 
5
12
  export type DevicePlatform = "ios" | "android" | "web" | (string & {});
@@ -38,6 +45,7 @@ const pageConfigKeys = new Set<keyof PageConfig>([
38
45
  "safeArea",
39
46
  "topInset",
40
47
  "bottomInset",
48
+ "overlay",
41
49
  "gesture",
42
50
  "cache",
43
51
  "ssr",
@@ -78,6 +86,9 @@ export const validatePageConfig = (routeKey: string, config?: PageConfig) => {
78
86
  `[route-convention] pageConfig.${key} in ${routeKey} must be a boolean, a non-negative px number, or { base, sm?, md?, lg?, xl?, "2xl"? } of them.`,
79
87
  );
80
88
  }
89
+ const { overlay } = pageConfig;
90
+ if (overlay !== undefined && typeof overlay !== "boolean" && overlay !== "top" && overlay !== "bottom")
91
+ throw new Error(`[route-convention] pageConfig.overlay in ${routeKey} must be a boolean, "top" or "bottom".`);
81
92
  validateSafeAreaConfig(routeKey, pageConfig.safeArea);
82
93
  };
83
94
 
@@ -199,6 +210,7 @@ export const resolvePageState = ({
199
210
  const transition = config.transition ?? "none";
200
211
  const responsive = isResponsiveInset(config.topInset) || isResponsiveInset(config.bottomInset);
201
212
  const safeAreaEnv = platform === "web" ? resolveSafeAreaEnv(config.safeArea) : undefined;
213
+ const overlay = resolveOverlay(config.overlay);
202
214
  return {
203
215
  transition,
204
216
  topSafeArea: safeArea.top,
@@ -216,6 +228,7 @@ export const resolvePageState = ({
216
228
  }
217
229
  : {}),
218
230
  ...(safeAreaEnv ? { safeAreaEnv } : {}),
231
+ ...(overlay ? { overlay } : {}),
219
232
  gesture: explicitKeys.gesture
220
233
  ? (config.gesture ?? false)
221
234
  : transition === "none"
@@ -223,11 +236,19 @@ export const resolvePageState = ({
223
236
  : (config.gesture ?? false),
224
237
  cache: config.cache ?? false,
225
238
  ssr: config.ssr ?? "stream",
226
- topSafeAreaColor: config.topSafeAreaColor ?? defaultPageState.topSafeAreaColor,
227
- bottomSafeAreaColor: config.bottomSafeAreaColor ?? defaultPageState.bottomSafeAreaColor,
239
+ topSafeAreaColor: config.topSafeAreaColor ?? (overlay?.top ? "transparent" : defaultPageState.topSafeAreaColor),
240
+ bottomSafeAreaColor:
241
+ config.bottomSafeAreaColor ?? (overlay?.bottom ? "transparent" : defaultPageState.bottomSafeAreaColor),
228
242
  };
229
243
  };
230
244
 
245
+ const resolveOverlay = (overlay?: PageOverlayConfig): { top: boolean; bottom: boolean } | undefined => {
246
+ if (overlay === true) return { top: true, bottom: true };
247
+ if (overlay === "top") return { top: true, bottom: false };
248
+ if (overlay === "bottom") return { top: false, bottom: true };
249
+ return undefined;
250
+ };
251
+
231
252
  const resolveInset = (inset: PageConfig["topInset"]): number => {
232
253
  if (inset === true) return DEFAULT_BOOLEAN_INSET;
233
254
  if (inset === false || inset === undefined) return 0;
package/client/index.ts CHANGED
@@ -83,6 +83,7 @@ export {
83
83
  type PageLoadingProps,
84
84
  type PageLoadingRender,
85
85
  type PageModule,
86
+ type PageOverlayConfig,
86
87
  type PageProps,
87
88
  type PageRender,
88
89
  type PageSafeAreaConfig,
package/client/router.ts CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  parseBasePaths,
10
10
  trimSlashes,
11
11
  } from "akanjs/common";
12
+ import { closeAppOpenedTab } from "./appOpenedTab";
12
13
  import { CsrLocation, csrLocation } from "./csrLocation";
13
14
  import { Href } from "./href";
14
15
  import { isMcpView } from "./mcpView";
@@ -654,6 +655,7 @@ class Router {
654
655
  this.back(routeOptions);
655
656
  return undefined as never;
656
657
  }
658
+ if (closeAppOpenedTab()) return undefined as never;
657
659
  this.replace(fallbackHref, routeOptions);
658
660
  return undefined as never;
659
661
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.3.0-rc.4",
3
+ "version": "3.3.0-rc.6",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -0,0 +1 @@
1
+ export declare const closeAppOpenedTab: () => boolean;
@@ -12,6 +12,8 @@ export type PageSafeAreaConfig = boolean | "top" | "bottom" | {
12
12
  bottom?: boolean;
13
13
  android?: "auto" | "edge-to-edge" | "none";
14
14
  };
15
+ /** The sides whose chrome the page runs under instead of below. */
16
+ export type PageOverlayConfig = boolean | "top" | "bottom";
15
17
  /** `"stream"` flushes the shell (`Loading` included) then streams; a redirect in suspended content becomes a client one.
16
18
  * `"block"` buffers the whole document, so an error in slow content can still render a clean error page. */
17
19
  export type SsrRenderMode = "stream" | "block";
@@ -28,6 +30,12 @@ export interface PageConfig {
28
30
  topInset?: number | boolean | ResponsiveInset;
29
31
  /** Bottom chrome reservation in px, or px per breakpoint. Use true for the default 48px reservation. */
30
32
  bottomInset?: number | boolean | ResponsiveInset;
33
+ /**
34
+ * Lays the page under its top or bottom chrome (safe area and inset) instead of below it, so a translucent bar has
35
+ * content scrolling beneath it. The page pads its own scrollers by `--akan-overlay-top` / `--akan-overlay-bottom`,
36
+ * and an overlaid side's safe area defaults to transparent.
37
+ */
38
+ overlay?: PageOverlayConfig;
31
39
  gesture?: boolean;
32
40
  cache?: boolean;
33
41
  /** Initial full-document SSR strategy. Defaults to `"stream"`. */
@@ -63,6 +71,10 @@ export interface CsrState {
63
71
  top: boolean;
64
72
  bottom: boolean;
65
73
  };
74
+ overlay?: {
75
+ top: boolean;
76
+ bottom: boolean;
77
+ };
66
78
  gesture: boolean;
67
79
  cache: boolean;
68
80
  ssr: SsrRenderMode;
@@ -3,7 +3,7 @@ export { cn, colorTokens, radiusTokens } from "./cn.d.ts";
3
3
  export { authTokenKey, cookieJar, cookies, type GetOption, getAccount, getAuthToken, getCookie, getHeader, getSessionClaims, getStoredAuthToken, headers, initAuth, removeCookie, resetAuth, setAuth, setCookie, } from "./cookie.d.ts";
4
4
  export { createFont, Inter, Nanum_Gothic_Coding, Noto_Sans_KR, Roboto } from "./createFont.d.ts";
5
5
  export { CsrLocation, csrLocation } from "./csrLocation.d.ts";
6
- export { type AkanHeadSnapshotNode, type AkanHeadSnapshotV1, type AnimatedDivProps, type ContainerTransition, type CsrContextType, type CsrNavigationKind, type CsrNavigationPhase, type CsrPageType, type CsrStackAccount, type CsrStackEntry, type CsrState, type CsrTransitionStyles, csrContext, DEFAULT_BOTTOM_INSET, DEFAULT_TOP_INSET, type FrameContentViewportState, type FrameLayer, type FrameLayerZIndex, type FrameLayoutState, type FramePlatformProfile, type FrameSlotBucket, type FrameSlotRegistration, type FrameSlotRole, type FrameSlotScope, type FrameSlotType, type FrameSnapshot, type FrameViewportState, type GenerateHead, type Head, type HeadProps, type History, type KeyboardAccessoryFrameState, type KeyboardFrameState, type LayoutErrorProps, type LayoutErrorRender, type LayoutFallbackRoute, type LayoutLoadingProps, type LayoutLoadingRender, type LayoutModule, type LayoutNotFoundProps, type LayoutNotFoundRender, type LayoutProps, type LayoutRender, type Location, type LocationState, type NavigationIntent, type PageActivity, type PageActivityState, type PageConfig, type PageLoadingProps, type PageLoadingRender, type PageModule, type PageProps, type PageRender, type PageSafeAreaConfig, type PageState, type PageTransition, type PathContextType, type PathRoute, pageActivityContext, pathContext, type ResolvedHead, type ResolveHead, type ResolveHeadResult, type ResponsiveInset, type Route, type RouteGuard, type RouteGuardProps, type RouteGuide, type RouteModule, type RouteRender, type RouterProps, type RouteState, type RouteViewport, type SafeAreaTransition, type SsrRenderMode, type TransitionAction, type TransitionActionContext, type TransitionPlan, type TransitionStyle, type UseCsrTransition, useCsr, usePathCtx, type WebAppManifest, type WebAppManifestIcon, } from "./csrTypes.d.ts";
6
+ export { type AkanHeadSnapshotNode, type AkanHeadSnapshotV1, type AnimatedDivProps, type ContainerTransition, type CsrContextType, type CsrNavigationKind, type CsrNavigationPhase, type CsrPageType, type CsrStackAccount, type CsrStackEntry, type CsrState, type CsrTransitionStyles, csrContext, DEFAULT_BOTTOM_INSET, DEFAULT_TOP_INSET, type FrameContentViewportState, type FrameLayer, type FrameLayerZIndex, type FrameLayoutState, type FramePlatformProfile, type FrameSlotBucket, type FrameSlotRegistration, type FrameSlotRole, type FrameSlotScope, type FrameSlotType, type FrameSnapshot, type FrameViewportState, type GenerateHead, type Head, type HeadProps, type History, type KeyboardAccessoryFrameState, type KeyboardFrameState, type LayoutErrorProps, type LayoutErrorRender, type LayoutFallbackRoute, type LayoutLoadingProps, type LayoutLoadingRender, type LayoutModule, type LayoutNotFoundProps, type LayoutNotFoundRender, type LayoutProps, type LayoutRender, type Location, type LocationState, type NavigationIntent, type PageActivity, type PageActivityState, type PageConfig, type PageLoadingProps, type PageLoadingRender, type PageModule, type PageOverlayConfig, type PageProps, type PageRender, type PageSafeAreaConfig, type PageState, type PageTransition, type PathContextType, type PathRoute, pageActivityContext, pathContext, type ResolvedHead, type ResolveHead, type ResolveHeadResult, type ResponsiveInset, type Route, type RouteGuard, type RouteGuardProps, type RouteGuide, type RouteModule, type RouteRender, type RouterProps, type RouteState, type RouteViewport, type SafeAreaTransition, type SsrRenderMode, type TransitionAction, type TransitionActionContext, type TransitionPlan, type TransitionStyle, type UseCsrTransition, useCsr, usePathCtx, type WebAppManifest, type WebAppManifestIcon, } from "./csrTypes.d.ts";
7
7
  export { Toast } from "./decorators.d.ts";
8
8
  export { Device, debugFrame, isMobileDevice, isNativeTarget } from "./device.d.ts";
9
9
  export { breakpointQuery, type DevicePlatform, defaultPageState, getExplicitPageConfigKeys, type InsetBreakpoint, insetAt, insetBreakpoints, insetsByBreakpoint, isResponsiveInset, mergePageConfigs, type ResolvePageStateOptions, readCssSafeAreaInsets, resolvePageState, type SafeAreaInsets, type TailwindBreakpoint, validatePageConfig, } from "./frameConfig.d.ts";
@@ -4,7 +4,8 @@ export interface ActionProps {
4
4
  children?: ReactNode;
5
5
  }
6
6
  export interface BackProps extends ActionProps {
7
- /** Where to go when there is no history to go back to, as on a deep link or a freshly opened app. */
7
+ /** Where to go when there is no history to go back to, as on a deep link or a freshly opened app; a browser tab this
8
+ * app opened closes instead. */
8
9
  fallback?: string;
9
10
  }
10
11
  export declare const Back: ({ className, children, fallback }: BackProps) => import("react").JSX.Element;
@@ -32,7 +32,7 @@ export declare function ManifestLink({ manifest, basePath }: {
32
32
  basePath?: string | null;
33
33
  }): import("react").JSX.Element | null;
34
34
  export declare function createManifestDataUrl(manifest: WebAppManifest): string;
35
- export type AkanFrameCssVarName = "--akan-top-safe-area" | "--akan-bottom-safe-area" | "--akan-top-inset" | "--akan-bottom-inset" | "--akan-page-padding-top" | "--akan-page-padding-bottom" | "--akan-content-height" | `--akan-${"top" | "bottom"}-inset-visibility` | `--akan-${"top" | "bottom"}-inset-${InsetBreakpoint}` | `--akan-${"top" | "bottom"}-inset-visibility-${InsetBreakpoint}`;
35
+ export type AkanFrameCssVarName = "--akan-top-safe-area" | "--akan-bottom-safe-area" | "--akan-top-inset" | "--akan-bottom-inset" | "--akan-page-padding-top" | "--akan-page-padding-bottom" | "--akan-overlay-top" | "--akan-overlay-bottom" | "--akan-content-height" | `--akan-${"top" | "bottom"}-inset-visibility` | `--akan-${"top" | "bottom"}-inset-${InsetBreakpoint}` | `--akan-${"top" | "bottom"}-inset-visibility-${InsetBreakpoint}`;
36
36
  export type AkanFrameCssVars = CSSProperties & {
37
37
  [name in AkanFrameCssVarName]?: string;
38
38
  };
@@ -41,10 +41,11 @@ const moveInto = (parent: HTMLElement, node: HTMLElement) => {
41
41
 
42
42
  interface SsrFrameSlotProps {
43
43
  slot: FrameSlotName;
44
+ isOverlaid: boolean;
44
45
  children: ReactNode;
45
46
  }
46
47
 
47
- const SsrFrameSlot = ({ slot, children }: SsrFrameSlotProps) => {
48
+ const SsrFrameSlot = ({ slot, isOverlaid, children }: SsrFrameSlotProps) => {
48
49
  const boxRef = useRef<HTMLDivElement>(null);
49
50
  const contentRef = useRef<HTMLDivElement>(null);
50
51
  useLayoutEffect(() => {
@@ -61,7 +62,7 @@ const SsrFrameSlot = ({ slot, children }: SsrFrameSlotProps) => {
61
62
  <div
62
63
  ref={boxRef}
63
64
  data-akan-frame-fallback={slot}
64
- className={cn(frameSlotContainerClassNames[slot], "z-10 empty:hidden")}
65
+ className={cn(frameSlotContainerClassNames[slot], "z-10 empty:hidden", isOverlaid && "bg-transparent")}
65
66
  style={frameSlotStyles[slot]}
66
67
  >
67
68
  <div ref={contentRef} className={frameSlotContentClassNames[slot]}>
@@ -78,7 +79,13 @@ interface FrameSlotPortalProps {
78
79
  }
79
80
  export const FrameSlotPortal = ({ slot, children }: FrameSlotPortalProps) => {
80
81
  const pathCtx = usePathCtx();
81
- if (getEnv().renderMode !== "csr") return <SsrFrameSlot slot={slot}>{children}</SsrFrameSlot>;
82
+ const overlay = pathCtx.location?.pathRoute?.pageState?.overlay;
83
+ if (getEnv().renderMode !== "csr")
84
+ return (
85
+ <SsrFrameSlot slot={slot} isOverlaid={slot === "topInset" && !!overlay?.top}>
86
+ {children}
87
+ </SsrFrameSlot>
88
+ );
82
89
 
83
90
  const path = pathCtx.location?.pathRoute?.path;
84
91
  return <Portal id={path ? `${slot}Content-${pathCtx.pageKey ?? path}` : `${slot}Content`}>{children}</Portal>;
@@ -8,7 +8,8 @@ export interface ActionProps {
8
8
  }
9
9
 
10
10
  export interface BackProps extends ActionProps {
11
- /** Where to go when there is no history to go back to, as on a deep link or a freshly opened app. */
11
+ /** Where to go when there is no history to go back to, as on a deep link or a freshly opened app; a browser tab this
12
+ * app opened closes instead. */
12
13
  fallback?: string;
13
14
  }
14
15
 
package/ui/System/CSR.tsx CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  debugFrame,
9
9
  getPathInfo,
10
10
  type PageActivity,
11
+ type PageState,
11
12
  type ReactFont,
12
13
  router,
13
14
  useCsr,
@@ -101,6 +102,21 @@ const CSRProvider = ({
101
102
  };
102
103
  CSR.Provider = CSRProvider;
103
104
 
105
+ const chromeClassNamesOf = (overlay?: PageState["overlay"]) => ({
106
+ topSafeArea: cn(
107
+ "akan-frame-chrome fixed inset-x-0 top-0 max-w-screen bg-background",
108
+ overlay?.top && "pointer-events-none",
109
+ ),
110
+ topInset: cn(
111
+ "akan-frame-chrome fixed inset-x-0 isolate max-w-screen overflow-hidden bg-background",
112
+ overlay?.top && "bg-transparent",
113
+ ),
114
+ bottomSafeArea: cn(
115
+ "akan-frame-chrome fixed inset-x-0 max-w-screen bg-background",
116
+ overlay?.bottom && "pointer-events-none",
117
+ ),
118
+ });
119
+
104
120
  interface CSRWrapperProps {
105
121
  className?: string;
106
122
  appName: string;
@@ -137,7 +153,8 @@ const CSRWrapper = ({
137
153
  stackEntries,
138
154
  } = useCsr();
139
155
  const csrLoaded = st.use.csrLoaded({ agent: false });
140
- const { router: reactRouter, history } = useCsr();
156
+ const { router: reactRouter, history, location } = useCsr();
157
+ const chrome = chromeClassNamesOf(location?.pathRoute?.pageState?.overlay);
141
158
  useEffect(() => {
142
159
  debugFrame("csrWrapper.mount", { appName, layoutStyle, pathCount: pathRoutes.length });
143
160
  if (layoutStyle === "mobile") {
@@ -197,15 +214,11 @@ const CSRWrapper = ({
197
214
  : null}
198
215
  <TopChromeLayer
199
216
  id="topSafeArea"
200
- className={cn("akan-frame-chrome fixed inset-x-0 top-0 max-w-screen bg-background")}
217
+ className={chrome.topSafeArea}
201
218
  layerRef={topSafeAreaRef}
202
219
  style={topSafeArea?.containerStyle}
203
220
  />
204
- <TopChromeLayer
205
- id="topInsetContainer"
206
- className={cn("akan-frame-chrome fixed inset-x-0 isolate max-w-screen overflow-hidden bg-background")}
207
- style={topInset?.containerStyle}
208
- >
221
+ <TopChromeLayer id="topInsetContainer" className={chrome.topInset} style={topInset?.containerStyle}>
209
222
  <CSRFrameSlotTargets slot="topInset" />
210
223
  </TopChromeLayer>
211
224
  <TopChromeLayer
@@ -245,7 +258,7 @@ const CSRWrapper = ({
245
258
  </KeyboardLayer>
246
259
  <BottomChromeLayer
247
260
  id="bottomSafeArea"
248
- className="akan-frame-chrome fixed inset-x-0 max-w-screen bg-background"
261
+ className={chrome.bottomSafeArea}
249
262
  layerRef={bottomSafeAreaRef}
250
263
  style={bottomSafeArea?.containerStyle}
251
264
  />
@@ -61,6 +61,8 @@ export type AkanFrameCssVarName =
61
61
  | "--akan-bottom-inset"
62
62
  | "--akan-page-padding-top"
63
63
  | "--akan-page-padding-bottom"
64
+ | "--akan-overlay-top"
65
+ | "--akan-overlay-bottom"
64
66
  | "--akan-content-height"
65
67
  | `--akan-${"top" | "bottom"}-inset-visibility`
66
68
  | `--akan-${"top" | "bottom"}-inset-${InsetBreakpoint}`
@@ -83,11 +85,15 @@ export const isResponsiveFrame = (pageState: PageState, { cssResolved }: { cssRe
83
85
  */
84
86
  export function getFrameCssVars(pageState: PageState, { cssResolved }: { cssResolved: boolean }): AkanFrameCssVars {
85
87
  const safeAreaEnv = cssResolved ? pageState.safeAreaEnv : undefined;
88
+ const topChrome = "calc(var(--akan-top-safe-area) + var(--akan-top-inset))";
89
+ const bottomChrome = "calc(var(--akan-bottom-safe-area) + var(--akan-bottom-inset))";
86
90
  const vars: AkanFrameCssVars = {
87
91
  "--akan-top-safe-area": safeAreaEnv?.top ? "env(safe-area-inset-top, 0px)" : px(pageState.topSafeArea),
88
92
  "--akan-bottom-safe-area": safeAreaEnv?.bottom ? "env(safe-area-inset-bottom, 0px)" : px(pageState.bottomSafeArea),
89
- "--akan-page-padding-top": "calc(var(--akan-top-safe-area) + var(--akan-top-inset))",
90
- "--akan-page-padding-bottom": "calc(var(--akan-bottom-safe-area) + var(--akan-bottom-inset))",
93
+ "--akan-page-padding-top": pageState.overlay?.top ? "0px" : topChrome,
94
+ "--akan-page-padding-bottom": pageState.overlay?.bottom ? "0px" : bottomChrome,
95
+ "--akan-overlay-top": pageState.overlay?.top ? topChrome : "0px",
96
+ "--akan-overlay-bottom": pageState.overlay?.bottom ? bottomChrome : "0px",
91
97
  "--akan-content-height":
92
98
  "calc(var(--akan-viewport-height, 100dvh) - var(--akan-page-padding-top) - var(--akan-page-padding-bottom))",
93
99
  };
package/ui/System/SSR.tsx CHANGED
@@ -185,7 +185,7 @@ const SSRWrapper = ({
185
185
  <div
186
186
  key="top-safe-area"
187
187
  id="topSafeArea"
188
- className={cn("fixed inset-x-0 top-0 bg-background")}
188
+ className={cn("fixed inset-x-0 top-0 bg-background", pageState.overlay?.top && "pointer-events-none")}
189
189
  style={topSafeAreaStyle}
190
190
  />
191
191
  <div key="page-containers" id="pageContainers" className={cn("isolate")}>
@@ -210,6 +210,7 @@ const SSRWrapper = ({
210
210
  frameSlotContainerClassNames.topInset,
211
211
  layoutStyle === "mobile" && "left-1/2 w-full max-w-[600px] -translate-x-1/2",
212
212
  layoutStyle === "web" && "w-full",
213
+ pageState.overlay?.top && "bg-transparent",
213
214
  )}
214
215
  style={frameSlotStyles.topInset}
215
216
  >
@@ -253,7 +254,7 @@ const SSRWrapper = ({
253
254
  <div
254
255
  key="bottom-safe-area"
255
256
  id="bottomSafeArea"
256
- className="fixed inset-x-0 bg-background"
257
+ className={cn("fixed inset-x-0 bg-background", pageState.overlay?.bottom && "pointer-events-none")}
257
258
  style={bottomSafeAreaStyle}
258
259
  />
259
260
  </ClientPathWrapper>
@@ -45,23 +45,36 @@ const fadeOut = (progress: Progress) => ({ opacity: progress.to((value) => 1 - v
45
45
  const isKeyboardOverContent = ({ keyboard }: RouteState["frameLayout"]) =>
46
46
  !!keyboard.avoidsContent && keyboard.visible && !keyboard.sticky;
47
47
 
48
+ const chromePadding = (pageState: FramePageState, top: number, bottom: number) => ({
49
+ paddingTop: pageState.overlay?.top ? 0 : top,
50
+ paddingBottom: pageState.overlay?.bottom ? 0 : bottom,
51
+ "--akan-overlay-top": `${pageState.overlay?.top ? top : 0}px`,
52
+ "--akan-overlay-bottom": `${pageState.overlay?.bottom ? bottom : 0}px`,
53
+ });
54
+
48
55
  const pageContentStyle = ({ frameLayout }: RouteState, pageState: FramePageState) => ({
49
- paddingTop: pageState.topSafeArea + pageState.topInset,
50
- paddingBottom: isKeyboardOverContent(frameLayout)
51
- ? 0
52
- : Math.max(
53
- pageState.bottomSafeArea,
54
- pageState.bottomInset +
55
- pageState.bottomSafeArea -
56
- (frameLayout.keyboard.sticky ? frameLayout.keyboardAccessory.height : 0),
57
- ),
56
+ ...chromePadding(
57
+ pageState,
58
+ pageState.topSafeArea + pageState.topInset,
59
+ isKeyboardOverContent(frameLayout)
60
+ ? 0
61
+ : Math.max(
62
+ pageState.bottomSafeArea,
63
+ pageState.bottomInset +
64
+ pageState.bottomSafeArea -
65
+ (frameLayout.keyboard.sticky ? frameLayout.keyboardAccessory.height : 0),
66
+ ),
67
+ ),
58
68
  height: frameLayout.contentViewport.height,
59
69
  "--akan-content-height": `${frameLayout.contentViewport.height}px`,
60
70
  });
61
71
 
62
72
  const prevPageContentStyle = (clientHeight: number, prevPageState: FramePageState) => ({
63
- paddingTop: prevPageState.topSafeArea + prevPageState.topInset,
64
- paddingBottom: prevPageState.bottomInset + prevPageState.bottomSafeArea,
73
+ ...chromePadding(
74
+ prevPageState,
75
+ prevPageState.topSafeArea + prevPageState.topInset,
76
+ prevPageState.bottomInset + prevPageState.bottomSafeArea,
77
+ ),
65
78
  height: clientHeight,
66
79
  });
67
80
 
@@ -172,7 +185,7 @@ const useNoneTrans = (routeState: RouteState): UseCsrTransition => {
172
185
  },
173
186
  prevPage: {
174
187
  containerStyle: {
175
- paddingTop: prevPageState.topSafeArea + prevPageState.topInset,
188
+ paddingTop: prevPageState.overlay?.top ? 0 : prevPageState.topSafeArea + prevPageState.topInset,
176
189
  },
177
190
  contentStyle: { opacity: 0 },
178
191
  },