P-LensOpen the app

P-Lens Engineering Notes

A Discord-like layout in SolidJS

Based on the Japanese article “収支の帳簿アプリに、Discordの画面の配置がぴったり合った”, restructured for readers outside Japan.

A bookkeeping app with more than one book has a navigation problem before it has a design problem. There are several books. Each book has the same handful of screens: the list of entries, balances, a calendar, a breakdown, the raw files. Each entry in a list has a detail. On a wide screen all of this wants to be visible at once; on a phone there is room for one thing. And the same person uses both, sometimes on the same day.

This shape already has a well-known answer, and most people have it open in another tab. Discord puts servers in a column of round icons on the left, the chosen server’s channels in a list beside them, the conversation in the middle, and a pane on the right when something needs one. On a phone it shows those one at a time. Put books where the servers are and a book’s screens where the channels are, and a ledger fits without anything left over.

P-Lens, the app this article is about, is laid out that way. The layout itself lives in a small SolidJS package, solid-gathering-shell, which decides which panes are on screen with two pure functions and takes the rest from the URL. This article goes through how the layout maps onto a ledger and then through the package, with the real code.

All code is quoted from p-lens at v0.10.63. The app is GPL-3.0-or-later; the package, packages/solid-gathering-shell, is MIT.

The app, briefly

Pachinko and pachislot are machine games played in pachinko parlors across Japan. A player rents balls (pachinko) or tokens (pachislot) with cash, plays them, and takes what is left to the counter. In Japan, you cannot cash out at the pachinko parlor: the law does not let a parlor pay out cash or buy back the prizes it gives, so at the counter balls are exchanged only for prizes, and special prizes (特殊景品, to-ku-shu kay-hin) are bought for cash by a separate prize exchange shop nearby. The arrangement is known as the three-shop system (三店方式, sahn-ten hoh-shi-ki), and a separate article covers it and how the app’s ledger follows it.

Diagram of the three-shop system. The player gives the pachinko parlor cash and rents balls, and at the end of play gives the leftover balls to the parlor’s counter for prizes; inside the parlor no step turns balls into cash. The player sells special prizes for cash at a prize exchange shop, a separate business nearby, which sells them to a wholesaler, who sells them back to the parlor.

Leftover balls can also stay on deposit with the parlor, as a balance at that parlor only. P-Lens is a bookkeeping app for a player’s own results: what went in, what came out, what is on deposit where. Someone might keep 🐪マイ帳簿 (“my book”) for their own play and share 🚀チーム帳簿 (“team book”) with a teammate who goes by すばやいおサル (“quick monkey”). The app is a PWA and runs entirely in the browser, on a phone in the parlor or on a desktop at home.

Books are servers, screens are channels

The project’s ARCHITECTURE.md says it directly:

The rail is shaped like a server list: the live space at the top, where direct messages would be; your own books below a divider, one icon each; the books others let you into below another; settings at the foot.

The column on the left is called the rail. What goes on it is decided by the app, in SpacesRail.tsx:

  const groups = (): readonly (readonly RailItem[])[] => [
    [{ id: "live", label: "ライブ計測", icon: <LiveIcon />, selected: inLiveSpace(props.place), onSelect: () => moves.go({ kind: "live" }) }, ...((item) => (item === undefined ? [] : [item]))(room())],
    books().filter(ownedBy(app.services.member)).map(bookItem),
    books().filter((book) => !ownedBy(app.services.member)(book)).map(bookItem),
    consolidationShown(app.services.preferences)
      ? [{ id: "consolidated", label: "連結", icon: <ConsolidatedIcon />, colour: NERDPRO, selected: inConsolidation(props.place), onSelect: () => moves.go({ kind: "consolidated" }) }]
      : [],
  ]
  const footer = (): readonly (readonly RailItem[])[] => [
    [
      { id: "odd-prize-calculator", label: ODD_PRIZE_CALCULATOR_LABEL, icon: <CalculatorLetters />, selected: inOddPrizeCalculator(props.place), onSelect: () => moves.go({ kind: "odd-prize-calculator" }) },
      props.sampleBook,
    ],
    [{ id: "settings", label: "設定", icon: <SettingsIcon />, selected: inSettings(props.place), onSelect: () => moves.go({ kind: "settings" }) }],
  ]

From the top: live recording (ライブ計測, the screen used while playing), plus the team-play room while one is open; the books you own; the books others shared with you; a consolidated view of several books, if turned on in settings. At the foot: a calculator, the sample book, settings (設定). Each inner array is a group, and the package draws a divider between groups that have anything in them. Your own books and the books others let you into are separated by one line.

A book’s icon is the start of its title, as SpacesRail.tsx puts it:

/** A book on the rail is its title's first characters, as many as the person chose, as a server is its initials. */

The number of characters is a setting, one to four, counted as graphemes, so an emoji is one character. With one character, 🐪マイ帳簿 is just 🐪 on the rail. People who start their book titles with an emoji get a rail they can read at a glance; people who don’t get マ and チ.

The package draws the chosen space the way the reader probably expects. From RailBar.tsx:

 * The chosen space is marked by a pill on the edge and a squarer icon, so it
 * reads at a glance without a label. A space's `badge` sits on its corner,
 * over the shape and not cut by it. Labels surface through `renderTooltip`,
 * or the native `title` when none is given, because the shell does not pick a
 * tooltip library on the host's behalf.

In Tailwind terms the rail is a 72-pixel column of 48-pixel buttons, rounded-3xl at rest and rounded-2xl when hovered or chosen, with a bar on the left edge that grows to h-5 under the pointer and h-10 when chosen. That is the extent of the resemblance in the code. The colours are not Discord’s: the package refers only to theme colour names (surface-0, accent and so on) that the host defines, and P-Lens defines its own.

Choosing a book fills the list beside the rail with that book’s screens, which play the part of channels. From BookSpaceSide.tsx:

const VIEWS: readonly { readonly view: BookView; readonly label: string; readonly icon: () => JSX.Element }[] = [
  { view: "tallies", label: "収支", icon: TalliesIcon },
  { view: "holdings", label: "貯玉・貯メダル", icon: HoldingsIcon },
  { view: "result-calendar", label: RESULT_CALENDAR, icon: ResultCalendarIcon },
  { view: "files", label: "生ファイル", icon: FileIcon },
  { view: "activity", label: "操作履歴", icon: ActivityIcon },
]

Results (収支), balls and tokens on deposit (貯玉・貯メダル, cho-dah-ma and cho-meh-da-ru), a calendar, the raw journal files (生ファイル) and the activity log (操作履歴), with a breakdown (集計) inserted before the files. Six screens, the same in every book. Switching books changes what is in them, not what they are.

The badge

While a team-play session is open, its room appears in the top group of the rail. The package’s RailItem has a badge slot, documented as “a count of what waits there”, and puts whatever it is given on the icon’s corner. In a chat app that corner holds unread messages. P-Lens puts something else there; from room-rail.tsx:

/**
 * The room of the huddle the device is in, as a space on the rail: there
 * while the huddle is kept up (`HuddleLine.keptUp`), in the semipro
 * colour, wearing how many of the others are in a jackpot — those gone
 * quiet left out, and none while the line cannot be read, when nobody
 * knows. It is simply there, with no wait and no animation:
 * the dialog a huddle is joined in covers the rail as it comes.
 */

When すばやいおサル hits a jackpot, the room’s icon shows a red 1. The package does not know what the number means; it only places the element.

Four levels, four panes

Inside a book there are levels, and their count matches the chat app’s:

choose a book    →  choose a screen   →  read the list      →  open one entry
choose a server  →  choose a channel  →  read the messages  →  open a thread

The package cuts the screen along the same lines. Its README draws it:

+--------------------------------------------------------------+
|                       TopBar (optional)                      |
+------+------------+---------------------------+--------------+
|      |            |                           |              |
| Rail | SidePanel  |        MainContent        |   AuxPanel   |
| Bar  |            |                           |   optional   |
|      |            |                           |              |
+------+------------+---------------------------+--------------+

P-Lens puts the books in RailBar, a book’s screens in SidePanel, the chosen screen in MainContent, and in AuxPanel a single entry’s detail, a deposit passbook (for one pool, or for one parlor such as マレハン東京皇国第8支店 (a fictional parlor; read Ma-re-han Toh-kyoh Koh-ko-ku Dai-ha-chi Shi-ten, “Marehan, Tokyo Empire, Branch No. 8”) or 723豚の帽子亭店 (a fictional parlor; read Shi-chi-nissan Buta-no-boh-shi-tei, “723, the Pig’s Hat Tavern”)), or a raw file’s text (PLensScreen.tsx). With nothing chosen there is no detail pane, and the main content runs to the right edge. Deeper places get a breadcrumb in the main header, described in the README as “the steps that led to where it is, the earlier ones going back — as a thread shows its channel.”

The package: a frame, and nothing else

The whole shell is one component with slots. From GatheringShell.tsx:

/**
 * One screen holding a place where things gather: a bar across the top, a rail
 * of spaces, the list inside the chosen space, what is going on in the chosen
 * item, and its detail.
 *
 * A frame and nothing more. Every pane arrives as a slot, and the shell keeps
 * no state: the host says which arrangement the window calls for and which pane
 * is in focus. Panes hidden in a narrow arrangement stay mounted, so coming
 * back to the list finds it scrolled where it was left.
 *
 * Its height is one screen with the safe-area insets subtracted; scrolling
 * happens inside each pane.
 */
export function GatheringShell(props: ShellProps): JSX.Element {
  return (
    <ArrangementProvider value={() => props.arrangement}>
      <Frame {...props} />
    </ArrangementProvider>
  )
}

Two props carry all the decisions: arrangement and focus. The shell owns neither. The source is 11 files and 612 lines, and its only dependency is solid-js.

Narrow is a different arrangement, not a smaller one

The types are in panes.ts:

/**
 * How the shell is laid out: every pane side by side, or one at a time.
 *
 * Not a size squeezed by CSS. A narrow window is a different arrangement with
 * its own navigation — selection, then content, then detail — and the host
 * moves between them as it moves between addresses.
 */
export type Arrangement = "wide" | "narrow"

/**
 * Which pane a narrow arrangement shows.
 *
 * The host derives it from wherever it keeps the place the person is at, so a
 * step forward and the browser's back button undo each other without the shell
 * holding any navigation state.
 */
export type Focus = "selection" | "content" | "detail"

Four columns become three steps. The rail and the side list together are selection, which on a phone is one screen: icons on the left, the chosen book’s screens beside them. It is the screen a chat app on a phone opens on: servers down the side, channels beside them.

Which panes are on screen is decided by the rest of panes.ts:

/**
 * Which panes are on screen.
 *
 * A detail asked for with nothing to show in it falls back to the content
 * rather than to an empty screen.
 */
export const visiblePanes = (arrangement: Arrangement, focus: Focus, hasDetail: boolean): VisiblePanes =>
  arrangement === "wide"
    ? { selection: true, content: true, detail: hasDetail }
    : narrowPanes(focus === "detail" && !hasDetail ? "content" : focus)

const narrowPanes = (focus: Focus): VisiblePanes => ({
  selection: focus === "selection",
  content: focus === "content",
  detail: focus === "detail",
})

Three inputs, three booleans out, no DOM. A wide arrangement shows the selection and the content always and the detail when there is one, and ignores focus entirely. A narrow one shows exactly the pane in focus, except that a detail with nothing in it falls back to the content instead of a blank screen. Because focus is ignored when wide, the host can pass it all the time without asking how wide the window is, and a desktop window dragged thin lands on the right pane immediately.

The tests need no browser. From tests/panes.test.ts:

describe("visiblePanes", () => {
  test("a wide arrangement shows every pane, the detail only when there is one", () => {
    expect(visiblePanes("wide", "selection", true)).toEqual({ selection: true, content: true, detail: true })
    expect(visiblePanes("wide", "detail", false)).toEqual({ selection: true, content: true, detail: false })
  })

  test("a narrow arrangement shows exactly the pane in focus", () => {
    expect(visiblePanes("narrow", "selection", true)).toEqual({ selection: true, content: false, detail: false })
    expect(visiblePanes("narrow", "content", true)).toEqual({ selection: false, content: true, detail: false })
    expect(visiblePanes("narrow", "detail", true)).toEqual({ selection: false, content: false, detail: true })
  })

  test("a detail in focus with nothing to show falls back to the content", () => {
    expect(visiblePanes("narrow", "detail", false)).toEqual({ selection: false, content: true, detail: false })
  })
})

The three booleans go straight onto three divs as display: none or nothing; more on that below.

When a window is narrow

The second pure function decides the arrangement. It does not look at the device. From arrangement.ts:

/**
 * The arrangement a window calls for: narrow below its width, or where the
 * panes beside the main content — the rail, the list, a detail — would leave
 * the content less room than it needs, as a tablet held sideways does with a
 * detail open; wide otherwise.
 */
export const arrangementFor = (windowWidth: number, besideContent: number, bounds: ArrangementBounds): Arrangement =>
  windowWidth < bounds.narrowBelow || windowWidth - besideContent < bounds.contentAtLeast ? "narrow" : "wide"

There are two conditions. The window can be narrow, or the panes beside the main content can leave it too little. P-Lens passes these bounds, in PLensScreen.tsx:

/**
 * Where the panes are shown one at a time: a window below this width, or
 * one whose rail, list and detail would leave the main content less than
 * this — a tablet held sideways with a detail open — where the screens,
 * laid out for a phone first and wider by the window's width, would be
 * squeezed into a column narrower than either.
 */
const ARRANGEMENT_BOUNDS = { narrowBelow: 768, contentAtLeast: 480 } as const

The second condition means the breakpoint is not one number. The same window can be wide with the detail closed and narrow with it open. The test spells out the tablet case, in tests/arrangement.test.ts:

  test("is narrow where the panes beside the content would leave it too little, as a tablet held sideways with a detail open", () => {
    expect(arrangementFor(1133, 364, BOUNDS)).toBe("wide")
    expect(arrangementFor(800, 364, BOUNDS)).toBe("narrow")
    expect(arrangementFor(1133, 364 + 450, BOUNDS)).toBe("narrow")
    expect(arrangementFor(1440, 364 + 450, BOUNDS)).toBe("wide")
  })

At 1133 pixels with 364 beside the content, 769 are left: wide. Open a 450-pixel detail and 319 are left, under 480: narrow, and the detail takes the whole screen. At 1440 pixels the same detail leaves 626: still wide.

The window width comes from createArrangement, which listens to resize and reads document.documentElement.clientWidth. The width beside the content is measured by the shell with a ResizeObserver and reported through onBesideContent. That measurement has a loop hidden in it: the input to arrangementFor depends on its output, because in a narrow arrangement each pane is either full screen or display: none. The shell measures only while wide, in GatheringShell.tsx:

/**
 * A pane's width as it last stood in a wide arrangement: measured only
 * there, where it keeps a width of its own, and kept through a narrow one,
 * where it takes the whole screen or none — so that what a wide arrangement
 * would leave the content can still be told while it is narrow.
 */
const createWideWidth = (wide: () => boolean): { readonly width: () => number; readonly watch: (element: HTMLElement) => void } => {
  const [width, setWidth] = createSignal(0)
  const watch = (element: HTMLElement): void => {
    const watched = new ResizeObserver(() => {
      if (wide() && element.offsetWidth > 0) setWidth(element.offsetWidth)
    })
    watched.observe(element)
    onCleanup(() => watched.disconnect())
  }
  return { width, watch }
}

While narrow, the width beside the content stays at what it last was when wide, so the arrangement does not flip back and forth as panes change size underneath it.

The URL decides the place

The shell is told which pane is in focus. P-Lens reads that off the address. The path is parsed into a Place, a discriminated union, and place.ts maps it to a pane:

/** Which pane a narrow window shows for a place. */
export const focusOf = (place: Place): Focus => {
  switch (place.kind) {
    case "live":
    case "huddle":
    case "book":
    case "odd-prize-calculator":
    case "consolidated":
    case "settings":
      return "selection"
    case "tally":
    case "book-file":
    case "passbook":
    case "parlor-passbook":
      return "detail"

The remaining 38 cases return "content". There is no default, so a new kind of place without a case here fails to type-check. A book itself (/books/:book) is the selection screen; one entry (/books/:book/tallies/:play) is the detail; any other screen of a book is the content. PLensScreen passes focus={focusOf(place())} and that is the whole connection:

location.pathname → placeOf → Place → focusOf → Focus → visiblePanes → display

Nothing along that line holds state. Moving one pane forward on a phone is a navigation to a new address, so the phone’s back button, which moves the address back, moves the pane back. Neither the package nor the app listens for popstate to do it; the router does what routers do.

Not every window has a back button, so the app adds one to the header of narrow windows. From ViewHeader.tsx:

/**
 * The title of what is on screen, with a way back up in a narrow window,
 * where the list it was chosen from is not beside it. The hardware back
 * button does the same; this is for the windows without one.
 *
 * A place deeper than one level gives a `trail` instead: the steps that led
 * to it, as a thread shows its channel, each earlier one a way back.
 */

It is shown on line 42 only when narrow and when there is somewhere to go up to; on a wide screen the list it would go back to is already beside it:

      <Show when={arrangement() === "narrow" && parentOf(props.place) !== undefined}>

Pressing it is also a navigation, with one detail in moves.ts:

    up: (here, query) => {
      const parent = parentOf(here)
      if (parent === undefined) return
      const target = hrefOf(parent, query)
      if (cameFrom(location.state) === target) {
        history.back()
        return
      }
      navigate(target, { replace: true })
    },

If the previous history entry is exactly the parent, it goes back instead of pushing. Its doc comment (moves.ts) gives the reason: “so closing a detail and then pressing back leaves the list instead of reopening the detail.” If the detail was opened directly from a link, the current entry is replaced with the list. What disappears with this design is the code that keeps a “current pane” variable in step with history, because there is no such variable. The in-app back button remains, as an ordinary link with an opinion about history.

Hidden panes stay mounted

The Frame inside GatheringShell turns the three booleans into styles. From GatheringShell.tsx:

      <div class="flex min-h-0 flex-1">
        <div ref={selection.watch} class="flex min-w-0" classList={{ "flex-1": narrow(), "shrink-0": !narrow() }} style={{ display: panes().selection ? undefined : "none" }}>
          {props.rail}
          {props.side}
        </div>
        <div class="flex min-w-0 flex-1" style={{ display: panes().content ? undefined : "none" }}>
          {props.children}
        </div>
        <div ref={detail.watch} class="flex min-w-0" classList={{ "flex-1": narrow() }} style={{ display: panes().detail ? undefined : "none" }}>
          {aux()}
        </div>
      </div>

No <Show>: a hidden pane is display: none, not unmounted, so the shell itself never throws away a list’s scroll position. What it cannot promise is that the host keeps the pane’s content. P-Lens wraps its main content in <Show when={screenOf(place())} keyed>, so a change of filter keeps the screen and a change of screen rebuilds it. A host that wants a pane to survive navigation has to avoid rebuilding it too.

The outer div also carries data-arrangement and data-focus, which makes the current state readable in the browser’s element inspector without a debugger.

A context with a default

Panels decide whether to keep their own width or fill the screen by reading the arrangement from context. The context has a default, in context.ts:

const outsideAnyShell: Accessor<Arrangement> = () => "wide"

const ArrangementContext = createContext<Accessor<Arrangement>>(outsideAnyShell)

export const ArrangementProvider = ArrangementContext.Provider

/**
 * The arrangement the enclosing shell is in, for a pane deciding whether it
 * keeps its own width or fills the screen. Outside a shell it is `wide`.
 */
export const useArrangement = (): Accessor<Arrangement> => useContext(ArrangementContext)

That is why GatheringShell is two components. Frame resolves the detail slot with children(() => props.aux) to know whether there is a detail, and in Solid a JSX prop is evaluated where it is read. Read in the component that renders the Provider, the slot runs outside it. The comment on Frame (GatheringShell.tsx) records what that looked like:

/**
 * The frame itself, drawn inside the arrangement it provides: the detail
 * slot is resolved here and not a level up, so a panel in it asks the
 * arrangement of this shell — resolved outside, it found none, took the
 * window for wide and kept its own width on a phone.
 */

No error, correct on a desktop, wrong only on a phone. A context with a sensible default is the kind that works well enough outside its Provider for nobody to notice.

Resizing

In a wide arrangement the side list and the detail can be dragged wider or narrower. The defaults are in panels.tsx: the list starts at 300 pixels and moves between 240 and 440, the detail starts at 450 and moves between 360 and 660. P-Lens passes no width of its own to any panel, so these are the widths in the app. Someone with long book titles widens the list; someone reading raw journal files widens the detail. The handle is rendered only while wide.

The drag lives in resize.ts, with one precaution for touch screens:

/**
 * Hold a width in pixels and change it as a pointer drags the handle.
 *
 * Listeners live on the window only while dragging. A drag the browser cancels
 * is undone: a handle near the screen edge is where a phone's back gesture
 * starts, and the system takes the pointer partway through with
 * `pointercancel`, so what moved was never a drag.
 */

pointerup and pointercancel go to different handlers. pointerup keeps the width; pointercancel first restores the width from before the drag (resize.ts):

    const cancel = (): void => {
      setWanted(before)
      release()
    }

Since handles only exist when wide, this matters on wide touch screens with an edge gesture, such as a tablet held sideways. Swiping back from the edge should not leave the list 40 pixels wider as a souvenir.

The width is kept within bounds by clampSize:

/**
 * Keep a size within its bounds. A minimum above the maximum yields to the
 * maximum, because a pane wider than the window puts its own far edge, and
 * whatever sits on it, out of reach.
 */
export const clampSize = (value: number, min: number, max: number): number =>
  Math.max(Math.min(min, max), Math.min(max, value))

The usual Math.max(min, Math.min(max, value)) returns min when min > max. This returns max. Bounds can be functions (Bound = number | (() => number)), so a maximum derived from the window can drop below the minimum just by narrowing the window; obeying the minimum then would push the pane, and the handle on its far edge, off the screen. The stored value is the wanted width, and the visible width is a createMemo of it clamped, so when the bounds move back, the pane returns to the width that was asked for.

Accessibility details

What the package does, as far as the code shows:

What it does not do: the separator has no tabIndex and no key handler, so resizing is pointer-only. A keyboard user gets the default widths.

The package knows nothing of P-Lens

The package is kept free of the app by a test in the app, boundary.test.ts:

  test("the shell package knows nothing of P-Lens", async () => {
    const files = await sourcesUnder(SHELL)
    const texts = await Promise.all(files.map((file) => readFile(file, "utf8")))
    const domainWords = /pachinko|p-lens|ledger|parlor|\bplayer\b|\bparent\b|\bchild\b|\bboss\b|d.scord|mast.don/i
    expect(files.filter((_, index) => domainWords.test(texts[index] ?? ""))).toEqual([])
    expect((await Promise.all(files.map(importsOf))).flat().filter((name) => !name.startsWith(".") && name !== "solid-js")).toEqual([])
  })

If any of those words appears in the package’s source, or anything other than solid-js is imported, the test fails. The last two words in the list are d.scord and mast.don: the dot matches any character, so the names of the chat apps are caught without being written down, in the test or anywhere else. The package that copies the layout is not allowed to say where it is from. It calls the rail “a rail of spaces” and gets as far as “as a thread shows its channel”. The app’s comments go one step further, “as a server is its initials”, and stop there.

The practical result is that the rules of the layout can be read inside the package. When panes show is in visiblePanes, when the window goes one-at-a-time is in arrangementFor, and there is no place inside the frame to write “hide the rail on this screen of the ledger”.

Tests

The package has seven tests in two files, all on the pure functions: visiblePanes (three), clampSize (two) and arrangementFor (two). For this article the package directory at v0.10.63 was copied to a scratch directory, its source and tests compared with the checkout (identical), and the tests run with Bun 1.4.3:

$ bun test tests
 7 pass
 0 fail
 16 expect() calls
Ran 7 tests across 2 files.

There are no tests for createArrangement, createWideWidth, the pointercancel undo, or Frame resolving the detail slot inside the Provider. For the last two, the comments quoted above are the only guard. Of the 12 combinations of visiblePanes’s inputs, the tests cover 6.

What it does not do

It is not on npm. The package has a package.json with a name, an MIT licence and an exports field, and it is still not published, because nobody has set up to maintain it as a library. It lives in the P-Lens repository and P-Lens refers to it as a workspace package ("solid-gathering-shell": "workspace:*"). P-Lens is the only app that uses it. Being MIT, it can be forked, renamed and published by anyone who wants to take that on.

It ships as TypeScript source. exports points at ./src/index.ts, so the host’s build has to compile Solid’s JSX in .tsx files.

It needs Tailwind and nine theme colours. The README lists seven colours for the host to define (surface-0, surface-1, surface-2, text-primary, border, accent, accent-contrast); the source also uses text-muted in Breadcrumb.tsx and seam in RailBar.tsx and TopBar.tsx. The host’s stylesheet has to let Tailwind scan the package’s source; P-Lens does it with @source "../../../../../packages/solid-gathering-shell/src"; in theme.css.

createArrangement is browser-only. It reads document.documentElement.clientWidth and adds a window listener when called, with no check for a server. P-Lens renders only on the client. A server-rendered host would call arrangementFor itself and pass the result, since the shell only takes the string "wide" or "narrow".

Choosing a book does not reopen the last screen in it. A book on the rail goes to the book itself, and the main content asks you to pick a screen from the list on the left. That is a decision of the app, not the package; the package would show whatever the host routes to.

Resizing is pointer-only, as above.

Summary

All articles