This guide shows how to write an application for a Classicy desktop. It starts with the smallest app that runs, then documents every feature an app can use.
For a flat, machine-oriented dump of the whole public API, see
AGENT-REFERENCE.md. This document is the narrative
version, aimed at a person writing an app for the first time.
Contents
- What an app is
- Hello, world
- The four-file pattern
ClassicyAppreferenceClassicyWindowreference- State: the store, selectors, dispatch
- Manifests:
registerApp - Reducers
- Menus
- Icons
- Files
- Dialogs and alerts
- Balloon help
- Sound
- Analytics
- Extensions, global shortcuts and Control Strip modules
- Persistence
- Testing
- Checklist and known traps
A Classicy app is three things at once:
| Layer | What it is | Where it lives |
|---|---|---|
| Component | A React component that renders <ClassicyApp> and some <ClassicyWindow> children. |
MyApp.tsx |
| Store entry | A record at System.Manager.Applications.apps["MyApp.app"] holding window list, open/focus flags, and a free-form data bag. |
Zustand store |
| Manifest | A registerApp({ … }) call that declares the app's description, its action prefix, its reducer, its actions, and the schema of its data. |
MyAppContext.ts |
You always write the component and the manifest. You write a reducer only when the app needs to keep state that must survive a reload.
An app mounts as a child of <ClassicyDesktop>, which itself mounts inside
<ClassicyAppManagerProvider>:
<ClassicyAppManagerProvider>
<ClassicyDesktop>
<MyApp />
</ClassicyDesktop>
</ClassicyAppManagerProvider>ClassicyDesktop renders your children after the menu bar, the bundled apps,
and the desktop icons. Nothing else is required to make the app appear — mounting
<ClassicyApp> registers the app, adds its desktop icon, and adds it to the
Applications folder.
Import an Appearance Package at your app's entry. The core draws no desktop without one: with none registered,
ClassicyDesktopshows a "No Appearance Package is loaded" message and mounts none of its children, your app included. Addimport '@classicy/appearance-platinum'once, before you render (and in your test setup file, for tests that render a desktop). The entry is in AGENT-REFERENCE §1.
Mount
ClassicyDesktopeagerly. Lazy-loading it so that it mounts a tick afterClassicyAppManagerProvidercorrupts manager state: early dispatches reach a reducer whose state the desktop has not seeded yet, and every later dispatch throws.
Four things: an id, a name, an icon, and a window.
import { ClassicyApp, ClassicyWindow, ClassicyButton } from '@classicy/classicy'
import appIcon from './my-app.png'
export default function MyApp() {
return (
<ClassicyApp id="MyApp.app" name="MyApp" icon={appIcon} defaultWindow="myapp_main">
<ClassicyWindow
id="myapp_main"
appId="MyApp.app"
title="My App"
icon={appIcon}
initialSize={[400, 300]}
initialPosition={["center", "center"]}
>
<ClassicyButton onClickFunc={() => alert('Hi')}>Click me</ClassicyButton>
</ClassicyWindow>
</ClassicyApp>
)
}That app already has: a desktop icon, an Applications-folder entry, an Apple-menu entry, a draggable and resizable window with close/zoom/collapse boxes, window sounds, theming, and persistence of its window position across reloads.
- The id ends in
.app. Every bundled app follows this (Finder.app,SimpleText.app), a test pins it, and"Finder.app"is hard-coded as the menu-bar fallback. - The name is the internal name. It is the app's own name, shown unless
the active Appearance Package says otherwise, and it is load-bearing: Finder
builds the generic action type
`ClassicyApp${app.name}OpenFile`from the stored name, verbatim (an OpenFile your manifest declares is used instead), andClassicyAppbuilds`ClassicyApp${name}CloseFile`from the prop. A name with a space produces an action type with a space in it, which will not match your registered prefix. Prefer a single word forname. - A package may display another name. An Appearance Package can show your
app under another name or icon, by its id (
apps["MyApp.app"]; AGENT-REFERENCE §8, "App display overrides"). Your action types, Finder's OpenFile routing and every store record keep this one; only what is drawn changes. You need do nothing for it, unless your app draws its own name (below) or builds something from a name.
A non-trivial app is normally four files:
src/Applications/MyApp/
├── MyApp.tsx # component: ClassicyApp + windows + menus
├── MyAppContext.ts # reducer + zod schemas + registerApp (module side effect)
├── MyApp.module.scss # styles
└── my-app.png # icon
MyApp.tsx imports MyAppContext.ts for its side effect:
import './MyAppContext' // runs registerApp() at module loadRegister the manifest at module load, not at mount. registerApp must run
as a module side effect. If the module is never pulled into the import graph,
dispatchToPlugin logs No handler registered for prefix and every action for
the app silently falls through.
interface ClassicyAppProps {
id: string
name: string
icon: string
defaultWindow?: string
showDesktopIcon?: boolean
showInApplicationsFolder?: boolean
desktopIconBalloonHelp?: string | ClassicyIconBalloonHelp
noDesktopIcon?: boolean // @deprecated → showDesktopIcon={false}
inApplicationsFolder?: boolean // @deprecated → showInApplicationsFolder
addSystemMenu?: boolean
extension?: boolean
globalShortcuts?: ClassicyGlobalShortcut[]
bootIcon?: boolean | string
debug?: boolean
handlesFileTypes?: ClassicyFileSystemEntryFileType[]
handlesOwnFiles?: boolean
contextMenu?: ClassicyMenuItem[]
children?: ReactNode
}| Prop | Default | Purpose |
|---|---|---|
id |
— | Unique app id. Convention: MyApp.app. |
name |
— | Internal name, and the display name unless a package overrides it. Builds file-open action types — prefer one word. |
icon |
— | Icon URL. Required even for extensions, which never render it. |
| (display overrides) | — | Not a prop: an Appearance Package's apps[id] may show another name, icon and balloon description for your app wherever it is drawn. The props stay the internal identity and the default. Text your app draws that names the app reads useClassicyAppIdentity(id, { name, icon }). |
defaultWindow |
— | Enables focus restore: when the app is focused but none of its open windows is, the most recently focused one is refocused (this window if none has been). |
showDesktopIcon |
true |
Draw an icon on the desktop. |
showInApplicationsFolder |
true |
List the app in the derived Applications folder. Independent of the above. |
desktopIconBalloonHelp |
manifest description |
Balloon help for the desktop icon. A bare string is titled with the name the icon shows. Pass it only for copy of your own: given, it beats a package's description; omitted, the icon shows the package's description, else the manifest's, resolved at render. |
addSystemMenu |
— | Add an Apple-menu entry. Forced off for extensions. |
extension |
false |
Background app: always open, no icon, no focus, no Apple-menu entry. |
globalShortcuts |
— | Honored only when extension is set. |
bootIcon |
— | Show an icon in the startup parade. true uses the app icon; a string uses that icon. |
debug |
false |
Render a JSON-tree debugger window over the app's store entry. |
handlesFileTypes |
— | File types Finder should route to this app. |
handlesOwnFiles |
false |
Suppress the automatic file windows and render your own. |
contextMenu |
— | Right-click menu for every window of this app, unless a window overrides it. |
Children render only when the app is open.
Standard app — desktop icon, Applications entry, its own File menu:
<ClassicyApp
id={appId}
name={appName}
icon={appIcon}
defaultWindow="myapp_main"
addSystemMenu={false}
>Control panel — Apple menu only, no desktop icon:
<ClassicyApp
id={APP_ID}
name={APP_NAME}
icon={appIcon}
defaultWindow={WINDOW_ID}
showDesktopIcon={false}
addSystemMenu={true}
>Background extension — no window, no icon, runs from boot:
<ClassicyApp id={appId} name={appName} icon={appIcon} extension addSystemMenu={false}>On mount, ClassicyApp dispatches, in order:
ClassicyAppLoad— creates or refreshesapps[id], storingcontextMenuand refreshingnameandiconfrom the props (never a package's override).ClassicyDesktopAppMenuAdd/…Remove— peraddSystemMenu.ClassicyDesktopIconAddwithkind: "app_shortcut", orClassicyDesktopIconRemovewhen both icon surfaces are off. (The removal matters: icons persist tolocalStorage, so a stale icon would otherwise survive.)ClassicyBootParadeIconAdd— whenbootIconis set.ClassicyAppRegisterFileTypes— whenhandlesFileTypesis set.ClassicyShortcutRegisterper entry — extensions only.
contextMenu is deliberately excluded from the effect's dependencies, so an
inline array literal does not re-fire the effect.
Every icon ClassicyApp registers has kind app_shortcut, so it renders the
Mac OS 8 alias arrow over its bottom-left corner and italicizes its label. System
kinds (drive, trash, directory, file, icon) get neither.
An Appearance Package can show your app under another name, icon and balloon
copy (apps[id]). The shell does the rest by itself: the desktop icon, the
Applications or Extensions entry, the App Switcher, the Apple menu, the About
box, the startup parade and a Control Strip module you own with appId all
follow the package, with no code in your app.
Your app has work to do only where it draws or builds from its own name:
-
Text that names the app (a window title that is the app name, a proxy icon that is the app icon, an "Open … Control Panel" item) reads the display identity:
const identity = useClassicyAppIdentity(appId, { name: appName, icon: appIcon }) <ClassicyWindow title={identity.name} icon={identity.icon} /* … */ />
Pass the internal
appName/appIconeverywhere else:ClassicyApp,useClassicyAboutMenu,quitMenuItemHelper,ClassicyAppOpenpayloads. -
Action types, paths and lookups never use a displayed name. Write your action types as literals (
"ClassicyAppMyAppCloseFile"), not`ClassicyApp${appName}CloseFile`. -
Your About item keeps the id
useClassicyAboutMenugives it,${appId}_about, and a title in the internal name: its plain "About", or`About ${appName}`when you retitle it (stored menus never hold a display name). A window's own menu bar retitles the item "About " only when it finds${appId}_abouttitled`About ${appName}`; another id, or other wording, is drawn as stored. The screen menu bar always titles the hoisted Apple-menu copy "About ".
Every prop, with its default:
| Prop | Type | Default | Purpose |
|---|---|---|---|
id |
string |
— | Window id, unique across the whole store. |
appId |
string |
— | Owning app id. |
title |
string |
"" |
Title-bar text. Sent to analytics verbatim. |
icon |
string |
file icon | Title-bar icon. |
hideIcon |
boolean |
false |
Hide the title-bar icon. |
hidden |
boolean |
false |
Render but do not show. |
closable |
boolean |
true |
Draw the close box. |
zoomable |
boolean |
true |
Draw the zoom box. |
collapsable |
boolean |
true |
Draw the collapse (windowshade) box. |
resizable |
boolean |
true |
Draw the grow box. |
scrollable |
boolean |
true |
Give the content region scroll bars (always both, Mac OS 8 style). Pass false when the content scrolls itself — a full-window <textarea>, a ClassicySplitView, a pan surface — or it gets a second set of bars. |
growable |
boolean |
— | Let content drive the window size. |
modal |
boolean |
false |
Modal dialog. Destroyed on unmount, so each open takes focus. |
defaultWindow |
boolean |
false |
Mark this as the app's default window. |
initialSize |
[dim, dim] |
[350, 0] |
number, "50%", or 0 for auto. |
initialPosition |
[x, y] |
[110, 110] |
number, or "left"/"center"/"right" and "top"/"center"/"bottom". |
minimumSize |
[dim, dim] |
[300, 0] |
Resize floor. |
header |
ReactNode |
— | Fixed header strip above the content region. |
headerVariant |
"standard" | "list" |
"standard" |
"list" drops the header's bottom separator. |
placard |
ReactNode |
— | Status region at the bottom-left, left of the horizontal scroll bar. |
appMenu |
ClassicyMenuItem[] |
— | Menu bar published when this window is focused. Memoize it. |
contextMenu |
ClassicyMenuItem[] |
app's menu | Right-click menu for this window. |
windowType |
"document" | "utility" |
"document" |
"utility" renders a tool-palette crosshatch drag region. |
alwaysOnTop |
boolean |
false |
Utility only. Float above every app's windows. |
zoomMode |
"full" | "horizontal" | "vertical" |
"full" |
Which axes the zoom box affects. |
contentFrame |
boolean |
false |
2px active/inactive frame — marks a modeless dialog. |
backgroundColor |
string |
theme | Any CSS color, including var(--…). |
dimContents |
boolean |
true |
Dim contents when the window is inactive. |
analyticsPath |
string |
derived | Override the generated pageview path. |
analyticsExclude |
boolean |
— | Emit no pageview at all. |
initialFocusRef |
RefObject<HTMLElement | null> |
— | Element focused when the window becomes the focused window (unless focus is already inside it), so its keyboard navigation works without a click. A modal's focus trap starts there instead. |
onCloseFunc |
(id) => void |
— | Runs after a close is allowed. |
onBeforeClose |
(id) => boolean | Promise<boolean> |
— | Close veto. Return false to cancel. |
type |
string |
"default" |
Free-form class hook. |
initialSize={[400, 300]} // fixed
initialSize={["75%", "75%"]} // proportional to the viewport
initialSize={["45%", 0]} // proportional width, height from content
initialSize={[0, 0]} // both from content (tool palettes)
initialPosition={["center", "center"]}Persisted windows are re-clamped to the viewport on load, so a window saved off the edge of a large screen comes back on a small one.
onBeforeClose runs before onCloseFunc, before the close sound, before the
analytics event, and before the ClassicyWindowClose dispatch. None of those
fire when the veto cancels. The callback may return a promise, so an app can
show a save-changes alert and then decide:
<ClassicyWindow
id={winId}
appId={appId}
onBeforeClose={async () => {
if (!dirty) return true
return await confirmDiscard() // your own alert
}}
>Windows stack by when they were last opened or focused, and focus follows the same history, so a dialog an app shows and hides needs no focus bookkeeping:
- Opening a window brings it to the front. That applies to a brand-new window and to one reopened after being closed earlier in the session, whether it was closed with its close box or by the app no longer rendering it. A persisted window re-registering after a page reload does not steal focus.
- Unmounting a window closes it. A non-modal window the app stops rendering (e.g. a Settings dialog's Cancel button) is marked closed, exactly as if its close box had been clicked.
- Closing a window refocuses the one focused before it. Focus passes to the app's most recently focused open window (utility palettes excluded).
To raise a window that is already open but sitting behind others, for example
when its menu command is chosen again, dispatch ClassicyWindowFocus for it.
That is safe in the same click that first renders the window.
ClassicyWindowFocus does not clear a window's closed flag, so focusing a
closed window does nothing visible. Open, then focus:
dispatch({ type: "ClassicyWindowOpen", app: { id: appId }, window: { id: windowId } })
dispatch({ type: "ClassicyWindowFocus", app: { id: appId }, window: { id: windowId } })If a component that renders a window is itself rendered more than once, derive the window id from the instance. A shared id lets two instances collide in the store, and the first to unmount destroys the other's entry.
id={`myapp_rename_${documentId}`} // not "myapp_rename"The store is Zustand. The app slice is System.Manager.Applications — not
.App.
interface ClassicyStoreSystemApp {
id: string
name: string
icon: string
windows: ClassicyStoreSystemAppWindows // Record<windowId, window>
open: boolean
data?: Record<string, unknown> // your app's state lives here
focused?: boolean
lastFocusedAt?: number
lastAccessedWindowId?: string
extension?: boolean
debug?: boolean
appMenu?: ClassicyMenuItem[]
contextMenu?: ClassicyMenuItem[]
handlesFileTypes?: ClassicyFileSystemEntryFileType[]
}Always read through a selector. Selecting the whole app record makes the component re-render on every window interaction.
// whole record — use only when you genuinely need windows + data + flags
const appState = useAppManager((s) => s.System.Manager.Applications.apps[appId])
// just the data bag
const appData = useAppManager((s) => s.System.Manager.Applications.apps[appId]?.data)
// a boolean — cheapest, and stable across unrelated store writes
const isOpen = useAppManager((s) => s.System.Manager.Applications.apps[appId]?.open ?? false)
// "is running" for an extension, which has no windows
const isRunning = useAppManager((s) => appId in (s.System.Manager.Applications.apps ?? {}))Other useful slices:
useAppManager((s) => s.System.Manager.Applications.focusedAppId === appId)
useAppManager((s) => s.System.Manager.DateAndTime.dateTime)
useAppManager((s) => s.System.Manager.Appearance.activeTheme.measurements.window.paddingSize)
useAppManager((s) => s.System.Manager.Desktop.disableBalloonHelp)Outside React, read imperatively with useAppManager.getState().
apps[id].windows is a record keyed by window id
(ClassicyStoreSystemAppWindows = Record<string, ClassicyStoreSystemAppWindow>;
each entry's id equals its key). Go through the helpers rather than indexing
it yourself — they accept a missing app, so a selector can pass
apps[appId] straight in:
import { getAppWindow, listAppWindows } from "@classicy/classicy"
// one window's flag — a primitive, so the component re-renders only when it changes
const inspectorOpen = useAppManager((s) =>
getAppWindow(s.System.Manager.Applications.apps[appId], "myapp_inspector")?.closed === false,
)
// any open window?
const anyOpen = useAppManager((s) =>
listAppWindows(s.System.Manager.Applications.apps[appId]).some((w) => !w.closed),
)| Helper | Does |
|---|---|
getAppWindow(app, id) |
the window, or undefined |
listAppWindows(app) |
a fresh array of every window (insertion order) |
hasAppWindow(app, id) |
membership |
countAppWindows(app) |
number of registered windows, open or closed |
setAppWindow(app, window) |
insert or replace by window.id (reducers only) |
removeAppWindow(app, id) |
delete; returns whether it existed (reducers only) |
updateAppWindow(app, id, patch | (w) => void) |
merge a patch or run a mutator (reducers only) |
mostRecentAppWindow(windows) |
highest zOrder of a list |
The write helpers mutate, so call them on the immer draft inside your event
handler. Decide on window data (zOrder, default, closed), never on list
position: JavaScript lists integer-like keys ("2") before all others.
const dispatch = useAppManagerDispatch()
dispatch({ type: "ClassicyAppMyAppSetMode", mode: "grid" })useAppManagerDispatch() returns a module-level function, so it is referentially
stable and safe in dependency arrays. Outside React, import dispatch directly
from @classicy/classicy.
Dispatch takes an optional second argument, the trust level
("trusted" by default). See
AGENT-REFERENCE §6
for the untrusted-action rules.
Export action creators next to the reducer. They keep action types in one place and give the call site a typed signature.
export const myAppSetMode = (mode: string): ActionMessage =>
({ type: "ClassicyAppMyAppSetMode", mode })To let one app drive another (a remote control, a deep link), do not dispatch a
transient event — the receiving app may not be mounted yet. Write a command with
a monotonic sequence number into data, and have the receiver run it once per
new seq:
const nextSeq = (d: Record<string, unknown>) =>
((d.command as MyCommand | undefined)?.seq ?? 0) + 1
case "ClassicyAppMyAppTune":
apps[appId].data = {
...appData,
command: { seq: nextSeq(appData), kind: "tune", station: action.station },
}
return dsOne call declares everything the rest of the system needs to know about the app.
registerApp({
id: "MyApp.app",
description: "One sentence saying what this app is for.",
prefix: "ClassicyAppMyApp",
handler: classicyMyAppEventHandler,
actions: { /* … */ },
state: MyAppDataSchema,
})| Field | Required | Purpose |
|---|---|---|
id |
yes | The app id. |
description |
yes | Human sentence. Becomes the desktop icon's balloon help by default, and feeds every discovery surface. |
prefix |
with handler |
Action-type prefix routed to handler. |
handler |
with prefix |
The reducer. |
actions |
no | Per-type { description, params?, scriptable? }. |
state |
no | Zod schema of apps[id].data. Must be z.looseObject. |
Declaring prefix without handler (or the reverse) logs a dev warning and
registers no routing.
An app with no reducer still registers a manifest. The description is the balloon help for its desktop icon, and there is no other place to put it:
import { registerApp } from '@classicy/classicy'
registerApp({
id: "MarketWatch.app",
description: "Follow stock, index and bond markets.",
})actions: {
ClassicyAppMyAppSetMode: {
description: "Switch between list and grid presentation.",
params: z.object({
mode: z.enum(["list", "grid"]).describe("Presentation mode."),
}),
},
ClassicyAppMyAppReset: {
description: "Return every setting to its default.",
},
}paramsis a zod schema for everything excepttype. It is optional — an action with no payload just omits it..describe()on each field is what makes the action self-documenting.scriptable: trueexposes the action to HyperCard stack scripts. It delegates to the untrusted-action allowlist and can never grant access past the kernel's guarded-route floor.
export const MyAppDataSchema = z.looseObject({
mode: z.enum(["list", "grid"]).optional().describe("Presentation mode."),
selected: z.array(z.string()).optional().describe("Selected item ids."),
})
export type MyAppData = z.infer<typeof MyAppDataSchema>Two hard rules:
z.looseObject, neverz.object. The kernel writes undeclared keys intodata— theopenFilesqueue, for one — and a strict schema would reject legitimate state.- Every top-level field
.optional().datais legitimately empty before the app's first action.
In development, every dispatch runs the owning app's data through its schema and logs a warning on failure. It is warn-only: state is never rejected or rolled back.
getAppManifest(appId) // the merged manifest, or undefined
listAppManifests() // every registered manifest
listScriptableActions() // every script-exposed action
getScriptableAction(type)
describeAppAction(appId, type) // → { title, content }, balloon-ready
describeAppState(appId, "settings.skip") // dot-path into the state schema
parseAppData<MyAppData>(appId, raw) // typed guard; undefined on failureparseAppData replaces hand-rolled isMyAppData() functions:
const data = parseAppData<MyAppData>(appId, appState?.data) ?? {}Re-registering the same id merges additively: a new prefix and handler are
appended, the same prefix twice is a no-op, actions merge first-wins, and the
first state schema wins. This is how one app can span two modules.
The prefix trap. Classicy routes an action to exactly one handler — the first registered prefix that
action.type.startsWith(). If module A registersClassicyAppPlaylistand module B registersClassicyAppPlaylistEditor, everyClassicyAppPlaylistEditor…action goes to A's handler, because A's prefix is a prefix of B's. Registering the same prefix twice does not help either: the registry keeps the first and drops the second without complaint. Pick prefixes that are not prefixes of each other, and add a test:it("registers no prefix that is a prefix of another", () => { const overlaps = prefixes.flatMap((a) => prefixes.filter((b) => b !== a && b.startsWith(a)).map((b) => `${a} swallows ${b}`)) expect(overlaps).toEqual([]) })
When one app spans two modules, only the primary module declares state:
// flightTrackerCommands.ts — secondary module
registerApp({
id: "FlightTracker.app",
description: "…",
prefix: "ClassicyAppFlightRemote",
handler: flightRemoteHandler,
actions: { /* … */ },
// State schema intentionally omitted: flightMapSettings.ts is the primary
// module and its schema covers this data. First state schema wins.
})registerAppEventHandler and registerClassicyUntrustedActionAllowlist still
work but are deprecated. Use registerApp.
A reducer takes the store and an action and returns the store. It runs inside Immer, so mutate the draft in place.
import type { ActionMessage, ClassicyStore } from '@classicy/classicy'
export const classicyMyAppEventHandler = (ds: ClassicyStore, action: ActionMessage) => {
const apps = ds.System.Manager.Applications.apps
if (!apps[appId]) return ds
const appData = apps[appId].data ?? {}
switch (action.type) {
case "ClassicyAppMyAppSetMode":
apps[appId].data = { ...appData, mode: action.mode }
return ds
case "ClassicyAppMyAppReset":
apps[appId].data = {}
return ds
default:
return ds
}
}Notes:
- Return
dsfrom every branch, includingdefault. A reducer that returns nothing wipes the store. - Guard on the app existing. The reducer can run before the component mounts.
A reducer that must work before mount can call
loadApp(ds, id, name, icon)itself — that is what the bundled Picture Viewer does. - A reducer may write into another app's
data. That is a legitimate way to build a cross-app bridge; just omitstatefrom that manifest, since the handler does not own its own app's data.
classicyDesktopStateEventReducer routes by prefix, in this order:
- Trust gate (untrusted actions are filtered here)
ClassicyWindow*ClassicyDesktopIcon*ClassicyDesktop*ClassicyBootParadeIcon*ClassicyManagerDateTime*ClassicyShortcut*- First registered plugin prefix that the type starts with — your reducer
- The generic
ClassicyApp*handler (app open/close/focus, and the…OpenFile/…CloseFilefallbacks) - A
Unhandled action typewarning
Menu items are plain data, not components.
interface ClassicyMenuItem {
id: string
title?: string
image?: string
icon?: string
disabled?: boolean
checked?: boolean // renders ✓ in the left gutter
keyboardShortcut?: string
nativeShortcut?: boolean // browser handles it; do not intercept
titleWidthSamples?: string[] // reserve width for a title that changes
link?: string
event?: string
eventData?: Record<string, unknown>
onClickFunc?: () => void
menuChildren?: ClassicyMenuItem[]
className?: string
part?: string // rendered as data-classicy-part, for theme packages
balloon?: { title?: string; content: string; position?: ClassicyBalloonPosition }
}{ id: "spacer" } is the separator.
const appMenu = useMemo(() => [{
id: `${appId}_file`,
title: "File",
menuChildren: [
{ ...aboutMenuItem, title: `About ${appName}` },
{ id: "spacer" },
{
id: `${appId}_save`,
title: "Save",
keyboardShortcut: "S",
disabled: !dirty,
onClickFunc: save,
},
{
id: `${appId}_status`,
title: "Status",
menuChildren: [
{ id: "st_draft", title: "Draft", checked: status === "draft",
onClickFunc: () => setStatus("draft") },
{ id: "st_pub", title: "Published", checked: status === "published",
onClickFunc: () => setStatus("published") },
],
},
{ id: "spacer" },
quitMenuItemHelper(appId, appName, appIcon),
],
}], [aboutMenuItem, dirty, status])
<ClassicyWindow appMenu={appMenu} /* … */ >Memoize
appMenu.ClassicyWindowwrites it to the store behind a structural signature guard. An inline array literal defeats the guard and has previously caused render loops. The same applies tocontextMenuand help-menu arrays.
Omitting
appMenudoes not clear the menu bar. The focus reducer falls back to the window's storedmenuBar. A window that should have no app menu must pass an explicit empty structure, not nothing.
quitAppHelper(appId, appName, appIcon) // → ActionMessage
quitMenuItemHelper(appId, appName, appIcon) // → ClassicyMenuItem
closeWindowMenuItemHelper(id, onClickFunc)
closeAllWindowsMenuItemHelper(id, onClickFunc)useClassicyAboutMenu(appId, appName, appIcon) // → { aboutMenuItem, aboutWindow }
useClassicyWindowClose(appId) // → (windowId, appCleanupAction) => void
useClassicyHelpMenu(appId, items) // items MUST be memoized
useClassicyEditMenu(idPrefix) // → a standard Edit menu itemuseClassicyAboutMenu returns both a menu item and the window that renders it.
Put the item in your File menu and render aboutWindow as a ClassicyApp child:
const { aboutMenuItem, aboutWindow } = useClassicyAboutMenu(appId, appName, appIcon)
// …
<ClassicyApp /* … */>
<ClassicyWindow appMenu={appMenu} /* … */>{/* … */}</ClassicyWindow>
{aboutWindow}
</ClassicyApp>ClassicyDesktopMenuBar hoists the About entry into the Apple menu and strips it
from your File menu before rendering, so listing it in File is correct. Keep the
item's id, ${appId}_about: it is how both menu bars find it and title it with
a package's display name (§4, "Display overrides: what your app must do").
Menu items are data, so balloon help rides along as the balloon field rather
than a <ClassicyBalloonHelp> wrapper. Wrappers are for JSX controls.
{
id: `${appId}_copy_link`,
title: "Copy Link",
disabled: status !== "published",
balloon: { title: "Copy Link", content: "Publish the document first." },
onClickFunc: copyLink,
}Layer help onto a helper-built item by spreading it:
const quitMenuItem = {
...quitMenuItemHelper(appId, appName, appIcon),
balloon: { title: "Quit", content: `Close ${appName}.` },
}Right-click menus resolve innermost-first:
ClassicyContextualMenuTarget → window contextMenu → app contextMenu →
desktop default (empty desktop only).
<ClassicyContextualMenuTarget menuItems={[{ id: "copy", title: "Copy" }]}>
<ClassicyButton>Copy</ClassicyButton>
</ClassicyContextualMenuTarget>Every layer checks e.defaultPrevented, so a control with its own right-click
behavior calls e.preventDefault() and stays silent. Right-clicking a window
focuses it first, so the menu always tracks focus.
To open a menu at an arbitrary point yourself:
<ClassicyContextualMenu
name="myapp_dropdown"
position={[x, y]}
menuItems={items}
onClose={close}
/>Put an icon in the right-hand menu-bar tray:
<ClassicyMenuBarExtension id="myapp_menu" order={1} title={appName} menuItems={items}>
<img src={appIcon} alt={appName} />
</ClassicyMenuBarExtension>Props: id, order (default 0), icon, title, menuItems, onClick,
children.
Register icons once, at module scope, before anything renders.
import { registerClassicyIcons, useClassicyAsset } from '@classicy/classicy'
import appIconPng from './my-app.png'
// Registration deep-merges, so this keeps the bundled app icons (and other
// apps' registrations) intact; no spreading of existing namespaces needed.
registerClassicyIcons({
applications: {
myApp: { app: appIconPng, doc: docPng },
},
})
// In a component, read it at render time so it follows the active package:
const appIcon = useClassicyAsset('icons', 'applications.myApp.app') ?? ''Outside a component, read at call time with
resolveClassicyAsset('icons', 'applications.myApp.app'). Don't capture an icon
in a module-scope constant; a later registration or appearance-package switch
would not reach it.
Bundled icons are read the same way, by dotted path (the ClassicyIcons
constant is only the tree Platinum ships and misses later registrations):
useClassicyAsset('icons', 'system.files.document')
useClassicyAsset('icons', 'system.folders.directory')
useClassicyAsset('icons', 'system.drives.disk')
useClassicyAsset('icons', 'system.macos')An Appearance Package can also replace your app's icon by id
(apps["MyApp.app"].icon), separately from the icon registry: the registry
swaps the art behind a key for every user of that key, while apps[id].icon
changes only how your app is shown, wherever its icon is drawn. Your icon
prop stays the app's own icon in the store.
Override the alias-badge artwork with registerClassicySystemArt("platinum", { aliasBadge }). Cursors, wallpapers, fonts and the rest of the system art register the same way; see AGENT-REFERENCE §5 (Asset registries).
Declare the types you handle:
<ClassicyApp
id={appId}
name="MyApp"
icon={appIcon}
handlesFileTypes={[ClassicyFileSystemEntryFileType.Markdown]}
>When the user opens a matching file, Finder hands it to your app. If your
manifest declares <prefix>OpenFile in actions (§7), your reducer's own case
receives { type, app: { id }, path }, reduced by the kernel under the trust
Finder's own action arrived with.
Otherwise Finder builds `ClassicyApp${name}OpenFile` and the generic
handler appends the path to apps[id].data.openFiles and opens the app. name
here is always the internal name (the record's), never a package's display
name, so the type does not change with the Appearance Package.
By default ClassicyApp then renders one plain window per queued path. To render
your own windows instead, set handlesOwnFiles and read the queue:
<ClassicyApp id={appId} name="MyApp" icon={appIcon} handlesOwnFiles={true}>
{openFiles.map((path, idx) => (
<ClassicyWindow
key={`${appId}_file_${path}`}
id={`${appId}_file_${path}`}
appId={appId}
title={path.split(":").pop() || path}
onCloseFunc={() => dispatch({
type: `ClassicyAppMyAppCloseFile`, app: { id: appId }, path,
})}
>
{/* your renderer */}
</ClassicyWindow>
))}
</ClassicyApp>Keep the `${appId}_file_${filePath}` id convention. Window ids containing a
filesystem separator (: or /) collapse to /file in analytics, which is what
keeps user file names out of pageview paths.
const fs = useClassicyFileSystem() // default key "classicyStorage", separator ":"Paths use colons: "Macintosh HD:Documents:Read Me".
Every ClassicyFileSystem for a storage key shares one live tree. A change made
through any of them — your app's writeFile, a Finder drag, a Save dialog's New
Folder — is visible at once through all of them, and useClassicyFileSystem
re-renders its component with a fresh fs (subscribed via
subscribeClassicyFileSystem), so anything memoized on fs re-reads the tree.
In an event handler that should not re-render on every change, use
useClassicyFileSystemAccessor(), which returns a stable () => fs.
| Method | Purpose |
|---|---|
readFile(path) |
Contents, or undefined. |
writeFile(path, data, metadata?) |
Returns false on a rejected path. |
mkDir(path) / rmDir(path) |
Create / remove a folder. |
move(path, toFolderPath, { name?, metadata? }) |
Move a file or folder into another folder or drive (optionally renaming it and patching metadata in the same journaled move). Returns { ok: true, path } (the new path) or { ok: false, reason }: missing, not-a-folder, same-folder, into-itself, locked (drives, _system and read-only items or folders), exists (name clash — nothing is replaced). |
setMetadata(path, patch) |
The only way to change metadata. Returns false if the path does not resolve. |
resolve(path) |
The entry. Returns undefined on a miss despite its declared type. |
statFile(path) / statDir(path) |
Async entry info. |
size(path) / calculateSizeDir(path) |
Async byte counts. |
hash(path) |
Content hash. |
filterByType(path, types, showInvisible, notCreatedAfter) |
Filtered listing. |
countVisibleFiles(path) / countInvisibleFilesInDir(path) |
Counts. |
formatSize(bytes, measure, decimals) |
Human-readable size. |
snapshot() / load(json) / persist() |
Whole-tree serialization. |
flushNow() / flushNowAsync() |
Force a write. |
buildSnapshot() / reconcileWithAdapters() |
Sync-adapter plumbing. |
Never mutate fs.fs or an entry directly. Every mutation must flow through
these methods, or sync adapters will not see it. writeFile and mkDir reject
any path containing __proto__, constructor, or prototype.
<ClassicyAppManagerProvider
defaultFileSystem={{
"Macintosh HD": {
_type: "drive",
_icon: ClassicyIcons.system.drives.disk,
Documents: {
_type: "directory",
"Read Me.txt": { _type: "text_file", _mimeType: "text/plain", _data: "Hi" },
},
},
}}
defaultFileSystemMode="exclusive" // or "merge" (default)
>"merge" deep-merges onto the library's default tree; "exclusive" replaces it.
Both are seed-only — they apply when nothing is stored under
localStorage["classicyStorage"]. defaultFileSystemSeedMigrations applies
one-time corrections to a returning visitor's persisted tree. The live
tree is a deep copy of the seed, so your defaultFileSystem object (and the
library's DefaultFSContent) is never changed.
registerClassicyFileSystemAdapter({
id: 'my-backend',
onChange: (entry) => {}, // journal mode: every mutation, sequenced
onSnapshot: (snapshot) => {}, // snapshot mode: debounced tree + sha256
reconcile: async (local) => ({ action: 'useLocal' }), // or { action: 'replace', tree }
}, { snapshotDebounceMs: 500 })All methods are optional. Errors always degrade to local-wins. Journal ops are
write, mkdir, rmdir, meta, load and move (the old path in path, the
new one in to; metadata it set in metadata, keys it removed in
unsetMetadata). Derived folders (Applications, Extensions, Control Strip
Modules) are applied through applyDerivedTree() and never journal; their
entries are left out of every snapshot and the localStorage write. Their names
can follow an Appearance Package's display names: an entry never overwrites a
static file of the same name, and takes " ()" instead
(AGENT-REFERENCE §8, "App display overrides").
An alert contains only an icon, text, and buttons. Anything with a text field or a control is a window, not an alert.
<ClassicyAlert
id="myapp_confirm"
appId={appId}
alertType="caution" // "note" | "caution" | "stop"
title="My App"
label="Discard changes?"
message="Your edits will be lost."
buttons={[
{ id: "cancel", label: "Cancel", role: "cancel", onClick: keep },
{ id: "discard", label: "Discard", role: "default", onClick: discard },
]}
defaultButtonId="cancel"
movable={false}
onClose={close}
/>Button roles: default (Return triggers it, gets the ring), cancel
(Escape / Command-period), help (far left), normal. Omit buttons and a
sensible set is generated from alertType.
onClosefires after every button, in addition to that button's ownonClick. A handler pair that undoes itself is a real failure mode here.
const volumes = useMemo(() => [desktopVolume(fs), fileSystemVolume(fs, "Macintosh HD")], [fs])
<ClassicyFileOpenDialog
id="myapp_open"
appId={appId}
open={dialogOpen}
title="Open"
volumes={volumes}
selectionMode="single" // or "multi"
fileTypeFilters={[{ label: "Text", types: ["text_file", "markdown"] }]}
onOpenFunc={handleOpen}
onCancelFunc={() => setDialogOpen(false)}
/><ClassicyForm layout="dialog" onSubmitFunc={submit}>
<ClassicyInput id="title" labelTitle="Title" labelPosition="left"
prefillValue={title} onChangeFunc={(e) => setTitle(e.target.value)} />
<ClassicyFormButtonRow>
<ClassicyButton onClickFunc={cancel}>Cancel</ClassicyButton>
<ClassicyButton buttonType="submit" isDefault disabled={!title}>OK</ClassicyButton>
</ClassicyFormButtonRow>
</ClassicyForm>Submitting never navigates.
Wrap any element:
<ClassicyBalloonHelp content="Click to open" title="Open File" position="top-left">
<ClassicyButton>Open</ClassicyButton>
</ClassicyBalloonHelp>position is one of top-left | top-center | top-right | bottom-left | bottom-center | bottom-right (default top-left); delay is the hover delay in
ms (default 600). The balloon renders through a portal into #classicyDesktop,
so no parent can clip it.
The wrapper is position: relative; display: inline-block. When that breaks the
layout — an absolutely positioned element, for one — use the hook instead, which
adds no DOM:
const { handlers, balloon } = useClassicyBalloonHelp(anchorRef, { content: "…" })
return <div ref={anchorRef} {...handlers}>{children}{balloon}</div>Balloon help is globally switchable with
dispatch({ type: 'ClassicyDesktopSetBalloonHelp', disableBalloonHelp: true }).
For the app's desktop icon, do nothing: the manifest description is the balloon.
Route sound through the dispatcher, not a raw Audio element. The dispatcher
honors the Sound control panel's volume, the global mute, and the per-sound
disable list.
import { ClassicySoundActionTypes, useSoundDispatch } from '@classicy/classicy'
const player = useSoundDispatch()
player({ type: ClassicySoundActionTypes.ClassicySoundPlay, sound: "ClassicyBeep" })ClassicySoundPlay is skipped when something is already playing;
ClassicySoundPlayInterrupt stops the current sound first. sound is a sprite
key from the active sound pack.
For the user's chosen alert sound, use useClassicyAlertSound(), which returns a
zero-argument function.
const { track, page } = useClassicyAnalytics()
track('document_saved', { size })Both functions are referentially stable and become silent no-ops without an
AnalyticsProvider. Event names get the eventPrefix (default classicy_);
pageview paths do not.
ClassicyWindow emits a pageview when a window becomes open and when an open
window gains focus. Paths are derived as /<app>/<window>. A window id
containing : or / collapses to /file or /folder, because those are
assumed to be user data.
That collapse is syntactic. If your app builds a window id from user or
consumer data with no separator in it, pass analyticsPath explicitly — only the
app knows a segment is user data. Build it with the helper so the app segment
stays in sync:
<ClassicyWindow analyticsPath={classicyWindowPagePath(appId, "document")} />
<ClassicyWindow analyticsExclude />The window title is sent verbatim, user file names included. That is a deliberate trade for readable content reports; the path is what stays clean.
An extension is a background app: always open, no desktop icon, no Applications entry, no Apple-menu entry, never focused, usually no window. Use one for a bridge, a listener, or a poller.
<ClassicyApp id="MyBridge.app" name="MyBridge" icon={appIcon} extension addSystemMenu={false}>
{/* usually nothing, or an alert */}
</ClassicyApp>icon is still required even though nothing renders it. Reuse a bundled icon
rather than shipping an asset that is never shown.
Select on a boolean for an extension. The full apps[appId] object changes
reference on unrelated window interactions, and an extension has no windows to
care about:
const isRunning = useAppManager((s) => appId in (s.System.Manager.Applications.apps ?? {}))Global keyboard shortcuts are honored only for extensions:
<ClassicyApp
id="MyBridge.app" name="MyBridge" icon={appIcon} extension
globalShortcuts={[
{ shortcut: "⌘⇧K", event: "ClassicyAppMyBridgeToggle", eventData: { source: "key" } },
]}
>Each is canonicalized and registered on mount (first registrant wins) and unregistered on unmount.
An app or extension adds a button to the Control Strip (HIGOS8 Figure 6-15)
with registerClassicyControlStripModule. Call it once, at module scope,
next to your registerApp call:
import {
classicyControlStripOpenControlPanelItem,
registerClassicyControlStripModule,
useAppManager,
useAppManagerDispatch,
} from '@classicy/classicy'
registerClassicyControlStripModule({
id: 'com.example.vpn',
appId: 'MyBridge.app', // shows only while <ClassicyApp id="MyBridge.app"> is mounted
label: 'VPN', // accessible name, and its name in the control panel
icon: vpnIcon16, // 16 × 16; or a hook returning one
fileIcon: vpnIcon32, // its file in System Folder:Control Strip Modules
order: 50, // lower first; default 100 (after the built-ins)
menuItems: () => { // a hook: runs inside the providers
const connected = useAppManager((s) => s.System.Manager.Applications.apps['MyBridge.app']?.data?.connected === true)
const dispatch = useAppManagerDispatch()
return [
{ id: 'vpn-status', title: connected ? 'Connected' : 'Not Connected', disabled: true, className: 'classicyControlStripStatus' },
{ id: 'spacer' },
{ id: 'vpn-toggle', title: connected ? 'Disconnect' : 'Connect', event: 'ClassicyAppMyBridgeToggle' },
{ id: 'spacer' },
classicyControlStripOpenControlPanelItem(dispatch, 'VPN', { id: 'VPNPanel.app', name: 'VPN', icon: panelIcon }),
]
},
})- A menu or a surface.
menuItems(an array, or a hook returning one) pops up a menu; a disabled item with classclassicyControlStripStatusis the italic status line.content(a component) pops up anything else — the Sound module's slider is one.contentis ignored whenmenuItemsis set. - Hooks. Each module renders as its own component, so the function forms of
iconandmenuItems, andcontent, may call hooks. Keep their hook calls unconditional. - Ownership. With an
appId, the module shows (and its file is listed) only while aClassicyAppwith that id is mounted. That is runtime presence (useClassicyMountedApps), not the persistedapps[id]record. Without anappId, it shows while registered. - Re-registering. The same
appIdreplaces the module in place; a differentappIdis ignored with a warning.unregisterClassicyControlStripModule(id)removes one. The strip updates live either way. - Always shown unless turned off. Built-in and registered modules always
show. The host turns one off with
<ClassicyDesktop controlStrip={{ disabledModules: [CLASSICY_CONTROL_STRIP_MODULE_IDS.sound] }} />(it is then neither drawn nor offered to the user); the user hides one, or reorders them, in the Control Strip control panel. - HIG p.125. A module that belongs to a control panel includes an
"Open … Control Panel" command (
classicyControlStripOpenControlPanelItem). Name the panel withuseClassicyAppIdentity(panelId, { name, icon }).nameinside themenuItemshook, as the Screen Saver module does, so a package that renames the panel renames the command; keep the internal identity in theappargument, which is what opens it. - Display names. A module with an
appIdis shown by that app's display name (the button's accessible name, the control panel and its file) when an Appearance Package renames the app; otherwise, and with noappId, by itslabel. - Anywhere on screen. The user can Control-drag the strip's collapse box
to dock it on the left or right edge at any height, so don't assume it sits
at the lower left: a module's menu or
contentopens beside the module and flips to whichever side has room. - Every installed module is listed as a read-only file in
Macintosh HD:System Folder:Control Strip Modules.
The store is written to localStorage["classicyDesktopState"], debounced 500 ms,
on every change. The file system is written to localStorage["classicyStorage"].
Consequences for an app author:
- Everything under
apps[id].datamust survive a JSON round-trip. No functions, no class instances, noDateobjects. The same applies to desktop icon records. - Menu
onClickFunchandlers do not survive persistence. That is whyloadAppoverwritescontextMenuon every remount. - Session-only or sensitive data needs stripping.
sanitizeStateForPersistenceis the single place that knows which keys to drop before the write. There is no per-app opt-out hook — if your app stores ephemeral or private data underapps[id].data, that function has to learn about it. - Persisted state beats
defaultState. To reset during development, clearlocalStorage["classicyDesktopState"]— or drag the desktop's Trash icon, which does exactly that and reloads. - Old saved state is migrated on load.
migrateClassicyStateruns on the loaded state after it is merged over the defaults, and on everymergeClassicyStateresult (so adefaultStatewritten for 0.x is converted too). It detects old shapes rather than reading a version number, so it is idempotent. Today it converts 0.xwindowsarrays into records.
// Deliberately NO vi.mock("@classicy/classicy"): these tests exercise the real registry
// that each context module writes into at import time.
import { getAppManifest, listScriptableActions } from '@classicy/classicy'
import './Applications/MyApp/MyAppContext' // runs registerApp()
it("registers a description", () => {
expect(getAppManifest("MyApp.app")?.description).toBeTruthy()
})A table-driven test over [appId, prefixes, action types, hasState] catches a
renamed action or a dropped schema cheaply. Add the prefix-overlap guard from
§7.
A full-replacement vi.mock("@classicy/classicy") must stub every registration side effect
the import graph touches — registerApp, registerClassicyIcons,
getAppManifest, describeAppState — and breaks whenever an import is added.
Spread the original instead:
vi.mock("@classicy/classicy", async (importOriginal) => ({
...(await importOriginal<typeof import("@classicy/classicy")>()),
useAppManagerDispatch: () => dispatchMock,
ClassicyWindow: ({ children, id, appMenu, onCloseFunc, title }) => {
if (appMenu) menus.current = appMenu // capture the menu for assertions
if (id && onCloseFunc) closeFns.current[id] = onCloseFunc
return <div data-testid={`win-${id}`} data-title={title}>{children}</div>
},
}))When a full replacement is unavoidable, the reusable useAppManager stub is
(sel) => sel(fakeStore):
useAppManager: (sel: (s: unknown) => unknown) =>
sel({ System: { Manager: { DateAndTime: { dateTimeLocked: false } } } }),
registerApp: () => {},Classicy chrome exposes stable hooks:
page.locator(".classicyDesktop")
page.getByRole("button", { name: "My App" }).dblclick() // desktop icon
page.getByRole("application", { name: "My App" }) // a window
expect(win).toHaveClass(/\bactive\b/) // vs \binactive\b; bare state classes
page.locator('.classicyWindow.active [data-classicy-control="close"]').click()ARIA name computation folds every descendant
menuitem's text into the top-level item's own name, so a substring match on a menu title matches both the parent and the child. Use{ exact: true }.
jsdom needs IntersectionObserver, ResizeObserver, and localStorage stubs in
the vitest setup file — Classicy uses all three.
Before you ship an app:
- The id ends in
.appand thenameis a single word. - No action type, path or lookup is built from a displayed name; text that names the app reads
useClassicyAppIdentity. - A manifest is registered at module load, with a
description. - The
stateschema is az.looseObjectwith.optional()top-level fields. - The action prefix is not a prefix of another registered prefix.
-
appMenu,contextMenu, and help-menu arrays are memoized. - Window ids are unique per instance, not per component.
- Everything written to
apps[id].datais JSON-safe. - Store reads go through narrow selectors.
- Ephemeral or private
datakeys are handled insanitizeStateForPersistence.
Traps, in one place:
| Symptom | Cause |
|---|---|
| Every dispatch throws after boot | ClassicyDesktop was lazy-loaded a tick after the provider. Import it eagerly. |
No handler registered for prefix |
The manifest module is not in the import graph. Import it for its side effect. |
| Actions reach the wrong reducer | A registered prefix is a prefix of yours. First match wins. |
| Registering the same prefix twice does nothing | The registry keeps the first and drops the second silently. |
| Render loop when a window mounts | appMenu is an inline array literal. Memoize it. |
| The menu bar shows a stale menu | Omitting appMenu falls back to the window's stored menuBar. |
| A file-open action never reaches the reducer | The app name contains a space, so the derived action type does too. |
| Focusing a window does nothing | The window is closed. Dispatch ClassicyWindowOpen first. |
| Two windows fight over one store entry | A shared window id across component instances. |
| An icon persists after the app is removed | Icons persist to localStorage; turning both icon surfaces off dispatches the removal. |
| State change is ignored after reload | Persisted state beats defaultState. Clear classicyDesktopState. |
| A desktop icon has no balloon help | The manifest has no description. |
A package's description never shows on your desktop icon |
You pass desktopIconBalloonHelp, which beats it. Omit the prop to use the manifest's description. |
| A package renames your app, but a window title still shows the old name | The window reads the name constant. Use useClassicyAppIdentity(id, { name, icon }).name. |
| Your window's About item keeps its old title under a renaming package | Its id is not ${appId}_about, or its title is not `About ${appName}`. |
| A Control Strip module never appears | Its appId app is not mounted, the host lists it in disabledModules, or the user hid it in the Control Strip control panel. |
| A Control Strip registration is ignored | Another appId already registered that module id. |
| Schema warnings in the console | Dev-only manifest validation. Warn-only — state is never rejected. |