The manifest type is
ThemeManifest(packages/shared/src/themes/manifest.ts); the server and the theme CLI check it with the same schema (src/themes/manifest.schema.ts).
A theme has two shapes: the source tree you edit and the archive the server installs. The CLI turns one into the other. This page shows both and lists the fields of the manifest that describes a theme.
The source tree
The source layout mirrors a WordPress block theme, so the structure and naming carry over one to one even though the files are React components, not block HTML. Only theme.json and the entry are required; everything else is there when the theme uses it.
my-theme/
theme.json the manifest (WordPress: style.css header + theme.json)
src/theme.ts(x) the entry: one defineTheme({...}) call (WordPress: functions.php)
src/parts/ one file per part area the theme fills (WordPress: parts/)
src/templates/ one file per view id the theme provides (WordPress: templates/)
src/sections/ theme-defined section types (WordPress: patterns/)
src/layouts/ table layouts; src/layouts/standard-skin/ for a skin of the standard layout
src/styles/ theme.css, fonts.css
tokens.json --th-* and --tbl-* values
assets/ fonts/ strings/<lang>.json sections/*.json
screenshot.png README.md LICENSE
The six sample themes in the theme tools are complete examples of this tree; sample-parts is the one the tutorial builds.
The built archive
theme pack writes dist/<slug>-<version>.tgz, rooted at <slug>/:
<slug>/
theme.json manifest
dist/theme.js ES module; evaluating it calls defineTheme({...})
dist/chunks/*.js lazy chunks, one per registration written as () => import('./file')
dist/theme.css opens with the layer order; the body sits inside @layer pe-theme
tokens.json --th-* and --tbl-* values
fonts/<id>/ woff2 files and the licence text per family
assets/ logo.svg, felt.svg, sounds/, art
sections/*.json default section lists
strings/<lang>.json theme phrases, namespace theme.<slug>.*
certification.json optional; the certification record for the table surface
screenshot.png, README.md, LICENSE
Only files with an allowed extension are archived (js css json woff2 svg png webp jpg mp3 ogg md txt, plus a root LICENSE); src/, node_modules/, dot-files, source maps and earlier archives are left out. The archive is the only thing an operator installs. Nothing is installed from a package registry.
The stylesheet is not scoped for you. Scope your own selectors with [data-theme="<slug>"]: the product sets it on <html> for the active theme, and your parts can carry it on their own root too. See Tokens and Styling.
sections/ holds default section lists (see Sections and Sidebars); strings/ the theme’s phrases, which may contain merge tags (see Strings and Merge Tags).
The manifest: theme.json
The schema is strict: an unknown field fails validation (manifest.invalid).
| Group | Field | Required | Meaning |
|---|---|---|---|
| Identity | slug | yes | Lowercase kebab-case, unique; also the folder and archive name and the theme.<slug>.* namespace |
name, version | yes | Display name; semver version. The installed version and the one kept for rollback cannot be uploaded again until the theme is deleted | |
description, author, license | no | Shown in Site & Content › Themes | |
| Compatibility | engines.contract | yes | Contract range (^0.2.0, ~0.2.0 or exact). The running contract is 0.2.0; it still accepts ^0.1.x ranges, because 0.2.0 only added to 0.1.3 |
extends | no | Parent slug. At most two installed themes above this one before default; the parent must be installed first | |
surfaces | yes | Any of site, member, table, agent | |
colorSchemes | no | dark, light | |
| Build outputs | entry | yes | dist/<name>.js |
styles | when the entry imports CSS | dist/<name>.css | |
tokens, screenshot, certification | no | Package-relative paths. The screenshot is the picture on the theme’s card in Site & Content › Themes: a PNG, WebP or JPEG of the theme’s main page at 1200×900 (4:3), as the bundled themes ship it; keep it small, since it counts toward the 30 MB archive | |
| Registrations | views | no | View id → { chunk? }. See Templates and View Ids |
parts | no | Part-area id → { chunk? }. See Parts and Part Areas | |
sections | no | [{ type, schema }]; a theme type (theme.<slug>.<type>) must carry a schema, a host type must not. See Sections and Sidebars | |
layouts | no | [{ id, seatCounts, variants, modes, rtlLocked?, timing? }]; standard cannot be redeclared | |
menus | no | Which menu locations the theme renders: header, footer, sidebar, mobile, user_dropdown | |
sidebars | no | site.sidebar.primary, site.sidebar.secondary | |
settings | no | Groups of fields. See Settings and Customise | |
| Assets | fonts | no | [{ family, files: [{ path, weight, style, subset }], license }] |
assets | no | { logo, logoDark, favicon, ogImage, felt, cardBack, sounds } | |
strings | no | Language codes; each needs strings/<code>.json |
Every file the manifest names must be in the package (manifest.file-missing).
The entry: defineTheme
The entry module calls defineTheme once. Its keys match the registration groups of the manifest:
import { defineTheme } from '@pe/sdk';
import { Header } from './parts/header';
import './styles/theme.css';
defineTheme({
slug: 'my-theme',
parts: { 'site.header': Header },
views: { 'site.home': () => import('./templates/home') },
sections: { 'theme.my-theme.callout': { component: () => import('./sections/callout') } },
});
A value written exactly as () => import('./file') becomes a lazy chunk the host loads on demand; the module’s default export is the component. The types are ThemeDefinition and the SDK declarations in packages/shared/src/themes/sdk.ts. List every registration in the manifest as well: the validator checks the ids the manifest names (each must be a host id or theme.<slug>.*), and Appearance shows them.
What a theme imports
A theme bundle imports only four things: react, react/jsx-runtime, react-dom (for createPortal and flushSync) and the SDK alias @pe/sdk. The alias is not a package; the build rewrites all four to reads of the copies the host exposes on window.__pokerEngine, so a theme never ships its own React. The import names from @pe/sdk are the ones in SDK_EXPORTS (src/themes/sdk-surface.ts):
| Group | Exports |
|---|---|
| Registration | defineTheme |
| Site and member data | useViewer, useViewerStats, useBrand, useLobby, usePage, usePosts, useMenu, useThemeSettings, useColorScheme |
| Router and translation | useT, useNavigate, Link, NavLink, useLocation, useMatch, useIsActive, useLanguages |
| Auth controllers (guide) | useLoginController, useRegisterController, useForgotPasswordController, useResetPasswordController, useVerifyEmailController, useCompleteSignupController (contract 0.1.3) |
| Table | useTableView, useControlsView, useChatView, useTournamentView, useTimingProfile, useCues, useSound, act, useTableLog, useTableHandHistory (contract 0.2.0), reportPlayer (contract 0.2.1), openPlayerMenu, editPlayerNote, usePlayerNote (contract 0.2.2) |
| Plugin data (guide) | usePluginQuery, usePluginAction, usePluginEvent, usePluginAvailable (contract 0.2.0) |
| Components | Text, RichText, Money, Percent, RelativeTime, Avatar, Part, Slot, Sections |
The router and the translation library are not importable, and the scanner rejects reading location. Themes use Link, NavLink, useNavigate, useLocation, useMatch, useIsActive, useLanguages and useT instead, so a major version bump in the host cannot break installed themes.
The route, language and slot APIs, for a theme that replaces the site chrome:
| Export | Signature | Notes |
|---|---|---|
useLocation | () => { pathname, search, hash } | Re-renders on navigation |
useMatch | (pattern: string, options?: { end?, caseSensitive? }) => { pathname, params } | null | pattern is a route pattern such as /lobby/:tab; end (default false) requires the whole path to match |
useIsActive | () => (to: string, options?: { end?, caseSensitive? }) => boolean | For a menu that checks many links; ignores the query and hash; external links are never active, and / only on the home page |
NavLink | Link props plus activeClassName?: string, end?: boolean | Adds activeClassName and aria-current="page" while active |
useLanguages | () => { current, dir, available: [{ code, label, flag, dir }], status, setLanguage(code) } | The product’s language switcher: setLanguage saves a signed-in player’s choice to their profile, as the product’s switcher does; dir (ltr or rtl) re-renders when it changes; unknown codes are ignored; show a switcher only when available has two or more |
Slot | { id: ThemeSlotId, passProps? } | Renders the plugin fills of a player or public slot (see Parts and Part Areas › Plugin slots); any other id renders nothing |
Some hooks return less than their type promises today: useViewerStats() returns null, usePosts() returns an empty list (the blog is follow-on work), and useBrand() returns supportEmail: null. useBrand()‘s branding images (logoUrl, logoDarkUrl, faviconUrl, ogImageUrl) are the operator’s uploads in Site & Content › Branding while Show the active theme to players is on, and null otherwise. useColorScheme() returns the scheme the page shows (see Tokens and Styling). Money and Avatar render the ui.money and ui.avatar part areas, so a theme that fills those restyles every amount and avatar drawn through the SDK.
Child themes
A child theme declares extends: "<parent-slug>". At runtime the parent’s bundle loads first, then the child’s. The child overrides a parent’s part, template, section type or layout by registering the same id. Tokens merge, with the child’s values winning. The parent must be installed before the child is uploaded, and a parent cannot be deleted while a child depends on it. Every sample theme is a child of default.