@gopherium/godmin

中文文档
0.32.0发布于 2026/11/08Apache-2.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 4820

The admin kit for Gopherium projects: host layer for React admin applications on the WordPress Design System.

原始使用文档
文档目录8 节
  1. Install
  2. Setup
  3. What is in it
  4. Translations
  5. Before your first build
  6. Development
  7. Status
  8. License

GodMin

Gopherium's admin kit

GodMin is the base layer for a React admin application built on the WordPress Design System. It handles the groundwork such an application needs before its first screen renders: loading the design tokens, ordering the CSS, keeping overlays on top, and preparing your bundler and your test runner.

The design system already ships the tokens, the primitives, the data screens and the page chrome. Inside WordPress, the glue underneath them comes from WordPress itself. An application that is not WordPress gets nothing, and ends up hand-writing that glue. GodMin is the glue as a package, and nothing more.

Documentation

The same pages ship in this package under docs/, so you can read the ones that match the version you install.

Install

pnpm add @gopherium/godmin

The design system packages are peer dependencies, so your application resolves and pins them. GodMin never redistributes them.

Setup

Import the stylesheet once at your entry point, then mount AdminRoot around your tree.

import '@gopherium/godmin/base.css'
import { AdminRoot } from '@gopherium/godmin'

createRoot(document.getElementById('app')!).render(
    <AdminRoot>
        <YourApp />
    </AdminRoot>,
)

That is the whole host setup. See the overview for what those two lines do for you.

What is in it

Entry pointContents
@gopherium/godminAdminRoot, Frame, Page, PageTitle, PageTabs, PageTab, PageBreadcrumbs, PageBreadcrumb, SectionTitle, InitialsAvatar, NavigationScreen, MenuCount, ErrorNotice, LoadMore, LogList, LogItem, LogTime, LoadingScreen, Toaster, useToaster, RepeatRows, RowControls, useRowKeys, keyFromLabel, listChromeCatalogFor, LIST_CHROME_DOMAIN, ListEmpty, ListNoResults, ConfirmDialog, FormDialog, RenameDialog, FileButton, useServerPaging, pageWindow, paginationOf, runEach, bulkNotes, useListRun, useBulkRun, useDialogRun, focusInDialog, useFocusBack, focusedTrigger, openOnTap, useUnsavedText, markLatest, viewNarrows, offeredView, offeredSize, sizedView, useMediaQuery, useTokenDocument, the breakpoints HUGE_BREAKPOINT, SIDEBAR_BREAKPOINT, EDGE_BREAKPOINT, DENSE_BREAKPOINT, SHEET_BREAKPOINT, TITLE_BREAKPOINT and SMALL_VIEWPORT, SUPPORTED_WPDS
@gopherium/godmin/base.cssCascade layer order, design tokens, host rules, frame and screen styles
@gopherium/godmin/datesstartListDates, listDate, the only entry that loads @wordpress/date
@gopherium/godmin/routerNavigation, NavigationList, NavigationItem, DrilldownItem, useCanAccess and the MenuItem type with its optional count, useListView, listSearch, openOnTap, useCanvas, useFrameLocation, routerDefaults, UnsavedChangesDialog, the canvas, Sidebar and capability route static data
@gopherium/godmin/testinginstallTestEnvironment, renderAdmin, setViewport and its TestViewport type, getAnnouncement, clearAnnouncements, assertElementPatched, WPDS_IGNORE_SELECTOR, textClasses, badgeClasses, buttonClasses, stubLayout
@gopherium/godmin/vitegodminDedupe, godminSingleCopy, godminStylesheetFirst, duplicateCopies, hoistStylesheet
@gopherium/godmin/stylelintThe design system stylelint rules

Translations

GodMin speaks a few words of its own: Back on a sidebar screen, the name of the sidebar column and its phone drawer, the phone menu button and the drawer's close button, which only a screen reader meets, and "No results found" with the line under it, which ListNoResults shows. It translates them in the WordPress default text domain, as @wordpress/ui translates its own, so @wordpress/i18n is a required peer. Every app already has it, since @wordpress/ui depends on it.

listChromeCatalogFor returns the catalogue GodMin ships for a language, Spanish and French today. Both hold these words and the list dates, and the Spanish one also holds the list chrome. Load it into LIST_CHROME_DOMAIN, the default domain:

import { setLocaleData } from '@wordpress/i18n'
import { LIST_CHROME_DOMAIN, listChromeCatalogFor } from '@gopherium/godmin'

const catalogue = await listChromeCatalogFor('es-ES')
if (catalogue !== undefined) {
    setLocaleData(catalogue, LIST_CHROME_DOMAIN)
}

Before your first build

Duplicate packages break the application, and nothing points at the cause. Two copies of React throw on the first hook. Two copies of @wordpress/theme render unthemed components with no error. Spread godminDedupe into resolve.dedupe and add the godminSingleCopy() plugin. Build configuration covers both, and lists the design system versions each release supports.

Development

pnpm run cover runs the unit tests in jsdom with the coverage gate. The stories in stories/ show the components in Storybook, opened with pnpm run storybook:dev. pnpm run storybook:test runs every story in headless Chromium with its accessibility check, and pnpm run test:browser runs the browser tests in test/browser/. Both need Chromium once: pnpm exec playwright install --only-shell chromium.

Status

Still 0.x, so minor releases may break. See the CHANGELOG for what each release adds. @wordpress/admin-ui remains the thing to watch: GodMin does not wrap it, because a kit that wraps an API still moving adds a release hop to every upstream fix.

License

Apache-2.0, see LICENSE.

The design system packages this kit expects you to install are GPL-2.0-or-later. GodMin declares them as peer dependencies, so your application resolves them and GodMin never redistributes them. Your built bundle combines both, and is conveyed under the terms of the WordPress packages. GodMin's own source stays reusable under plain Apache-2.0. NOTICE carries the same statement for anyone reading only the published tarball.

版本与发布记录

@gopherium/godmin 共发布 44 个版本,首次发布于 2026/07/30;过去 12 个月发布了 44 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.32.0latest2026/11/089 天前
0.31.02026/11/0314 天前
0.30.02026/11/0116 天前
0.29.12026/10/3018 天前
0.29.02026/10/2919 天前
0.28.02026/10/2622 天前

其他发布通道:release-0.24 → 0.24.1。

关于 @gopherium/godmin 的常见问题

@gopherium/godmin 是什么?

The admin kit for Gopherium projects: host layer for React admin applications on the WordPress Design System.

如何安装 @gopherium/godmin?

在项目目录运行 npm install @gopherium/godmin,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^19.2.0)、@wordpress/ui(>=0.25.0 <0.26.0)、@wordpress/a11y(>=5.0.0 <6.0.0)、@wordpress/i18n(>=7.0.0 <8.0.0)、@wordpress/icons(>=19.0.0 <20.0.0)、@wordpress/theme(>=3.0.0 <4.0.0)、@wordpress/style-runtime(>=0.14.0 <0.15.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gopherium/godmin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@gopherium/godmin 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gopherium/godmin 可以商用吗?

@gopherium/godmin 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@gopherium/godmin 的下载量有多少?

根据 npm 官方下载统计,@gopherium/godmin 在 2026/10/17 – 2026/11/15 这 30 天内被下载 4,820 次,日均约 161 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gopherium/godmin 还在维护吗?

最新版本 0.32.0 发布于 2026/11/08(9 天前);至今共发布 44 个版本,其中过去 12 个月发布了 44 个;首次发布于 2026/07/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。