feat(custom-widgets): full Mantine v9 + SubFetch support for custom JSX

Massively expands the custom JSX widget system to support virtually all
Mantine v9 components and adds in-widget HTTP request capabilities via
a server-proxied SubFetch system.

- Whitelist ~100 Mantine components (core, all 16 charts, dates)
- Add SubFetch, SubData, ActionButton, ToggleSwitch, RefreshButton
- Add server-side subFetch tRPC mutation with same-origin + auth
- Show HTTP method warning badges in widget and admin preview
- Remove `fetch` from forbidden keywords, increase template to 50KB
- Expand bindings: Date.*, parseInt, parseFloat, Array.from, etc.
- Update AI prompt with full component reference + demo templates
This commit is contained in:
Thomas Camlong committed 2026-07-12 00:42:31 +02:00
1 parent 576856d634
commit aa8410d326
12 files changed
+1164 -257

No files matched your search

@@ -0,0 +1,20 @@
"use client";
import type { ReactNode } from "react";
import { createContext, useContext } from "react";
const WidgetDefinitionContext = createContext<string>("");
export function WidgetDefinitionProvider({
definitionId,
children,
}: {
definitionId: string;
children: ReactNode;
}) {
return <WidgetDefinitionContext.Provider value={definitionId}>{children}</WidgetDefinitionContext.Provider>;
}
export function useWidgetDefinitionId(): string {
return useContext(WidgetDefinitionContext);
}