feat: add custom widget flow workbench

This commit is contained in:
ajnart committed 2026-09-12 22:51:46 +02:00
1 parent c32a5317ca
commit a6bdbbb4ea
259 files changed
+23875 -1293

No files matched your search

+17 -1
View File
@@ -1,4 +1,8 @@
import { CUSTOM_WIDGET_SCHEMA, customWidgetImportSchema } from "@homarr/custom-widgets/core";
import {
CUSTOM_WIDGET_SCHEMA,
CUSTOM_WIDGET_SUPPORTED_SCHEMAS,
customWidgetImportSchema,
} from "@homarr/custom-widgets/core";
import { z } from "zod/v4";
export const HOMARR_WEBSITE_URL = "https://homarr.dev";
@@ -263,6 +267,18 @@ export function validateWorkshopWidget(content: string): WorkshopWidgetValidatio
}
}
export function isSupportedWorkshopWidgetSchema(value: string) {
return CUSTOM_WIDGET_SUPPORTED_SCHEMAS.some((schema) => schema === value);
}
/** Schema metadata follows the validated package, including during v2 to v3 updates. */
export function getWorkshopContentSchema(type: WorkshopSubmissionType, content: string) {
if (type === "customCss") return WORKSHOP_CSS_SCHEMA;
const result = validateWorkshopWidget(content);
if (!result.success) throw new Error(result.error);
return result.data.$schema;
}
export function workshopExportFilename(title: string, type: WorkshopSubmissionType = "customWidget") {
const safe =
title