From f9cd5bcb407cf6e3044eaec09268c8833e1099de Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 22 Jul 2026 03:07:33 +0800 Subject: [PATCH] ui-next: refactor plugin loader (#1190) --- examples/plugins/ui-next-plugin/index.ts | 29 +++++++ examples/plugins/ui-next-plugin/package.json | 3 +- examples/plugins/ui-next-plugin/ui/index.tsx | 9 +- .../ui-next-plugin/ui/pages/example_css.tsx | 12 +++ .../ui-next-plugin/ui/pages/example_home.tsx | 14 +++ examples/plugins/ui-next-plugin/ui/styles.css | 13 +++ .../ui-next-plugin/ui/styles.module.css | 22 +++++ packages/ui-next/api.ts | 2 + packages/ui-next/css.d.ts | 6 ++ packages/ui-next/index.ts | 86 ++++++++++++++++--- packages/ui-next/package.json | 1 + packages/ui-next/vite.config.ts | 1 + 12 files changed, 181 insertions(+), 17 deletions(-) create mode 100644 examples/plugins/ui-next-plugin/index.ts create mode 100644 examples/plugins/ui-next-plugin/ui/pages/example_css.tsx create mode 100644 examples/plugins/ui-next-plugin/ui/pages/example_home.tsx create mode 100644 examples/plugins/ui-next-plugin/ui/styles.css create mode 100644 examples/plugins/ui-next-plugin/ui/styles.module.css create mode 100644 packages/ui-next/css.d.ts diff --git a/examples/plugins/ui-next-plugin/index.ts b/examples/plugins/ui-next-plugin/index.ts new file mode 100644 index 000000000..10384ad31 --- /dev/null +++ b/examples/plugins/ui-next-plugin/index.ts @@ -0,0 +1,29 @@ +import { Context, Handler } from 'hydrooj'; + +// Server side of the example plugin. It registers a couple of routes whose +// handlers set a `template`; with @hydrooj/ui-next installed the `next` renderer +// (priority 100) wins for every template, ignores the template file, and injects +// the route/template name into the SPA shell. The client then renders the page +// registered under `page: