elysia-rack 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -231,6 +231,9 @@ new Elysia().use(
231
231
  );
232
232
 
233
233
  // override panel.css (file path, raw CSS string, or { path } / { content })
234
+ // Custom CSS is appended after the default panel.css, so it cascades over
235
+ // the default instead of replacing it — useful for changing only a few
236
+ // tokens or rules.
234
237
  new Elysia().use(reactPlugin({ css: "./my-panel.css" }));
235
238
  ```
236
239
 
@@ -260,14 +260,34 @@ function reactPlugin(options = {}) {
260
260
  return status(404, "Panel asset not found");
261
261
  if (params.name === "panel.css") {
262
262
  const custom = await loadCustomPanelCss();
263
+ const dir2 = resolveDistDir();
264
+ let defaultCss = null;
265
+ if (dir2) {
266
+ try {
267
+ defaultCss = await readFile2(join2(dir2, "panel.css"), "utf-8");
268
+ } catch {}
269
+ }
263
270
  if (custom !== null) {
264
- return new Response(custom, {
271
+ const combined = defaultCss ? `${defaultCss}
272
+
273
+ /* Custom panel.css overrides */
274
+ ${custom}` : custom;
275
+ return new Response(combined, {
265
276
  headers: {
266
277
  "Content-Type": type,
267
278
  "Cache-Control": "public, max-age=3600"
268
279
  }
269
280
  });
270
281
  }
282
+ if (defaultCss) {
283
+ return new Response(defaultCss, {
284
+ headers: {
285
+ "Content-Type": type,
286
+ "Cache-Control": "public, max-age=3600"
287
+ }
288
+ });
289
+ }
290
+ return status(404, "Panel asset not found");
271
291
  }
272
292
  const dir = resolveDistDir();
273
293
  if (!dir)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elysia-rack",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Model-driven CRUD rack for Elysia: REST + QUERY routes, validation, authorization, OpenAPI metadata, and React panel rendering.",
5
5
  "type": "module",
6
6
  "license": "MIT",