Jump to content

Recommended Posts

Posted

Hi everyone,

AdminThemeBridge 0.29.0 is out.

Sorry for not being very active publicly during some days. I was preparing something special for you all: Bridge extensions, a new, hopefully easier way to write Bridge-compatible modules.

What is a Bridge extension?

It is an ordinary ProcessWire module. The difference is that it changes the Bridge admin only through a published surface (the theme's hookable methods, a few public methods and settings, named slots in the admin shell, window.Bridge and DOM events), and it says what it uses in a small manifest. Bridge reads that manifest, loads the extension's JavaScript module and stylesheets, and puts its markup into the slots. Because everything goes through the published surface, your module should keep working when Bridge changes inside.

The manifest is either a getBridgeExtension() method or just a bridge key in your module info, so a simple extension needs no extra code:

public function getBridgeExtension() {

return array(
'contract' => '^0.2', // which extension contract it was written for
'module' => 'BridgeHello.mjs', // an ES module loaded in the admin
'styles' => array('BridgeHello.css'),
'slots' => array('footer' => 'renderFooter'),
'hooks' => array('renderBreadcrumbs'),
);
}

Slots: head, masthead, masthead-right, user-nav, content-head-buttons, footer, drawer and body. The drawer slot even gives your extension its own drawer next to the logo, like the page tree and history drawers. If a slot method throws, Bridge logs it and the page renders without it.

Styles and tokens (new in contract 0.2): an extension's stylesheets are printed after the theme's own, so your rules win ties without !important. 73 CSS custom properties (colours, font size, line height, field spacing...) are now public tokens you can read or set, so a styling extension can restyle the admin without touching theme internals.

The kit (in the theoretic/bridge repo):

  • a scaffold that writes a new extension for you (module, manifest, slot methods, JS module, stylesheet, checks, README);
  • contract tests that check your manifest and run your extension in a sandbox and in a browser;
  • a compatibility checker that tells you, from the files alone, whether your extensions will work with a given Bridge version;
  • a dev mode that reloads your edited JS module and stylesheets in an open admin page.

Bridge's own modules are built the same way: Bridge CSP, the demo module, the BridgeSample module (the scaffold's output, a good place to start) and a new one:

Admin access control (BridgeAdminAccessControl, optional): per-role limits on the page tree, any branch in it, and the main admin menus (Pages, Setup, Modules, Access), enforced on the server. It only narrows what ProcessWire already grants, never gives extra access, and superusers are not affected. Rules are set on the module's configuration screen.

Smaller things:

  • Content in draggable rows (the template's field list, repeater item headers) is now vertically centred.

All the details are in docs/extensions.md and the CHANGELOG in the theoretic/bridge repo.

Special thanks to @interrobang, @matjazp, @Markus Thomas and all of you for your ideas and advices giving me motivation to move further! I still have some unresolved cases; will try to resolve them later.

  • Thanks 2
Posted

Hi friends!

AdminThemeBridge is out of beta. Meet AdminThemeBridge 1.x!

Battle tested in several different web projects, this admin theme is now stable, and 1.x comes with a written promise: the hooks, settings and design tokens that extensions use won't break before 2.0. The full list is in the repository (docs/surface-1.0.md), and existing extensions keep working unchanged.

A ProcessWire look by default

There are many changes under the hood, but the most obvious one is the appearance. AdminThemeBridge's default look and feel is now as close as possible to ProcessWire's own visual standards: the familiar ProcessWire red, a light grey page with white cards, and softer blue-grey borders. And it can be customized in several ways:

  • Per project: colours, logo, favicon, login screen, admin title, corner radius and field density, with Bridge Customizer (a separate module, see its own topic) or the theme's Appearance settings.
  • Per admin user: each user can pick their own colour in the user menu.
  • Light or dark: by default the admin follows the operating system's light or dark mode, and each user can switch it in the masthead.

Also new since 0.24

  • The page tree in a drawer on every screen, and a history of the screens you visited.
  • An extension kit: modules can add to the admin through documented slots, hooks and design tokens, with a scaffold and contract tests.
  • Admin access control (an optional bundled module): per-role rules on page branches and main menus.
  • Phones: no sideways scrolling any more; the search turns into an icon on small screens.
  • Many smaller fixes from an audit of the whole project, and an untranslated language tab now shows faded instead of in italics.

Thanks

Special thanks to @matjazp for his regular and detailed feedback! And, of course, many thanks to this perfect community for the kind help which made this possible 😉

Update as usual: Modules > New > "Add module from URL" with https://github.com/theoretic/AdminThemeBridge/archive/refs/tags/v1.2.0.zip or a pull of the module repository. The CHANGELOG in the repository lists every change.

  • Like 1
  • Thanks 1
  • theoretic changed the title to AdminThemeBridge – a native web-component admin that keeps your existing modules working
Posted

The per project colors and logo change is just what I needed. Thank you. I’ll be installing it this week.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...