From 4c6ffcd0fa32c0ac87286967c28e128efdbc3377 Mon Sep 17 00:00:00 2001 From: Thomas Camlong Date: Tue, 14 Jul 2026 16:59:06 +0200 Subject: [PATCH] refactor(custom-widgets): extract domain package --- AUDIT.md | 535 +++++ .../custom-widgets/agent-authoring.mdx | 26 + .../custom-widgets/architecture.mdx | 29 + .../management/custom-widgets/authoring.mdx | 36 + .../management/custom-widgets/custom-jsx.mdx | 49 + .../custom-widgets/extension-recipes.mdx | 66 + .../docs/management/custom-widgets/index.mdx | 11 + .../management/custom-widgets/migration.mdx | 19 + .../custom-widgets/requests-and-security.mdx | 32 + .../custom-widgets/troubleshooting.mdx | 33 + .../src/generated/custom-jsx-components.json | 445 ++--- apps/nextjs/package.json | 1 + .../manage/custom-widgets/_beta-banner.tsx | 13 +- .../_code-editor-diagnostics.tsx | 51 + .../manage/custom-widgets/_code-editor.tsx | 309 +-- .../custom-widgets/_copy-ai-prompt-button.tsx | 173 +- .../custom-widgets/_custom-widget-actions.tsx | 116 +- .../_custom-widget-form-errors.ts | 42 + .../_custom-widget-form-sections.tsx | 238 +++ .../custom-widgets/_custom-widget-form.tsx | 1725 +---------------- .../_custom-widget-import-utils.ts | 194 -- .../custom-widgets/_custom-widget-preview.tsx | 841 ++------ .../custom-widgets/_display-field-shared.ts | 39 + .../custom-widgets/_display-field-types.ts | 12 + .../custom-widgets/_display-fields-basic.tsx | 178 ++ .../custom-widgets/_display-fields-jsx.tsx | 97 + .../custom-widgets/_display-fields-metric.tsx | 167 ++ .../custom-widgets/_display-fields-status.tsx | 198 ++ .../custom-widgets/_display-type-fields.tsx | 89 + .../custom-widgets/_preview-widget-panel.tsx | 99 + .../_use-custom-widget-clipboard.tsx | 87 + .../_use-custom-widget-preview.ts | 156 ++ .../manage/custom-widgets/edit/[id]/page.tsx | 125 +- e2e/custom-widgets-custom-jsx.spec.ts | 21 +- e2e/shared/mock-api-container.ts | 27 + e2e/shared/mock-api-server.ts | 35 - package.json | 14 +- packages/api/package.json | 3 +- .../custom-widget/custom-widget-router.ts | 788 +------- .../src/router/custom-widget/display-data.ts | 155 -- .../src/router/custom-widget/domain-error.ts | 16 + .../custom-widget/management-queries.ts | 84 + .../custom-widget/metadata-procedures.ts | 54 + .../custom-widget/parse-display-config.ts | 8 +- .../preview-action-procedures.ts | 119 ++ .../custom-widget/preview-base-procedures.ts | 159 ++ .../preview-procedure-helpers.ts | 23 + .../custom-widget/preview-query-procedures.ts | 98 + .../router/custom-widget/preview-sessions.ts | 220 +-- .../router/custom-widget/request-executor.ts | 482 +---- .../router/custom-widget/request-limits.ts | 196 +- .../router/custom-widget/request-manifest.ts | 93 +- .../custom-widget/template-procedures.ts | 226 +++ .../custom-widget/transfer-procedures.ts | 80 + .../__tests__/custom-api-extractors.spec.ts | 252 --- .../widgets/__tests__/custom-api-fixtures.ts | 142 -- packages/api/src/router/widgets/custom-api.ts | 10 +- packages/api/src/test/mcp.spec.ts | 28 + packages/custom-widgets/package.json | 53 + .../scripts/check-architecture.mjs | 98 + packages/custom-widgets/src/core/ai-prompt.ts | 168 ++ .../src/core/built-in-display-schemas.ts | 235 +++ .../src/core/component-descriptor.ts | 91 + .../src/core/component-props.ts | 230 +++ .../src/core/component-registry-denied.ts | 218 +++ .../src/core/component-registry-enabled.ts | 192 ++ .../src/core/component-registry.ts | 19 + .../src/core/component-types.ts | 12 + .../src/core/custom-jsx-schema.ts | 263 +++ .../src/core/definition-schemas.ts | 184 ++ .../src/core/display-config-schema.ts | 57 + .../custom-widgets/src/core/display-data.ts | 123 ++ .../custom-widgets/src/core/display-form.ts | 258 +++ .../src/core/examples.ts} | 0 packages/custom-widgets/src/core/import.ts | 84 + packages/custom-widgets/src/core/index.ts | 7 + .../custom-widgets/src/core/schema-types.ts | 22 + packages/custom-widgets/src/core/schema.ts | 5 + .../src/jsx/analyzer.ts} | 86 +- packages/custom-widgets/src/jsx/bindings.ts | 84 + .../src/jsx/collection-methods.ts | 271 +++ packages/custom-widgets/src/jsx/index.ts | 8 + .../src/jsx/interactive-components.tsx} | 0 .../src/jsx/interpreter-foundation.ts | 108 ++ .../custom-widgets/src/jsx/interpreter.tsx | 387 ++++ .../custom-widgets/src/jsx/jsx-emitter.tsx | 93 + packages/custom-widgets/src/jsx/policy.ts | 73 + .../src/jsx/runtime-components.tsx | 149 ++ .../src/jsx}/safe-bindings.ts | 0 .../custom-widgets/src/jsx/safe-properties.ts | 96 + .../custom-widgets/src/runtime/actions.tsx | 214 ++ .../src/runtime/collection-displays.tsx | 125 ++ .../custom-widgets/src/runtime/context.tsx | 25 + .../src/runtime/custom-jsx-renderer.tsx | 194 ++ packages/custom-widgets/src/runtime/data.tsx | 90 + .../src/runtime/display-registry.ts | 20 + .../src/runtime/display-types.ts | 10 + packages/custom-widgets/src/runtime/index.ts | 14 + .../src/runtime/metric-displays.tsx | 124 ++ .../src/runtime/refresh-button.tsx | 45 + .../custom-widgets/src/runtime/status.tsx | 15 + .../custom-widgets/src/runtime/sub-fetch.tsx | 133 ++ packages/custom-widgets/src/runtime/types.ts | 79 + packages/custom-widgets/src/server/auth.ts | 45 + packages/custom-widgets/src/server/errors.ts | 25 + packages/custom-widgets/src/server/index.ts | 28 + .../src/server/network-policy.ts | 168 ++ .../src/server/preview-sessions.ts | 154 ++ .../src/server/request-executor.ts | 179 ++ .../src/server/request-limits.ts | 113 ++ .../src/server/request-manifest.ts | 79 + .../custom-widgets/src/server/response.ts | 65 + .../custom-widgets/src/test/ai-prompt.spec.ts | 32 + .../src/test/component-registry.spec.ts} | 2 +- .../src/test/display-data.spec.ts | 135 ++ .../src/test/display-form.spec.ts | 65 + .../src/test/generated-docs.spec.ts | 23 + .../custom-widgets/src/test/import.spec.ts | 14 +- .../src/test/jsx-policy.spec.ts | 31 + .../src/test/preview-sessions.spec.ts | 72 + .../src/test/request-limits.spec.ts | 42 + .../src/test/request-manifest.spec.ts | 57 + .../custom-widgets/src/test/runtime.spec.tsx | 157 ++ .../src/test/schema.spec.ts} | 7 +- .../src/test/server-policy.spec.ts | 86 + .../src/test/workbench-ui.spec.tsx | 118 ++ .../custom-widgets/src/test/workbench.spec.ts | 67 + .../custom-widgets/src/workbench/analyzer.ts | 97 + .../src/workbench/component-reference.tsx | 68 + .../src/workbench/form-schema.ts | 144 ++ .../src/workbench/import-review.tsx | 104 + .../custom-widgets/src/workbench/index.ts | 18 + .../custom-widgets/src/workbench/ports.ts | 32 + .../workbench/preview-diagnostics-panel.tsx | 73 + .../src/workbench/preview-error-boundary.tsx | 42 + .../src/workbench/preview-header.tsx | 154 ++ .../src/workbench/preview-request-panel.tsx | 155 ++ .../src/workbench/preview-response-panel.tsx | 149 ++ .../src/workbench/preview-utils.ts | 37 + .../src/workbench/response-tree.tsx | 123 ++ packages/custom-widgets/tsconfig.json | 9 + packages/custom-widgets/vitest.config.ts | 9 + packages/db/migrations/seed.ts | 2 +- packages/db/package.json | 1 + packages/db/schema/mysql.ts | 2 +- packages/db/schema/postgresql.ts | 2 +- packages/db/schema/sqlite.ts | 2 +- packages/definitions/package.json | 1 + packages/definitions/src/custom-jsx.ts | 739 ------- packages/definitions/src/docs/codegen.ts | 2 +- packages/definitions/src/index.ts | 2 - packages/translation/src/lang/en.json | 8 + packages/validation/src/custom-widget.ts | 735 ------- packages/widgets/package.json | 3 +- packages/widgets/src/custom-api/component.tsx | 344 +--- .../src/custom-api/custom-jsx-display.spec.ts | 16 +- .../src/custom-api/custom-jsx-display.tsx | 229 +-- .../src/custom-api/extract-display-data.ts | 1 - .../src/custom-api/jsx-icon-adapter.tsx | 242 +++ .../widgets/src/custom-api/jsx-sub-fetch.tsx | 599 ------ .../widgets/src/custom-api/jsx-whitelist.ts | 779 +------- .../src/custom-api/safe-jsx-interpreter.tsx | 944 --------- .../custom-api/widget-definition-context.tsx | 126 +- pnpm-lock.yaml | 103 +- scripts/check-custom-widget-bundle.mjs | 93 + vitest.config.mts | 30 +- vitest.setup.node.ts | 6 + 167 files changed, 12282 insertions(+), 10033 deletions(-) create mode 100644 AUDIT.md create mode 100644 apps/docs/docs/management/custom-widgets/agent-authoring.mdx create mode 100644 apps/docs/docs/management/custom-widgets/architecture.mdx create mode 100644 apps/docs/docs/management/custom-widgets/authoring.mdx create mode 100644 apps/docs/docs/management/custom-widgets/custom-jsx.mdx create mode 100644 apps/docs/docs/management/custom-widgets/extension-recipes.mdx create mode 100644 apps/docs/docs/management/custom-widgets/migration.mdx create mode 100644 apps/docs/docs/management/custom-widgets/requests-and-security.mdx create mode 100644 apps/docs/docs/management/custom-widgets/troubleshooting.mdx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor-diagnostics.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-errors.ts create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-sections.tsx delete mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-import-utils.ts create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_display-field-shared.ts create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_display-field-types.ts create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_display-fields-basic.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_display-fields-jsx.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_display-fields-metric.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_display-fields-status.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_display-type-fields.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_preview-widget-panel.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_use-custom-widget-clipboard.tsx create mode 100644 apps/nextjs/src/app/[locale]/manage/custom-widgets/_use-custom-widget-preview.ts create mode 100644 e2e/shared/mock-api-container.ts delete mode 100644 e2e/shared/mock-api-server.ts delete mode 100644 packages/api/src/router/custom-widget/display-data.ts create mode 100644 packages/api/src/router/custom-widget/domain-error.ts create mode 100644 packages/api/src/router/custom-widget/management-queries.ts create mode 100644 packages/api/src/router/custom-widget/metadata-procedures.ts create mode 100644 packages/api/src/router/custom-widget/preview-action-procedures.ts create mode 100644 packages/api/src/router/custom-widget/preview-base-procedures.ts create mode 100644 packages/api/src/router/custom-widget/preview-procedure-helpers.ts create mode 100644 packages/api/src/router/custom-widget/preview-query-procedures.ts create mode 100644 packages/api/src/router/custom-widget/template-procedures.ts create mode 100644 packages/api/src/router/custom-widget/transfer-procedures.ts delete mode 100644 packages/api/src/router/widgets/__tests__/custom-api-extractors.spec.ts delete mode 100644 packages/api/src/router/widgets/__tests__/custom-api-fixtures.ts create mode 100644 packages/custom-widgets/package.json create mode 100644 packages/custom-widgets/scripts/check-architecture.mjs create mode 100644 packages/custom-widgets/src/core/ai-prompt.ts create mode 100644 packages/custom-widgets/src/core/built-in-display-schemas.ts create mode 100644 packages/custom-widgets/src/core/component-descriptor.ts create mode 100644 packages/custom-widgets/src/core/component-props.ts create mode 100644 packages/custom-widgets/src/core/component-registry-denied.ts create mode 100644 packages/custom-widgets/src/core/component-registry-enabled.ts create mode 100644 packages/custom-widgets/src/core/component-registry.ts create mode 100644 packages/custom-widgets/src/core/component-types.ts create mode 100644 packages/custom-widgets/src/core/custom-jsx-schema.ts create mode 100644 packages/custom-widgets/src/core/definition-schemas.ts create mode 100644 packages/custom-widgets/src/core/display-config-schema.ts create mode 100644 packages/custom-widgets/src/core/display-data.ts create mode 100644 packages/custom-widgets/src/core/display-form.ts rename packages/{definitions/src/custom-jsx-examples.ts => custom-widgets/src/core/examples.ts} (100%) create mode 100644 packages/custom-widgets/src/core/import.ts create mode 100644 packages/custom-widgets/src/core/index.ts create mode 100644 packages/custom-widgets/src/core/schema-types.ts create mode 100644 packages/custom-widgets/src/core/schema.ts rename packages/{validation/src/custom-jsx-template.ts => custom-widgets/src/jsx/analyzer.ts} (82%) create mode 100644 packages/custom-widgets/src/jsx/bindings.ts create mode 100644 packages/custom-widgets/src/jsx/collection-methods.ts create mode 100644 packages/custom-widgets/src/jsx/index.ts rename packages/{widgets/src/custom-api/jsx-interactive-components.tsx => custom-widgets/src/jsx/interactive-components.tsx} (100%) create mode 100644 packages/custom-widgets/src/jsx/interpreter-foundation.ts create mode 100644 packages/custom-widgets/src/jsx/interpreter.tsx create mode 100644 packages/custom-widgets/src/jsx/jsx-emitter.tsx create mode 100644 packages/custom-widgets/src/jsx/policy.ts create mode 100644 packages/custom-widgets/src/jsx/runtime-components.tsx rename packages/{widgets/src/custom-api => custom-widgets/src/jsx}/safe-bindings.ts (100%) create mode 100644 packages/custom-widgets/src/jsx/safe-properties.ts create mode 100644 packages/custom-widgets/src/runtime/actions.tsx create mode 100644 packages/custom-widgets/src/runtime/collection-displays.tsx create mode 100644 packages/custom-widgets/src/runtime/context.tsx create mode 100644 packages/custom-widgets/src/runtime/custom-jsx-renderer.tsx create mode 100644 packages/custom-widgets/src/runtime/data.tsx create mode 100644 packages/custom-widgets/src/runtime/display-registry.ts create mode 100644 packages/custom-widgets/src/runtime/display-types.ts create mode 100644 packages/custom-widgets/src/runtime/index.ts create mode 100644 packages/custom-widgets/src/runtime/metric-displays.tsx create mode 100644 packages/custom-widgets/src/runtime/refresh-button.tsx create mode 100644 packages/custom-widgets/src/runtime/status.tsx create mode 100644 packages/custom-widgets/src/runtime/sub-fetch.tsx create mode 100644 packages/custom-widgets/src/runtime/types.ts create mode 100644 packages/custom-widgets/src/server/auth.ts create mode 100644 packages/custom-widgets/src/server/errors.ts create mode 100644 packages/custom-widgets/src/server/index.ts create mode 100644 packages/custom-widgets/src/server/network-policy.ts create mode 100644 packages/custom-widgets/src/server/preview-sessions.ts create mode 100644 packages/custom-widgets/src/server/request-executor.ts create mode 100644 packages/custom-widgets/src/server/request-limits.ts create mode 100644 packages/custom-widgets/src/server/request-manifest.ts create mode 100644 packages/custom-widgets/src/server/response.ts create mode 100644 packages/custom-widgets/src/test/ai-prompt.spec.ts rename packages/{definitions/src/test/custom-jsx.spec.ts => custom-widgets/src/test/component-registry.spec.ts} (99%) create mode 100644 packages/custom-widgets/src/test/display-data.spec.ts create mode 100644 packages/custom-widgets/src/test/display-form.spec.ts create mode 100644 packages/custom-widgets/src/test/generated-docs.spec.ts rename apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-import-utils.spec.ts => packages/custom-widgets/src/test/import.spec.ts (70%) create mode 100644 packages/custom-widgets/src/test/jsx-policy.spec.ts create mode 100644 packages/custom-widgets/src/test/preview-sessions.spec.ts create mode 100644 packages/custom-widgets/src/test/request-limits.spec.ts create mode 100644 packages/custom-widgets/src/test/request-manifest.spec.ts create mode 100644 packages/custom-widgets/src/test/runtime.spec.tsx rename packages/{validation/src/custom-widget.spec.ts => custom-widgets/src/test/schema.spec.ts} (96%) create mode 100644 packages/custom-widgets/src/test/server-policy.spec.ts create mode 100644 packages/custom-widgets/src/test/workbench-ui.spec.tsx create mode 100644 packages/custom-widgets/src/test/workbench.spec.ts create mode 100644 packages/custom-widgets/src/workbench/analyzer.ts create mode 100644 packages/custom-widgets/src/workbench/component-reference.tsx create mode 100644 packages/custom-widgets/src/workbench/form-schema.ts create mode 100644 packages/custom-widgets/src/workbench/import-review.tsx create mode 100644 packages/custom-widgets/src/workbench/index.ts create mode 100644 packages/custom-widgets/src/workbench/ports.ts create mode 100644 packages/custom-widgets/src/workbench/preview-diagnostics-panel.tsx create mode 100644 packages/custom-widgets/src/workbench/preview-error-boundary.tsx create mode 100644 packages/custom-widgets/src/workbench/preview-header.tsx create mode 100644 packages/custom-widgets/src/workbench/preview-request-panel.tsx create mode 100644 packages/custom-widgets/src/workbench/preview-response-panel.tsx create mode 100644 packages/custom-widgets/src/workbench/preview-utils.ts create mode 100644 packages/custom-widgets/src/workbench/response-tree.tsx create mode 100644 packages/custom-widgets/tsconfig.json create mode 100644 packages/custom-widgets/vitest.config.ts delete mode 100644 packages/definitions/src/custom-jsx.ts delete mode 100644 packages/validation/src/custom-widget.ts delete mode 100644 packages/widgets/src/custom-api/extract-display-data.ts create mode 100644 packages/widgets/src/custom-api/jsx-icon-adapter.tsx delete mode 100644 packages/widgets/src/custom-api/jsx-sub-fetch.tsx delete mode 100644 packages/widgets/src/custom-api/safe-jsx-interpreter.tsx create mode 100644 scripts/check-custom-widget-bundle.mjs create mode 100644 vitest.setup.node.ts diff --git a/AUDIT.md b/AUDIT.md new file mode 100644 index 000000000..e33c27342 --- /dev/null +++ b/AUDIT.md @@ -0,0 +1,535 @@ +# Custom Widgets Architecture Audit and North Star + +> Status: implemented in the current working tree; baseline retained below for traceability +> Evidence snapshot: `c5703e7e5` on PR #6304 +> Scope: built-in custom-widget displays, Custom JSX, network execution, authoring, preview, import/export, AI prompts, and MCP tools + +## Implementation outcome + +The migration described by this audit is implemented. `@homarr/custom-widgets` now owns the domain through explicit `core`, `jsx`, `runtime`, `server`, and `workbench` exports. API, Widgets, and Next.js retain only authorization, persistence, transport, board registration, navigation, and localized adapter concerns. + +Key outcomes: + +- One typed configuration and display-descriptor model drives schemas, defaults, form hydration, serialization, import/export, preview, examples, diagnostics, generated references, and AI prompts. +- Display-data extraction moved out of API and Widgets into the domain package; the former API-to-Widgets re-export chain no longer exists. +- The interpreter, shared security policy, registry, wrappers, named-request runtime, hardened executor, preview sessions, rate limits, and workbench UI have focused package-owned modules and tests. +- Runtime and workbench network behavior is injected through typed ports. The domain package has no dependency on API, Widgets, Next.js routes, notification infrastructure, or modal infrastructure. +- Public tRPC and MCP procedures are characterized, v2 and v3 import envelopes remain accepted, display-only v1 remains covered, and MCP offers iterative schema, validation, template read/write/patch, create/import/update, preview query, simulation, and journal tools. +- The AI prompt uses a multiline two-block authoring bundle, documents the `SubFetch` render-child contract, and is generated from the canonical registry and tested examples. +- Architecture enforcement currently scans 110 production modules for dependency direction, cycles, file budgets, dynamic loading, and untranslated JSX literals. Generated-reference drift and every Mantine export classification are test-enforced. +- The latest production build measured the largest Custom JSX route payload at 99,852 gzip bytes across two chunks, below the 768 KiB budget. + +Focused verification is green: 278 package tests, 35 API/MCP tests, 52 Widgets renderer tests, 7 E2E tests, affected typecheck, affected lint, docs build, production Next.js build, architecture checks, generated drift, and the bundle budget. The root `pnpm test` command is presently blocked on this workstation by unrelated Docker-backed integration suites timing out while the shared Docker daemon is under external load; no Custom Widget test failed in those runs. + +## Executive summary + +The feature has a strong security direction and a capable authoring experience, but its implementation has outgrown its current ownership model. PR #6304 changes 56 files with 13,206 additions. The primary feature directories contain 10,437 lines, spread across `@homarr/widgets`, `@homarr/api`, `@homarr/definitions`, `@homarr/validation`, and the Next.js management route. + +The main problem is not the absolute line count. It is that domain policy, transport, persistence, rendering, form state, compatibility, and documentation generation are interleaved across package boundaries. A change to one display type can require synchronized edits in schemas, form defaults, import conversion, preview extraction, runtime rendering, documentation, and AI instructions. Several of those paths use untyped records, duplicated conversion logic, or direct API dependencies. + +The north star is a single `@homarr/custom-widgets` domain package with explicit `core`, `jsx`, `runtime`, `server`, and `workbench` entry points. Existing applications and packages become thin adapters. The extraction must preserve public APIs, import formats, permission behavior, and the current UI while improving internal cohesion. + +This audit does not authorize a big-bang rewrite. The migration should be a sequence of behavior-preserving PRs, beginning with characterization tests and ending with enforced dependency and complexity budgets. + +## Measured baseline + +### Change footprint + +| Measure | Current value | +| ------------------------------- | ------------: | +| PR files changed | 56 | +| PR additions | 13,206 | +| PR deletions | 1,385 | +| Primary feature-directory lines | 10,437 | + +Generated component-reference JSON accounts for 2,491 added lines and is not treated as source complexity. + +### Largest production files + +| File | Lines | Responsibilities currently combined | +| ------------------------------------------------------------------------------- | ----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form.tsx` | 1,911 | Schema refinement, defaults, server-error mapping, form conversion, submission, preview state, focus management, display picker, connection fields, and every display-specific editor | +| `packages/api/src/router/custom-widget/custom-widget-router.ts` | 978 | CRUD, import/export, template patching, MCP descriptions, preview sessions, preview execution, journals, and action simulation/execution | +| `packages/widgets/src/custom-api/safe-jsx-interpreter.tsx` | 944 | AST model, parsing, environments, budgets, sanitization, expression evaluation, safe methods, callbacks, and React rendering | +| `apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-preview.tsx` | 834 | Preview orchestration, error boundary, tabs, response tree, diagnostics, request journal, sample data, and renderer selection | +| `packages/widgets/src/custom-api/jsx-whitelist.ts` | 775 | Mantine imports, wrappers, icon mapping, runtime component map, registry filtering, data sanitization, and safe bindings | +| `packages/widgets/src/custom-api/jsx-sub-fetch.tsx` | 599 | Query rendering, render props, path display, action execution, buttons, toggles, refresh, notifications, and confirmations | + +These files exceed the proposed 300-line production-module target. The interpreter is a reasonable candidate for a documented 400-line exception after its independent policies, evaluators, and renderer are extracted. + +### Current ownership + +```mermaid +flowchart LR + D["@homarr/definitions
registry and examples"] + V["@homarr/validation
schemas and AST diagnostics"] + W["@homarr/widgets
renderers and interpreter"] + A["@homarr/api
CRUD, permissions, execution and MCP"] + N["Next.js route
workbench, preview and prompt"] + X["Docs
generated reference and guides"] + + N --> A + N --> V + N --> D + N --> W + W --> A + W --> D + A --> V + X --> D +``` + +The `@homarr/widgets → @homarr/api` edge is particularly costly. Runtime request components call the generated tRPC client directly, so moving the domain into a package that is also consumed by the API would create a dependency cycle unless request execution is inverted behind a typed port. + +## What is working well + +- Custom JSX v2 replaces raw runtime URLs and methods with named, typed requests. +- Board permissions, network scope, DNS validation, redirect policy, response limits, caching, concurrency, and action rules are server-enforced. +- The safe interpreter no longer treats an upstream JSX parser as a sandbox. +- Component metadata drives runtime classification, editor completion, docs generation, and part of the AI prompt. +- The workbench supports multiline JSX, diagnostics, real preview sizes, response inspection, request journals, import review, undo/redo, and paste-to-import. +- MCP exposes schema, validation, preview, journal, template read/write/patch, import, and update workflows without exposing stored secrets. +- Shared examples cover simple metrics, nested queries, charts, actions, and richer interactive layouts. + +The migration must preserve these capabilities. Package extraction is not a reason to weaken the security boundary or remove authoring features. + +## Findings + +### P1 — Domain ownership is fragmented + +Custom-widget behavior is implemented in five packages/applications. None of them is the clear source of truth for the complete lifecycle. `@homarr/definitions` owns component metadata and examples, `@homarr/validation` owns schemas and template diagnostics, `@homarr/widgets` owns runtime evaluation, `@homarr/api` owns network and persistence flows, and Next.js owns authoring transformations. + +Impact: + +- Maintainers must search unrelated packages to understand one behavior. +- Changes have a large synchronization surface and can drift silently. +- The domain cannot be tested or reused as a coherent unit. +- Package names describe infrastructure location rather than feature ownership. + +### P1 — Giant modules mix unrelated reasons to change + +The largest files are not merely long; they combine policy, orchestration, state, and presentation. The form contains all display editors. The router contains every management and preview procedure. The interpreter contains parsing through React emission. The request component file contains both query and mutation interaction models. + +Impact: + +- Reviews are broad and regression-prone. +- Unit-test seams are difficult to identify. +- Merge conflicts concentrate in a small number of files. +- Small feature changes require understanding thousands of lines of adjacent behavior. + +### P1 — Runtime code depends directly on the API client + +`packages/widgets/src/custom-api/component.tsx` and `jsx-sub-fetch.tsx` import `@homarr/api/client`. They also directly invoke notifications and confirmation modals. + +Impact: + +- The renderer cannot be used or tested without application infrastructure. +- A future `@homarr/custom-widgets` package would cycle with `@homarr/api` if both retained these imports. +- Preview and board runtime cannot share the same renderer through different request implementations without branching inside the components. + +Required direction: a runtime provider must receive typed query, action, confirmation, notification, and invalidation ports. The board and preview layers supply adapters. + +### P1 — Configuration transformations are duplicated + +Create defaults and builders live in the form, edit hydration lives in the edit page, and import hydration lives in `_custom-widget-import-utils.ts`. These paths independently translate between stored display configs and form values. They rely on display-type switches, record casts, and JSON text fields such as the request manifest. + +Impact: + +- Create, edit, paste replacement, import, export, and MCP can disagree. +- Adding a field requires updating multiple transforms. +- Round trips are difficult to prove lossless. + +Required direction: each display type supplies one typed descriptor containing schema, defaults, `toForm`, `fromForm`, preview projection, and migration behavior. + +### P1 — Type safety degrades at domain boundaries + +`Record`, `as never`, and `as unknown as` are frequent in form conversion, display extraction, preview state, imports, registry wrappers, and API parsing. Some casts are necessary at the interpreter/React boundary, but most domain-level casts indicate missing discriminated unions or validated adapters. + +Impact: + +- Invalid combinations survive until runtime. +- Refactors do not receive complete compiler guidance. +- Server and client transformations can diverge while continuing to compile. + +Required direction: parse unknown values once at ingress and use typed domain objects afterward. Unsafe casts must be isolated to named boundary modules and justified by tests. + +### P1 — Security policy is represented more than once + +The template validator and interpreter both parse JSX and maintain concepts such as blocked properties, blocked props, AST depth, and operation limits. Runtime component filtering adds another policy layer. + +The analyzer and interpreter have different jobs, so they should not be collapsed into one evaluator. They must, however, consume one immutable policy definition and shared AST normalization utilities. + +Impact: + +- A property can be rejected by one layer and missed by another. +- Security changes require parallel edits and duplicate tests. +- Diagnostics can describe behavior that differs from runtime enforcement. + +### P1 — The API router combines transport and application behavior + +The router owns tRPC metadata, Zod inputs, database writes, encryption, import/export, template revisions, preview execution, rate-limit acquisition, journal recording, and MCP documentation. + +Impact: + +- Domain logic is only testable through tRPC context setup. +- MCP and browser endpoints can accidentally implement different workflows. +- Framework-specific `TRPCError` values leak into lower-level executor and manifest code. + +Required direction: tRPC procedures authorize, load persistence models, call a domain service, and map domain errors. They do not implement request rendering, template patching, preview execution, or import conversion inline. + +### P2 — Metadata generation is only partially centralized + +The component registry and examples are shared, but runtime maps, wrappers, safe bindings, display-type metadata, AI prompt prose, form choices, and some docs remain separately assembled. The AI prompt is built inside a client button component. + +Impact: + +- Agent instructions can drift from validation and runtime behavior. +- Prompt generation requires UI and network context. +- Display types lack the same single-registry guarantee as JSX components. + +Required direction: prompt generation is a pure function in `core`, using the schema, display descriptors, component registry, and tested fixtures. The UI only fetches context and copies the result. + +### P2 — Compatibility behavior is mixed into primary flows + +V1 detection, migration warnings, legacy network diagnostics, v2 imports, v3 exports, and fallback display parsing are embedded beside current authoring/runtime logic. + +Impact: + +- Happy paths are harder to read. +- Legacy behavior can accidentally influence v2 code. +- Compatibility retirement has no obvious deletion boundary. + +Required direction: version detection and migrations live under `core/migrations`. Runtime and workbench receive a normalized current model plus explicit review state. + +### P2 — Test topology does not mirror the architecture + +Interpreter coverage is substantial, and request-executor/router tests exist, but tests are colocated under their current infrastructure owners instead of a feature package. A focused renderer run passed 52 tests during review, while the selected API suites failed before collecting tests because the root Vitest client environment rejected server-only environment access. + +Impact: + +- The complete feature cannot be verified with one package command. +- Server test failures can be configuration failures rather than behavioral failures. +- Form conversion and workbench orchestration have limited direct characterization coverage relative to their size. + +Required direction: the package owns focused test projects or environment-specific configs for core, DOM runtime/workbench, and Node server tests. API adapter tests remain in `@homarr/api`. + +### P2 — A small amount of user-facing copy bypasses translation + +Examples found during the snapshot include the raw-response tooltip and a default empty template message. Dynamic translation keys also require repeated `as never` casts, reducing translation-key safety. + +Impact: + +- Locale completeness gates are unreliable. +- Refactoring copy is harder than changing typed translation keys. + +Required direction: all package UI receives a typed message catalog or uses typed scoped translations. No visible fallback literals are allowed in production components. + +## North-star package + +```text +packages/custom-widgets/ +├── src/core/ +│ ├── config/ # discriminated display configurations and form models +│ ├── displays/ # typed display descriptors and built-in display metadata +│ ├── import/ # v2/v3 parsing, export, review, and authoring bundles +│ ├── migrations/ # v1 detection, normalization, and review requirements +│ ├── prompts/ # pure AI prompt generation +│ └── examples/ # typed fixtures shared by tests, docs, editor, and prompts +├── src/jsx/ +│ ├── ast/ # parser adapter, AST types, traversal, and normalization +│ ├── policy/ # blocked properties, props, URLs, and budgets +│ ├── analyzer/ # authoring diagnostics +│ ├── interpreter/ # expression and collection evaluation +│ ├── registry/ # component descriptors, wrappers, and export classification +│ └── bindings/ # branded safe helpers and sanitized data +├── src/runtime/ +│ ├── displays/ # built-in renderers +│ ├── jsx/ # Custom JSX renderer and error containment +│ ├── requests/ # SubFetch, actions, toggles, refresh, and state handling +│ └── provider/ # injected runtime capabilities +├── src/server/ +│ ├── network/ # hardened executor and destination policy +│ ├── requests/ # manifest resolution and parameter substitution +│ ├── limits/ # rate and concurrency limits +│ └── preview/ # sessions, simulation, and journals +└── src/workbench/ + ├── form/ # shared state and connection/display sections + ├── editor/ # CodeMirror and registry-driven diagnostics + ├── preview/ # widget, response, journal, and diagnostic views + └── import/ # clipboard parsing and review UI +``` + +Public exports are explicit: + +```json +{ + "exports": { + "./core": "./src/core/index.ts", + "./jsx": "./src/jsx/index.ts", + "./runtime": "./src/runtime/index.ts", + "./server": "./src/server/index.ts", + "./workbench": "./src/workbench/index.ts" + } +} +``` + +There is no broad root barrel. Internal folders cannot be imported by consumers. + +### Dependency rules + +```mermaid +flowchart LR + C["custom-widgets/core"] + J["custom-widgets/jsx"] + R["custom-widgets/runtime"] + S["custom-widgets/server"] + B["custom-widgets/workbench"] + API["@homarr/api adapter"] + W["@homarr/widgets adapter"] + N["Next.js route adapter"] + DOC["Docs generator"] + + J --> C + R --> C + R --> J + S --> C + B --> C + B --> R + API --> C + API --> S + W --> C + W --> R + N --> C + N --> B + DOC --> C + DOC --> J +``` + +Hard rules: + +1. `@homarr/custom-widgets` never imports `@homarr/api`, `@homarr/widgets`, or Next.js route modules. +2. `core` has no React, Mantine, tRPC, database, Redis, or browser dependency. +3. `jsx` has no API, persistence, Redis, notification, or modal dependency. +4. `runtime` performs no direct tRPC calls. It consumes `CustomWidgetRuntimePort`. +5. `workbench` performs no direct tRPC calls. It consumes `CustomWidgetWorkbenchPort` callbacks. +6. `server` has no tRPC or database-query dependency. API adapters load authorized records and map errors. +7. Cross-entry imports follow the arrows above; reverse imports fail CI. + +### Runtime ports + +The exact transport remains owned by adapters. The domain contract should cover behavior rather than tRPC details: + +```ts +interface CustomWidgetRuntimePort { + getData(input: { itemId: string; signal?: AbortSignal }): Promise; + query(input: NamedRequestInvocation & { signal?: AbortSignal }): Promise; + action(input: NamedRequestInvocation & { confirmed?: boolean }): Promise; + confirm(input: ActionConfirmation): Promise; + notify(input: RuntimeNotification): void; + invalidate(input: RuntimeInvalidation): Promise; +} +``` + +Board runtime and preview runtime implement the same port. Preview simulation is an adapter capability, not a conditional tRPC import inside `ActionButton`. + +### Display descriptors + +Every display type is represented once: + +```ts +interface CustomWidgetDisplayDescriptor { + type: CustomWidgetDisplayType; + configSchema: ZodType; + formSchema: ZodType; + createDefault(): TConfig; + toForm(config: TConfig): TForm; + fromForm(form: TForm): TConfig; + migrate(input: unknown): DisplayMigrationResult; + extract(response: unknown, config: TConfig): DisplayModel; + capabilities(config: TConfig): CustomWidgetCapability[]; +} +``` + +UI fields and renderer components may be registered in runtime/workbench companion maps keyed by the same typed display identifier. Domain descriptors remain serializable and framework-independent. + +## Developer-experience north star + +### Maintainers + +- Start at `packages/custom-widgets` for every feature behavior. +- Find one module per concept and one descriptor per display type. +- Add a display type without editing central switches in multiple packages. +- Run one package command for core, DOM, and server tests. +- Receive compile-time failures when a configuration field is not handled by forms, preview, migration, or export. +- Review PRs that move one domain boundary at a time. + +### Administrators and template authors + +- Preserve the current continuous form and live workbench. +- Keep preview usable before a live response exists through schema-valid defaults and editable sample data. +- Keep diagnostics actionable, localized, clickable, and consistent with runtime policy. +- Keep imports reviewable and secrets excluded. +- Keep query and action capabilities visible without noisy permanent warnings. + +### AI agents + +- Obtain schema, registry, limits, examples, and prompt rules from the same typed sources. +- Use readable multiline templates through authoring bundles and line-based template tools. +- Validate, preview, inspect journals, patch, and revalidate without rewriting unrelated configuration. +- Receive stable machine-actionable issue codes in addition to localized or human-readable messages. +- Never need to infer runtime behavior from UI-only prompt strings. + +## Fragmentation rules + +- Production modules target at most 300 lines, excluding generated files, fixtures, and type-only declarations. +- Algorithmic modules can reach 400 lines only with a file-level rationale and focused tests. +- A module has one primary reason to change; moving lines without separating policy from orchestration does not satisfy the target. +- React components do not contain schema definitions or persistence transforms. +- Routers do not contain reusable domain algorithms. +- Domain functions do not throw framework-specific errors. +- Unknown input is validated once. Parsed values are not carried as `Record` through internal layers. +- Compatibility code lives in versioned migration modules and has explicit removal criteria. +- Generated artifacts are reproducible and checked for drift, but excluded from line budgets. + +## Migration roadmap + +### PR 1 — Characterize contracts + +- Add round-trip tests for every display descriptor: default → form → config, stored config → form → config, and import → export. +- Add fixtures for v1 display-only, v1 network-review-required, v2 import, and v3 export. +- Add prompt snapshots sourced from the component registry and examples. +- Split Node and DOM Vitest projects so server suites collect and run reliably. +- Record bundle and render baselines before moving modules. + +Gate: all existing behavior is represented by tests, with no production moves yet. + +### PR 2 — Establish `core` + +- Create `@homarr/custom-widgets` and explicit exports. +- Move custom-widget schemas, typed configs, display descriptors, examples, import/export, migration, capability analysis, and prompt generation into `core`. +- Replace form/edit/import conversion duplication with descriptor calls. +- Temporarily re-export legacy imports from definitions and validation to keep consumers stable. + +Gate: create, edit, import, export, MCP validation, and AI prompt generation use the same domain contracts. + +### PR 3 — Extract JSX policy and interpreter + +- Move AST types, parser adapter, shared security policy, analyzer, evaluator, budgets, bindings, and registry into `jsx`. +- Separate evaluator modules by expression family and React emission. +- Generate diagnostics and runtime enforcement from the same policy constants. +- Keep the Mantine export-classification CI check. + +Gate: the security suite passes unchanged, analyzer/runtime policy drift tests pass, and no consumer imports JSX internals. + +### PR 4 — Extract runtime + +- Move built-in renderers, Custom JSX display, SubFetch, actions, toggles, refresh, and error containment into `runtime`. +- Introduce the runtime port and adapters for board and preview contexts. +- Remove direct imports of the API client, modals, and notifications from domain components. +- Split request components into query, action, toggle, refresh, feedback, and shared-state modules. + +Gate: board rendering and workbench preview use the same runtime components through different adapters; actions retain confirmation, rollback, invalidation, and permission behavior. + +### PR 5 — Extract server services + +- Move executor, manifests, network policy, limits, caching/single-flight, and preview-session logic into `server`. +- Replace `TRPCError` below the adapter with typed domain errors. +- Split API procedures into management, templates, preview, and runtime routers that delegate to package services. +- Keep authorization, database lookup, encryption, and tRPC/MCP metadata in `@homarr/api`. + +Gate: browser and MCP flows call the same services; request security tests run as Node package tests; public procedure names and inputs remain compatible. + +### PR 6 — Extract and fragment workbench + +- Move reusable editor, preview, response tree, import review, connection section, display picker, and display-specific fields into `workbench`. +- Introduce a workbench port for validate, preview, query, simulate action, journal, and save callbacks. +- Keep Next.js pages responsible only for routing, loading initial data, and constructing adapters. +- Replace the monolithic form with small sections and descriptor-driven display fields while preserving the continuous form, two-pane scrolling, autofocus, and mobile modes. + +Gate: no workbench source file exceeds the agreed budget, and create/edit/paste replacement share one state model. + +### PR 7 — Remove scaffolding and enforce boundaries + +- Remove compatibility re-exports and old implementations after all consumers move. +- Add CI checks for forbidden imports, dependency cycles, source-size budgets, untranslated literals, generated-artifact drift, component classification, and custom-JSX chunk size. +- Update contributor and architecture documentation with package entry points and extension recipes. + +Gate: old ownership paths contain only thin adapters or are deleted. + +## Verification strategy + +### Core + +- Every display descriptor accepts valid data and rejects mismatched configuration. +- All create/edit/import/export transformations are lossless where expected. +- V1/v2/v3 compatibility and review states are deterministic. +- Prompt output, authoring bundles, fixtures, docs data, and completion data are generated from shared sources. + +### JSX + +- Computed and Unicode-obfuscated reflective access remains blocked. +- Analyzer and interpreter share property, prop, URL, and budget policy. +- Own-property resolution, branded calls, callback accounting, and node/operation limits remain enforced. +- Every upstream Mantine export is classified and every enabled runtime component resolves. + +### Runtime and workbench + +- Query cancellation, stale results, retries, render children, action locks, DELETE confirmation, toggle rollback, and invalidation behave identically in preview and boards. +- Error boundaries isolate template and display failures. +- Empty, sample, stale, loading, failure, and success states are localized and accessible. +- Keyboard, focus, responsive, reduced-motion, and narrow-widget behavior remain covered. + +### Server and adapters + +- Board IDOR, permission levels, anonymous actions, named-request kinds, substitutions, DNS classes, redirects, headers, response limits, caching, and rate limits remain covered. +- Server tests run under an explicit Node environment rather than failing during client-environment initialization. +- MCP schemas and descriptions remain discoverable, stable, and absent from unsafe runtime procedures. + +### Required commands + +At the end of the migration, the package and repository must pass: + +```sh +pnpm --filter @homarr/custom-widgets test +pnpm test +pnpm test:e2e +pnpm turbo typecheck --affected +pnpm turbo lint --affected +pnpm turbo build --filter=@homarr/docs +pnpm check:custom-widget-bundle # after the Next.js production build +``` + +CI additionally checks dependency direction, cycles, file budgets, generated references, translations, and client bundle size. + +## Completion criteria + +- `@homarr/custom-widgets` owns every reusable custom-widget domain behavior. +- No circular dependencies exist. +- The package does not import `@homarr/api`, `@homarr/widgets`, or Next.js route modules. +- Runtime and workbench networking uses injected typed ports. +- One typed descriptor is the source of truth for each display type. +- One shared JSX policy drives authoring diagnostics and runtime enforcement. +- Create, edit, import, export, preview, MCP, and board runtime use the same typed transformations. +- Public tRPC/MCP names, import formats, stored configuration, and permission behavior remain compatible. +- V1 display-only migration and network-review states remain tested. +- Production modules satisfy the 300/400-line budgets. +- No untranslated user-facing strings remain. +- Core, JSX, runtime, server, workbench, integration, E2E, accessibility, docs, and bundle checks pass. +- A maintainer can locate a custom-widget behavior from the package structure without searching unrelated packages. + +## Explicit non-goals + +- Replacing Mantine or Homarr's visual language. +- Allowing arbitrary cross-origin requests. +- Replacing named requests with general JavaScript execution. +- Changing stored secrets or exposing them through export or MCP. +- Redesigning the current management UX during the package extraction. +- Removing compatibility formats before migration and review flows are proven. + +## Decision record + +- The package owns all Custom Widget behavior, not only Custom JSX. +- Security and correctness are hard constraints. +- Maintainer simplicity is the primary tie-breaker after those constraints. +- Current user and agent workflows are preserved during extraction. +- Generated artifacts do not count toward source-size budgets. +- Migration occurs through reviewable, behavior-preserving PRs rather than a single rewrite. diff --git a/apps/docs/docs/management/custom-widgets/agent-authoring.mdx b/apps/docs/docs/management/custom-widgets/agent-authoring.mdx new file mode 100644 index 000000000..2121e1424 --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/agent-authoring.mdx @@ -0,0 +1,26 @@ +--- +sidebar_label: AI and MCP authoring +--- + +# AI and MCP authoring + +Homarr exposes an iterative, validation-first workflow to authenticated administrators. Agents should continue until validation, preview, and diagnostics are clean; they must not invent inline network access. + +## Recommended loop + +1. Read `customWidget_schema` and the generated component/capability reference. +2. Read an existing definition with `customWidget_byId`, or create a v3 draft. +3. Call `customWidget_validate`; fix every issue using its exact path. +4. Call `customWidget_preview` for the base GET and retain the preview session ID. +5. Test each named query with `customWidget_previewQuery`. +6. Dry-run every action with `customWidget_simulatePreviewAction`. +7. Inspect `customWidget_previewJournal` for status, duration, and method coverage. +8. Revalidate, then call import/create or a focused update/patch operation. + +Stored secret values are never readable. Omitting secrets during an update preserves them. MCP actions are simulation-only; enabling live preview actions remains a browser-only administrator decision. + +## Template format + +Use multiline JSX when reading or patching templates. Prefer focused template read/write/patch tools over rewriting an escaped one-line JSON string. When a complete portable artifact is needed, use the authoring bundle placeholder plus a separate fenced JSX block. + +The AI prompt is generated from the same registry, examples, request rules, and limits as the validator. Agents should still trust validation output over prompt memory because the installed Homarr version is authoritative. diff --git a/apps/docs/docs/management/custom-widgets/architecture.mdx b/apps/docs/docs/management/custom-widgets/architecture.mdx new file mode 100644 index 000000000..508eef439 --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/architecture.mdx @@ -0,0 +1,29 @@ +--- +sidebar_label: Maintainer architecture +--- + +# Maintainer architecture + +Reusable Custom Widget behavior belongs to `@homarr/custom-widgets`: + +- `core` owns schemas, descriptors, migrations, import/export, examples, diagnostics metadata, and prompt generation. +- `jsx` owns AST parsing, shared policy, interpreter, bindings, registry, wrappers, and analysis. +- `runtime` owns renderers and named-request controls through injected ports. +- `server` owns manifests, network execution, caching, limits, preview sessions, and typed domain errors. +- `workbench` owns form contracts, editor analysis, preview UI, response tree, and import review through injected ports. + +The API package retains persistence and board authorization adapters. Widgets retain board registration and runtime transport wiring. Next.js routes retain navigation and shells. The domain package must never import API, widgets, or route modules. + +## Add a display type + +Extend the typed descriptor and discriminated schema, defaults/hydration/serialization, renderer, workbench section, preview, import round-trip fixtures, docs, and translations. Create, edit, import, export, MCP, and preview must all use the same transform. + +## Add a JSX component + +Classify the upstream export, document safety mode and supported props, add a wrapper if behavior needs constraining, and update registry tests. CI fails when a Mantine upgrade introduces an unclassified export. + +## Change networking + +Implement policy below the framework-neutral server boundary and expose infrastructure through a typed port. Add tests for permissions, typed substitution, DNS classes, redirects, headers, timeouts, limits, redaction, cache behavior, and action non-retry semantics before wiring the tRPC adapter. + +Production files target 300 lines. Algorithmic AST/network modules may use a documented 400-line ceiling. Dependency-boundary, cycle, file-size, translation, generated-artifact, component-classification, focused unit, integration, E2E, accessibility, and docs-build gates protect the architecture. After a Next.js production build, `pnpm check:custom-widget-bundle` also enforces a 768 KiB gzip ceiling across the client chunks referenced by Custom JSX. diff --git a/apps/docs/docs/management/custom-widgets/authoring.mdx b/apps/docs/docs/management/custom-widgets/authoring.mdx new file mode 100644 index 000000000..ebe31288c --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/authoring.mdx @@ -0,0 +1,36 @@ +--- +sidebar_label: Authoring workbench +--- + +# Authoring workbench + +The Custom Widget form is a continuous workflow: choose a display, configure the HTTP connection, configure the display, then test it in the adjacent preview. Each section stays visible so you can revisit earlier choices without losing context. + +## Choose a display + +The display grid is the first product decision. Built-in displays are best for common metrics, tables, statuses, and actions. Choose Custom JSX when the layout needs multiple Mantine components, conditional presentation, charts, dates, or named requests. + +Changing display type preserves shared connection fields and initializes safe display defaults. A Custom JSX template is never blank; new and migrated forms receive the tested starter fixture. + +## Test and preview + +The preview has four tabs: + +- **Widget** renders at compact, standard, or wide board-like sizes. +- **Response** uses a tree to inspect data, copy paths, and insert paths into JSX. The external-response action opens a temporary local blob and never publishes the response. +- **Request** shows the redacted base request, named capabilities, status, duration, and preview journal. +- **Diagnostics** shows template size, named requests, network scope, and blocking or advisory issues. + +Only GET base requests run automatically. Preview actions are simulated until an administrator explicitly enables live actions for the five-minute preview session. DELETE still requires confirmation. + +## Keyboard and clipboard + +The JSX and JSON editors support native Ctrl/Cmd+Z and redo, plus visible toolbar controls. Cursor position, character count, and the 50,000-character limit remain visible. + +On the list page, paste a complete v3 export with Ctrl+V or Command+V to import it as new. On an edit page, pasting opens a replacement review. Nothing is applied before the origin, methods, credential inheritance, and permissions are shown. + +For AI output, prefer the authoring bundle format: a JSON block containing `"template": "__HOMARR_TEMPLATE__"`, followed by a JSX block. This keeps multiline JSX readable and avoids JSON escape errors. + +## Save behavior + +Errors block save; warnings do not. Server validation runs again on every create or update. Leaving with dirty changes triggers protection. Secrets omitted during edit remain unchanged, and secrets are never exported. diff --git a/apps/docs/docs/management/custom-widgets/custom-jsx.mdx b/apps/docs/docs/management/custom-widgets/custom-jsx.mdx new file mode 100644 index 000000000..d00334b92 --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/custom-jsx.mdx @@ -0,0 +1,49 @@ +--- +sidebar_label: Custom JSX language +--- + +# Custom JSX language + +Custom JSX is a declarative expression language, not browser JavaScript. Homarr parses an explicit AST subset and emits React elements from a classified component registry. Templates cannot access browser globals, native prototypes, constructors, refs, portals, raw event handlers, or direct `fetch`. + +## Data and rendering + +The base GET response is available as `data`. Safe member access, conditionals, arrays, object literals, and interpreter-created collection callbacks can compose displays: + +```jsx + + {data.services + .filter((service) => service.visible) + .map((service) => ( + + {service.name} + {service.status} + + ))} + +``` + +Properties are resolved own-only. Reflective names such as `constructor`, `prototype`, `__proto__`, `caller`, `callee`, `arguments`, `bind`, `call`, and `apply` are rejected even when computed or Unicode escaped. + +## Components and props + +Every Mantine export is classified as allowed, wrapped, or denied. The [generated component reference](./#component-reference) is authoritative. Props are allowlisted per component; unsupported props produce warnings and are ignored. Polymorphic roots, unsafe URLs, portals, positioning escapes, refs, and function props are stripped. + +`SubData` is a convenience for simple response paths. Prefer the render-child pattern for rich nested results: + +```jsx + + {(detail, meta) => ( + + {detail.name} + HTTP {meta.status} + + )} + +``` + +## Safe helpers and budgets + +Bindings include restricted conversion, string, array, object, JSON, math, URI, and pure date helpers. Native `Date` objects and native prototypes are not exposed. + +Templates are limited to 50,000 characters, 10,000 rendered nodes, and explicit AST-depth, operation, collection, and string budgets. Budget errors stop only the Custom JSX renderer and are contained by its error boundary. diff --git a/apps/docs/docs/management/custom-widgets/extension-recipes.mdx b/apps/docs/docs/management/custom-widgets/extension-recipes.mdx new file mode 100644 index 000000000..650963432 --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/extension-recipes.mdx @@ -0,0 +1,66 @@ +--- +sidebar_label: Extension recipes +--- + +# Custom Widget extension recipes + +These recipes keep every authoring and runtime path on the same typed source of truth. Run `pnpm check:custom-widgets` after each structural change and add focused package tests before changing an adapter. + +## Add a built-in display type + +1. Add the discriminated configuration schema in `@homarr/custom-widgets/core`. +2. Add one descriptor with its icon, category, localized metadata keys, defaults, hydration, serialization, and validation. +3. Add the renderer to the runtime display map. It must consume normalized display data and injected actions only. +4. Add a bounded workbench section that edits the descriptor-owned form fields. +5. Add one fixture and assert create, edit, v2/v3 import, export, MCP, and preview round trips against it. +6. Add translation keys and update the display table in the user guide. + +Do not add route-specific conversion code. `buildDisplayFormValues` and `buildDisplayConfigFromFormValues` are the only form conversion boundary. + +## Add or update a JSX component + +1. Classify the Mantine export as `allowed`, `wrapped`, or `denied` in the component registry. Denied entries require a reason. +2. Declare supported props and subcomponents. Function props, refs, portals, polymorphic roots, and unsafe positioning stay denied unless a wrapper removes the unsafe behavior. +3. Implement wrappers in the JSX package and register them through the package runtime-component factory. +4. Add analyzer and renderer tests for accepted props, stripped props, reflective-property attacks, and the rendered-node budget. +5. Regenerate the docs reference and verify the editor completion and AI prompt include the same entry. + +The component-classification test must pass against the locked Mantine version. Never expose an upstream namespace or native prototype as a shortcut. + +## Add a named-request capability + +1. Extend the request schema and manifest renderer in `core` and `server` without accepting a raw runtime URL, method, header, or body. +2. Enforce permission, network scope, redirect, DNS, header, body, response, concurrency, and rate policies in the framework-neutral server service. +3. Expose infrastructure through a typed server port. Translate domain errors only in the API adapter. +4. Add the control to runtime through the injected request port. Queries use query semantics; actions require a gesture and use mutation semantics. +5. Add preview simulation and redacted-journal coverage. Live actions remain an explicit administrator-only browser choice. +6. Update MCP validation and simulation tools without exposing stored secrets or unrestricted action execution. + +Tests must prove actions are never mounted automatically, polled, retried, cached, or redirected. DELETE must retain full permission and confirmation. + +## Add a workbench feature + +1. Put reusable state, analysis, or presentation in `@homarr/custom-widgets/workbench`. +2. Receive localized messages and typed callbacks as props. The package cannot import the tRPC client, Next.js navigation, notifications, or Homarr widget adapters. +3. Keep the Next.js component as a transport and page-shell adapter. +4. Cover keyboard operation, focus order, reduced motion, 320/768/desktop layouts, dirty-state behavior, and error-boundary recovery. +5. Keep each production module below 300 lines and preserve the continuous two-pane form behavior. + +## Change examples or AI authoring + +Examples live as typed shared fixtures. Tests, snippets, documentation data, and the AI prompt consume those fixtures. AI output uses an authoring bundle: a JSON block with `__HOMARR_TEMPLATE__`, followed by a readable multiline JSX block. Do not require agents to escape an entire template into one JSON string. + +After changing a fixture, validate every example, render it, regenerate the component reference, and run the prompt snapshot tests. MCP agents must be able to read a widget, patch template lines with a revision, validate, preview named queries, simulate actions, inspect the journal, and update the definition without receiving secret values. + +## Required checks + +```bash +pnpm check:custom-widgets +pnpm test +pnpm test:e2e +pnpm turbo typecheck --affected +pnpm turbo lint --affected +pnpm turbo build --filter=@homarr/docs +``` + +Also run the component-classification, generated-reference drift, bundle-budget, accessibility, and focused package/API suites configured by the repository. A change is incomplete if any create, edit, import, export, MCP, preview, or board-runtime path uses a separate transform. diff --git a/apps/docs/docs/management/custom-widgets/index.mdx b/apps/docs/docs/management/custom-widgets/index.mdx index 07099c696..decb337aa 100644 --- a/apps/docs/docs/management/custom-widgets/index.mdx +++ b/apps/docs/docs/management/custom-widgets/index.mdx @@ -12,6 +12,17 @@ import { CustomJsxComponentReference } from "@site/src/components/custom-jsx-com Custom widgets connect a dashboard item to an HTTP API without compiling a new Homarr widget. Administrators choose the endpoint and authentication, then use a built-in display type or a Custom JSX template to render the response. +## Guides + +- [Authoring workbench](./authoring): create, edit, preview, paste, undo, import, and export. +- [Custom JSX language](./custom-jsx): supported syntax, components, bindings, diagnostics, and limits. +- [Named requests and security](./requests-and-security): permissions, network scopes, request manifests, and server protections. +- [AI and MCP authoring](./agent-authoring): an iterative agent workflow that validates and previews before saving. +- [Compatibility and migration](./migration): v1/v2 JSX and v2/v3 import behavior. +- [Troubleshooting](./troubleshooting): common editor, preview, permission, and networking failures. +- [Maintainer architecture](./architecture): package boundaries, extension points, and required tests. +- [Extension recipes](./extension-recipes): step-by-step changes for displays, JSX components, requests, and workbench features. + :::caution A custom widget can expose data or perform actions with the credentials configured for it. Import definitions only from sources you trust and review every network capability before using the widget on a shared board. diff --git a/apps/docs/docs/management/custom-widgets/migration.mdx b/apps/docs/docs/management/custom-widgets/migration.mdx new file mode 100644 index 000000000..828845454 --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/migration.mdx @@ -0,0 +1,19 @@ +--- +sidebar_label: Compatibility and migration +--- + +# Compatibility and migration + +Homarr preserves existing display definitions while moving network-enabled Custom JSX to the named-request model. + +## JSX API versions + +Missing `jsxApiVersion` means v1. Display-only v1 templates can be opened and saved as v2 with an empty request manifest. Inline `url`, `method`, `headers`, and body props are inert in v2. + +Static v1 network components can be converted by creating a named request and replacing inline capability props with `requestId` and typed `params`. Dynamic target construction requires an administrator to design an explicit path template and parameter list. Existing non-GET base definitions stop polling and show a network-review state. + +## Import versions + +Exports use `homarr-custom-widget-v3`; v2 imports remain accepted. Import migration normalizes display configuration, preserves v1 semantics, and never imports secret values. The review screen must be accepted before persistence. + +Test migration with the same base response and compare rendered output, query results, action simulation, permissions, and journal entries before enabling the migrated definition on shared boards. diff --git a/apps/docs/docs/management/custom-widgets/requests-and-security.mdx b/apps/docs/docs/management/custom-widgets/requests-and-security.mdx new file mode 100644 index 000000000..6afc34745 --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/requests-and-security.mdx @@ -0,0 +1,32 @@ +--- +sidebar_label: Requests and security +--- + +# Named requests and security + +Custom JSX v2 uses a saved request manifest. Runtime components pass only a `requestId` and declared primitive parameters; they cannot change the URL, method, headers, authentication, or body shape. + +## Capability kinds + +`SubFetch` references a GET `query`. `ActionButton` and `ToggleSwitch` reference a POST, PUT, PATCH, or DELETE `action`. Base data is GET-only. Actions require an explicit gesture and are never polled, cached, retried automatically, or run on mount. + +Default board permissions are view for queries, modify for POST/PUT/PATCH, and full for DELETE. Viewer actions require explicit high-risk approval; anonymous users cannot execute actions. DELETE always requires confirmation. + +## Parameter substitution + +Path placeholders use `{name}` and are URL-encoded by the server. Runtime parameters must exactly match all declared names and types. JSON bodies substitute `{ "$param": "name" }` recursively and preserve string, number, or boolean types. + +## Network boundary + +Named paths stay on the base URL origin. HTTP and HTTPS are accepted; URL credentials and fragments are rejected. DNS answers are classified and pinned. Public, private, and loopback scopes progressively allow destinations, but link-local, metadata, unspecified, multicast, documentation, carrier-grade NAT, and IPv4-mapped addresses are always blocked. + +Queries may follow three revalidated same-origin redirects. Actions do not follow redirects. Credentials never cross origins. Reserved authentication, cookie, host, forwarding, proxy, content-length, security, and hop-by-hop headers cannot be declared. + +## Limits + +- Request body: 10 KiB UTF-8. +- Decompressed response: 1 MiB, 32 JSON levels, 50,000 JSON nodes. +- Per user/item: 60 queries, 10 actions, and 3 deletes per minute. +- Concurrency: 4 per user/item and 8 per definition. + +Successful GETs can use manifest cache TTLs and single-flight deduplication. Logs contain redacted origin/method/error metadata, never secrets, request bodies, or query values. diff --git a/apps/docs/docs/management/custom-widgets/troubleshooting.mdx b/apps/docs/docs/management/custom-widgets/troubleshooting.mdx new file mode 100644 index 000000000..0fd46a3d4 --- /dev/null +++ b/apps/docs/docs/management/custom-widgets/troubleshooting.mdx @@ -0,0 +1,33 @@ +--- +sidebar_label: Troubleshooting +--- + +# Troubleshooting + +## The preview says the template is required + +New Custom JSX forms always include the starter fixture. If an imported definition has an empty template, reopen its import review; malformed imports must be corrected rather than previewed as JSX. + +## A prop is ignored + +The diagnostics name the component and prop. Check the generated component reference. Unsupported props are intentionally removed; use a supported layout primitive or wrapper prop instead of polymorphic, portal, ref, positioning, or raw handler props. + +## A request does not run + +Confirm that the component kind matches the manifest: `SubFetch` needs a query; action controls need an action. Parameter names and primitive types must match exactly. Base requests and queries require GET. Actions only run from a gesture, and edit mode disables controls. + +## Network scope errors + +Resolve the hostname from the Homarr server environment. Select private or loopback scope only when required and understood. Link-local and metadata destinations cannot be enabled by any scope. Redirects must remain on the base origin. + +## Permission errors + +The placed board item is the authorization anchor. A definition ID alone cannot authorize credential use. Verify board view/modify/full access, explicit viewer-action approval, and that the caller is not anonymous. + +## Stale or failed preview data + +Connection, authentication, body, method, secret, or manifest changes mark samples stale. Run the GET test again. Background query failures keep prior content visible and offer retry; actions roll toggles back and show error feedback. + +## Import paste is ignored + +Paste a complete v2/v3 JSON export or authoring bundle while the list or edit page is focused. Ordinary text and partial JSON are ignored so normal typing is not intercepted. diff --git a/apps/docs/src/generated/custom-jsx-components.json b/apps/docs/src/generated/custom-jsx-components.json index 014cbcc49..9103430ba 100644 --- a/apps/docs/src/generated/custom-jsx-components.json +++ b/apps/docs/src/generated/custom-jsx-components.json @@ -46,7 +46,7 @@ "package": "@mantine/core", "category": "layout", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/simplegrid/" + "documentationUrl": "https://mantine.dev/core/simple-grid/" }, { "name": "Center", @@ -74,14 +74,14 @@ "package": "@mantine/core", "category": "layout", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/aspectratio/" + "documentationUrl": "https://mantine.dev/core/aspect-ratio/" }, { "name": "ScrollArea", "package": "@mantine/core", "category": "layout", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/scrollarea/" + "documentationUrl": "https://mantine.dev/core/scroll-area/" }, { "name": "Paper", @@ -123,7 +123,7 @@ "package": "@mantine/core", "category": "layout", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/visuallyhidden/" + "documentationUrl": "https://mantine.dev/core/visually-hidden/" }, { "name": "Typography", @@ -137,7 +137,7 @@ "package": "@mantine/core", "category": "layout", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/floatingindicator/" + "documentationUrl": "https://mantine.dev/core/floating-indicator/" }, { "name": "Text", @@ -193,7 +193,7 @@ "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/numberformatter/" + "documentationUrl": "https://mantine.dev/core/number-formatter/" }, { "name": "Badge", @@ -207,14 +207,14 @@ "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/themeicon/" + "documentationUrl": "https://mantine.dev/core/theme-icon/" }, { "name": "ColorSwatch", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/colorswatch/" + "documentationUrl": "https://mantine.dev/core/color-swatch/" }, { "name": "Table", @@ -340,70 +340,70 @@ "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/backgroundimage/" + "documentationUrl": "https://mantine.dev/core/background-image/" }, { "name": "DataList", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/datalist/" + "documentationUrl": "https://mantine.dev/core/data-list/" }, { "name": "DataList.Item", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/datalist/" + "documentationUrl": "https://mantine.dev/core/data-list/" }, { "name": "DataList.ItemLabel", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/datalist/" + "documentationUrl": "https://mantine.dev/core/data-list/" }, { "name": "DataList.ItemValue", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/datalist/" + "documentationUrl": "https://mantine.dev/core/data-list/" }, { "name": "EmptyState", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/emptystate/" + "documentationUrl": "https://mantine.dev/core/empty-state/" }, { "name": "EmptyState.Indicator", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/emptystate/" + "documentationUrl": "https://mantine.dev/core/empty-state/" }, { "name": "EmptyState.Title", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/emptystate/" + "documentationUrl": "https://mantine.dev/core/empty-state/" }, { "name": "EmptyState.Description", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/emptystate/" + "documentationUrl": "https://mantine.dev/core/empty-state/" }, { "name": "EmptyState.Actions", "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/emptystate/" + "documentationUrl": "https://mantine.dev/core/empty-state/" }, { "name": "Marquee", @@ -417,7 +417,7 @@ "package": "@mantine/core", "category": "content", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/rollingnumber/" + "documentationUrl": "https://mantine.dev/core/rolling-number/" }, { "name": "Alert", @@ -445,14 +445,14 @@ "package": "@mantine/core", "category": "feedback", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/ringprogress/" + "documentationUrl": "https://mantine.dev/core/ring-progress/" }, { "name": "SemiCircleProgress", "package": "@mantine/core", "category": "feedback", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/semicircleprogress/" + "documentationUrl": "https://mantine.dev/core/semi-circle-progress/" }, { "name": "Skeleton", @@ -480,7 +480,7 @@ "package": "@mantine/core", "category": "feedback", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/core/loadingoverlay/" + "documentationUrl": "https://mantine.dev/core/loading-overlay/" }, { "name": "Overlay", @@ -557,21 +557,21 @@ "package": "@mantine/core", "category": "navigation", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/hovercard/" + "documentationUrl": "https://mantine.dev/core/hover-card/" }, { "name": "HoverCard.Target", "package": "@mantine/core", "category": "navigation", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/hovercard/" + "documentationUrl": "https://mantine.dev/core/hover-card/" }, { "name": "HoverCard.Dropdown", "package": "@mantine/core", "category": "navigation", "safety": "allowed", - "documentationUrl": "https://mantine.dev/core/hovercard/" + "documentationUrl": "https://mantine.dev/core/hover-card/" }, { "name": "Menu", @@ -655,7 +655,7 @@ "package": "@mantine/core", "category": "navigation", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/core/navlink/" + "documentationUrl": "https://mantine.dev/core/nav-link/" }, { "name": "Breadcrumbs", @@ -690,7 +690,7 @@ "package": "@mantine/core", "category": "interaction", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/core/actionicon/" + "documentationUrl": "https://mantine.dev/core/action-icon/" }, { "name": "Burger", @@ -704,7 +704,7 @@ "package": "@mantine/core", "category": "interaction", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/core/closebutton/" + "documentationUrl": "https://mantine.dev/core/close-button/" }, { "name": "Chip", @@ -725,7 +725,7 @@ "package": "@mantine/core", "category": "interaction", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/core/copybutton/" + "documentationUrl": "https://mantine.dev/core/copy-button/" }, { "name": "Pagination", @@ -746,7 +746,7 @@ "package": "@mantine/core", "category": "interaction", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/core/segmentedcontrol/" + "documentationUrl": "https://mantine.dev/core/segmented-control/" }, { "name": "Slider", @@ -767,63 +767,63 @@ "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/areachart/" + "documentationUrl": "https://mantine.dev/charts/area-chart/" }, { "name": "BarChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/barchart/" + "documentationUrl": "https://mantine.dev/charts/bar-chart/" }, { "name": "BarsList", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/barslist/" + "documentationUrl": "https://mantine.dev/charts/bars-list/" }, { "name": "BubbleChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/bubblechart/" + "documentationUrl": "https://mantine.dev/charts/bubble-chart/" }, { "name": "ChartLegend", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/chartlegend/" + "documentationUrl": "https://mantine.dev/charts/chart-legend/" }, { "name": "ChartTooltip", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/charttooltip/" + "documentationUrl": "https://mantine.dev/charts/chart-tooltip/" }, { "name": "CompositeChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/compositechart/" + "documentationUrl": "https://mantine.dev/charts/composite-chart/" }, { "name": "DonutChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/donutchart/" + "documentationUrl": "https://mantine.dev/charts/donut-chart/" }, { "name": "FunnelChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/funnelchart/" + "documentationUrl": "https://mantine.dev/charts/funnel-chart/" }, { "name": "Heatmap", @@ -837,42 +837,42 @@ "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/linechart/" + "documentationUrl": "https://mantine.dev/charts/line-chart/" }, { "name": "PieChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/piechart/" + "documentationUrl": "https://mantine.dev/charts/pie-chart/" }, { "name": "RadarChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/radarchart/" + "documentationUrl": "https://mantine.dev/charts/radar-chart/" }, { "name": "RadialBarChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/radialbarchart/" + "documentationUrl": "https://mantine.dev/charts/radial-bar-chart/" }, { "name": "SankeyChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/sankeychart/" + "documentationUrl": "https://mantine.dev/charts/sankey-chart/" }, { "name": "ScatterChart", "package": "@mantine/charts", "category": "charts", "safety": "allowed", - "documentationUrl": "https://mantine.dev/charts/scatterchart/" + "documentationUrl": "https://mantine.dev/charts/scatter-chart/" }, { "name": "Sparkline", @@ -900,14 +900,14 @@ "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/minicalendar/" + "documentationUrl": "https://mantine.dev/dates/mini-calendar/" }, { "name": "DatePicker", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/datepicker/" + "documentationUrl": "https://mantine.dev/dates/date-picker/" }, { "name": "Day", @@ -921,7 +921,7 @@ "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/weekdaysrow/" + "documentationUrl": "https://mantine.dev/dates/weekdays-row/" }, { "name": "Month", @@ -935,105 +935,105 @@ "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/calendarheader/" + "documentationUrl": "https://mantine.dev/dates/calendar-header/" }, { "name": "YearPicker", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/yearpicker/" + "documentationUrl": "https://mantine.dev/dates/year-picker/" }, { "name": "MonthPicker", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/monthpicker/" + "documentationUrl": "https://mantine.dev/dates/month-picker/" }, { "name": "TimeGrid", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/timegrid/" + "documentationUrl": "https://mantine.dev/dates/time-grid/" }, { "name": "PickerControl", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/pickercontrol/" + "documentationUrl": "https://mantine.dev/dates/picker-control/" }, { "name": "YearsList", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/yearslist/" + "documentationUrl": "https://mantine.dev/dates/years-list/" }, { "name": "MonthsList", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/monthslist/" + "documentationUrl": "https://mantine.dev/dates/months-list/" }, { "name": "DecadeLevel", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/decadelevel/" + "documentationUrl": "https://mantine.dev/dates/decade-level/" }, { "name": "YearLevel", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/yearlevel/" + "documentationUrl": "https://mantine.dev/dates/year-level/" }, { "name": "MonthLevel", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/monthlevel/" + "documentationUrl": "https://mantine.dev/dates/month-level/" }, { "name": "LevelsGroup", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/levelsgroup/" + "documentationUrl": "https://mantine.dev/dates/levels-group/" }, { "name": "DecadeLevelGroup", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/decadelevelgroup/" + "documentationUrl": "https://mantine.dev/dates/decade-level-group/" }, { "name": "YearLevelGroup", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/yearlevelgroup/" + "documentationUrl": "https://mantine.dev/dates/year-level-group/" }, { "name": "MonthLevelGroup", "package": "@mantine/dates", "category": "dates", "safety": "wrapped", - "documentationUrl": "https://mantine.dev/dates/monthlevelgroup/" + "documentationUrl": "https://mantine.dev/dates/month-level-group/" }, { "name": "TimeValue", "package": "@mantine/dates", "category": "dates", "safety": "allowed", - "documentationUrl": "https://mantine.dev/dates/timevalue/" + "documentationUrl": "https://mantine.dev/dates/time-value/" }, { "name": "PaginatedList", @@ -1112,13 +1112,20 @@ "safety": "wrapped", "documentationUrl": "https://homarr.dev/docs/management/custom-widgets/" }, + { + "name": "TablerIcon", + "package": "@homarr/widgets", + "category": "content", + "safety": "wrapped", + "documentationUrl": "https://homarr.dev/docs/management/custom-widgets/" + }, { "name": "AppShell", "package": "@mantine/core", "category": "blocked", "safety": "denied", "reason": "Escapes the widget layout or focus boundary", - "documentationUrl": "https://mantine.dev/core/appshell/" + "documentationUrl": "https://mantine.dev/core/app-shell/" }, { "name": "Affix", @@ -1134,7 +1141,7 @@ "category": "blocked", "safety": "denied", "reason": "Escapes the widget layout or focus boundary", - "documentationUrl": "https://mantine.dev/core/comboboxpopover/" + "documentationUrl": "https://mantine.dev/core/combobox-popover/" }, { "name": "Dialog", @@ -1158,7 +1165,7 @@ "category": "blocked", "safety": "denied", "reason": "Escapes the widget layout or focus boundary", - "documentationUrl": "https://mantine.dev/core/floatingwindow/" + "documentationUrl": "https://mantine.dev/core/floating-window/" }, { "name": "FocusTrap", @@ -1166,7 +1173,7 @@ "category": "blocked", "safety": "denied", "reason": "Escapes the widget layout or focus boundary", - "documentationUrl": "https://mantine.dev/core/focustrap/" + "documentationUrl": "https://mantine.dev/core/focus-trap/" }, { "name": "Menubar", @@ -1190,7 +1197,7 @@ "category": "blocked", "safety": "denied", "reason": "Escapes the widget layout or focus boundary", - "documentationUrl": "https://mantine.dev/core/modalbase/" + "documentationUrl": "https://mantine.dev/core/modal-base/" }, { "name": "Portal", @@ -1214,7 +1221,7 @@ "category": "blocked", "safety": "denied", "reason": "Escapes the widget layout or focus boundary", - "documentationUrl": "https://mantine.dev/core/removescroll/" + "documentationUrl": "https://mantine.dev/core/remove-scroll/" }, { "name": "AngleSlider", @@ -1222,7 +1229,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/angleslider/" + "documentationUrl": "https://mantine.dev/core/angle-slider/" }, { "name": "Autocomplete", @@ -1246,7 +1253,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/colorinput/" + "documentationUrl": "https://mantine.dev/core/color-input/" }, { "name": "ColorPicker", @@ -1254,7 +1261,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/colorpicker/" + "documentationUrl": "https://mantine.dev/core/color-picker/" }, { "name": "Combobox", @@ -1270,7 +1277,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/filebutton/" + "documentationUrl": "https://mantine.dev/core/file-button/" }, { "name": "FileInput", @@ -1278,7 +1285,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/fileinput/" + "documentationUrl": "https://mantine.dev/core/file-input/" }, { "name": "Input", @@ -1294,7 +1301,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/inputbase/" + "documentationUrl": "https://mantine.dev/core/input-base/" }, { "name": "JsonInput", @@ -1302,7 +1309,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/jsoninput/" + "documentationUrl": "https://mantine.dev/core/json-input/" }, { "name": "MaskInput", @@ -1310,7 +1317,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/maskinput/" + "documentationUrl": "https://mantine.dev/core/mask-input/" }, { "name": "MultiSelect", @@ -1318,7 +1325,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/multiselect/" + "documentationUrl": "https://mantine.dev/core/multi-select/" }, { "name": "NativeSelect", @@ -1326,7 +1333,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/nativeselect/" + "documentationUrl": "https://mantine.dev/core/native-select/" }, { "name": "NumberInput", @@ -1334,7 +1341,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/numberinput/" + "documentationUrl": "https://mantine.dev/core/number-input/" }, { "name": "PasswordInput", @@ -1342,7 +1349,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/passwordinput/" + "documentationUrl": "https://mantine.dev/core/password-input/" }, { "name": "PillsInput", @@ -1350,7 +1357,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/pillsinput/" + "documentationUrl": "https://mantine.dev/core/pills-input/" }, { "name": "PinInput", @@ -1358,7 +1365,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/pininput/" + "documentationUrl": "https://mantine.dev/core/pin-input/" }, { "name": "Radio", @@ -1382,7 +1389,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/tagsinput/" + "documentationUrl": "https://mantine.dev/core/tags-input/" }, { "name": "Textarea", @@ -1398,7 +1405,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/textinput/" + "documentationUrl": "https://mantine.dev/core/text-input/" }, { "name": "TreeSelect", @@ -1406,7 +1413,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/treeselect/" + "documentationUrl": "https://mantine.dev/core/tree-select/" }, { "name": "UnstyledButton", @@ -1414,7 +1421,7 @@ "category": "blocked", "safety": "denied", "reason": "Arbitrary form controls are not connected to the declarative action model", - "documentationUrl": "https://mantine.dev/core/unstyledbutton/" + "documentationUrl": "https://mantine.dev/core/unstyled-button/" }, { "name": "OverflowList", @@ -1422,7 +1429,7 @@ "category": "blocked", "safety": "denied", "reason": "Requires callback, document, or layout capabilities that are not exposed to templates", - "documentationUrl": "https://mantine.dev/core/overflowlist/" + "documentationUrl": "https://mantine.dev/core/overflow-list/" }, { "name": "Scroller", @@ -1446,7 +1453,7 @@ "category": "blocked", "safety": "denied", "reason": "Requires callback, document, or layout capabilities that are not exposed to templates", - "documentationUrl": "https://mantine.dev/core/tableofcontents/" + "documentationUrl": "https://mantine.dev/core/table-of-contents/" }, { "name": "AccordionChevron", @@ -1454,7 +1461,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/accordionchevron/" + "documentationUrl": "https://mantine.dev/core/accordion-chevron/" }, { "name": "ActionIconGroup", @@ -1462,7 +1469,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/actionicongroup/" + "documentationUrl": "https://mantine.dev/core/action-icon-group/" }, { "name": "ActionIconGroupSection", @@ -1470,7 +1477,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/actionicongroupsection/" + "documentationUrl": "https://mantine.dev/core/action-icon-group-section/" }, { "name": "AlphaSlider", @@ -1478,7 +1485,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/alphaslider/" + "documentationUrl": "https://mantine.dev/core/alpha-slider/" }, { "name": "AppShellAside", @@ -1486,7 +1493,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/appshellaside/" + "documentationUrl": "https://mantine.dev/core/app-shell-aside/" }, { "name": "AppShellFooter", @@ -1494,7 +1501,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/appshellfooter/" + "documentationUrl": "https://mantine.dev/core/app-shell-footer/" }, { "name": "AppShellHeader", @@ -1502,7 +1509,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/appshellheader/" + "documentationUrl": "https://mantine.dev/core/app-shell-header/" }, { "name": "AppShellMain", @@ -1510,7 +1517,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/appshellmain/" + "documentationUrl": "https://mantine.dev/core/app-shell-main/" }, { "name": "AppShellNavbar", @@ -1518,7 +1525,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/appshellnavbar/" + "documentationUrl": "https://mantine.dev/core/app-shell-navbar/" }, { "name": "AppShellSection", @@ -1526,7 +1533,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/appshellsection/" + "documentationUrl": "https://mantine.dev/core/app-shell-section/" }, { "name": "ButtonGroup", @@ -1534,7 +1541,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/buttongroup/" + "documentationUrl": "https://mantine.dev/core/button-group/" }, { "name": "ButtonGroupSection", @@ -1542,7 +1549,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/buttongroupsection/" + "documentationUrl": "https://mantine.dev/core/button-group-section/" }, { "name": "CheckIcon", @@ -1550,7 +1557,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/checkicon/" + "documentationUrl": "https://mantine.dev/core/check-icon/" }, { "name": "CheckboxCard", @@ -1558,7 +1565,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/checkboxcard/" + "documentationUrl": "https://mantine.dev/core/checkbox-card/" }, { "name": "CheckboxGroup", @@ -1566,7 +1573,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/checkboxgroup/" + "documentationUrl": "https://mantine.dev/core/checkbox-group/" }, { "name": "CheckboxIndicator", @@ -1574,7 +1581,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/checkboxindicator/" + "documentationUrl": "https://mantine.dev/core/checkbox-indicator/" }, { "name": "CloseIcon", @@ -1582,7 +1589,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/closeicon/" + "documentationUrl": "https://mantine.dev/core/close-icon/" }, { "name": "ColorSchemeScript", @@ -1590,7 +1597,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/colorschemescript/" + "documentationUrl": "https://mantine.dev/core/color-scheme-script/" }, { "name": "ComboboxChevron", @@ -1598,7 +1605,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxchevron/" + "documentationUrl": "https://mantine.dev/core/combobox-chevron/" }, { "name": "ComboboxClearButton", @@ -1606,7 +1613,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxclearbutton/" + "documentationUrl": "https://mantine.dev/core/combobox-clear-button/" }, { "name": "ComboboxDropdown", @@ -1614,7 +1621,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxdropdown/" + "documentationUrl": "https://mantine.dev/core/combobox-dropdown/" }, { "name": "ComboboxDropdownTarget", @@ -1622,7 +1629,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxdropdowntarget/" + "documentationUrl": "https://mantine.dev/core/combobox-dropdown-target/" }, { "name": "ComboboxEmpty", @@ -1630,7 +1637,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxempty/" + "documentationUrl": "https://mantine.dev/core/combobox-empty/" }, { "name": "ComboboxEventsTarget", @@ -1638,7 +1645,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxeventstarget/" + "documentationUrl": "https://mantine.dev/core/combobox-events-target/" }, { "name": "ComboboxFooter", @@ -1646,7 +1653,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxfooter/" + "documentationUrl": "https://mantine.dev/core/combobox-footer/" }, { "name": "ComboboxGroup", @@ -1654,7 +1661,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxgroup/" + "documentationUrl": "https://mantine.dev/core/combobox-group/" }, { "name": "ComboboxHeader", @@ -1662,7 +1669,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxheader/" + "documentationUrl": "https://mantine.dev/core/combobox-header/" }, { "name": "ComboboxHiddenInput", @@ -1670,7 +1677,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxhiddeninput/" + "documentationUrl": "https://mantine.dev/core/combobox-hidden-input/" }, { "name": "ComboboxOption", @@ -1678,7 +1685,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxoption/" + "documentationUrl": "https://mantine.dev/core/combobox-option/" }, { "name": "ComboboxOptions", @@ -1686,7 +1693,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxoptions/" + "documentationUrl": "https://mantine.dev/core/combobox-options/" }, { "name": "ComboboxPopoverTarget", @@ -1694,7 +1701,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxpopovertarget/" + "documentationUrl": "https://mantine.dev/core/combobox-popover-target/" }, { "name": "ComboboxSearch", @@ -1702,7 +1709,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxsearch/" + "documentationUrl": "https://mantine.dev/core/combobox-search/" }, { "name": "ComboboxTarget", @@ -1710,7 +1717,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/comboboxtarget/" + "documentationUrl": "https://mantine.dev/core/combobox-target/" }, { "name": "DirectionProvider", @@ -1718,7 +1725,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/directionprovider/" + "documentationUrl": "https://mantine.dev/core/direction-provider/" }, { "name": "DrawerBody", @@ -1726,7 +1733,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/drawerbody/" + "documentationUrl": "https://mantine.dev/core/drawer-body/" }, { "name": "DrawerCloseButton", @@ -1734,7 +1741,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/drawerclosebutton/" + "documentationUrl": "https://mantine.dev/core/drawer-close-button/" }, { "name": "DrawerContent", @@ -1742,7 +1749,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/drawercontent/" + "documentationUrl": "https://mantine.dev/core/drawer-content/" }, { "name": "DrawerHeader", @@ -1750,7 +1757,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/drawerheader/" + "documentationUrl": "https://mantine.dev/core/drawer-header/" }, { "name": "DrawerOverlay", @@ -1758,7 +1765,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/draweroverlay/" + "documentationUrl": "https://mantine.dev/core/drawer-overlay/" }, { "name": "DrawerRoot", @@ -1766,7 +1773,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/drawerroot/" + "documentationUrl": "https://mantine.dev/core/drawer-root/" }, { "name": "DrawerStack", @@ -1774,7 +1781,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/drawerstack/" + "documentationUrl": "https://mantine.dev/core/drawer-stack/" }, { "name": "DrawerTitle", @@ -1782,7 +1789,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/drawertitle/" + "documentationUrl": "https://mantine.dev/core/drawer-title/" }, { "name": "FlatTreeNode", @@ -1790,7 +1797,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/flattreenode/" + "documentationUrl": "https://mantine.dev/core/flat-tree-node/" }, { "name": "FloatingArrow", @@ -1798,7 +1805,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/floatingarrow/" + "documentationUrl": "https://mantine.dev/core/floating-arrow/" }, { "name": "FocusTrapInitialFocus", @@ -1806,7 +1813,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/focustrapinitialfocus/" + "documentationUrl": "https://mantine.dev/core/focus-trap-initial-focus/" }, { "name": "HeadlessMantineProvider", @@ -1814,7 +1821,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/headlessmantineprovider/" + "documentationUrl": "https://mantine.dev/core/headless-mantine-provider/" }, { "name": "HoverCardGroup", @@ -1822,7 +1829,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/hovercardgroup/" + "documentationUrl": "https://mantine.dev/core/hover-card-group/" }, { "name": "HueSlider", @@ -1830,7 +1837,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/hueslider/" + "documentationUrl": "https://mantine.dev/core/hue-slider/" }, { "name": "InlineStyles", @@ -1838,7 +1845,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inlinestyles/" + "documentationUrl": "https://mantine.dev/core/inline-styles/" }, { "name": "InputClearButton", @@ -1846,7 +1853,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputclearbutton/" + "documentationUrl": "https://mantine.dev/core/input-clear-button/" }, { "name": "InputClearSection", @@ -1854,7 +1861,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputclearsection/" + "documentationUrl": "https://mantine.dev/core/input-clear-section/" }, { "name": "InputDescription", @@ -1862,7 +1869,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputdescription/" + "documentationUrl": "https://mantine.dev/core/input-description/" }, { "name": "InputError", @@ -1870,7 +1877,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputerror/" + "documentationUrl": "https://mantine.dev/core/input-error/" }, { "name": "InputLabel", @@ -1878,7 +1885,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputlabel/" + "documentationUrl": "https://mantine.dev/core/input-label/" }, { "name": "InputPlaceholder", @@ -1886,7 +1893,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputplaceholder/" + "documentationUrl": "https://mantine.dev/core/input-placeholder/" }, { "name": "InputSuccess", @@ -1894,7 +1901,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputsuccess/" + "documentationUrl": "https://mantine.dev/core/input-success/" }, { "name": "InputWrapper", @@ -1902,7 +1909,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/inputwrapper/" + "documentationUrl": "https://mantine.dev/core/input-wrapper/" }, { "name": "MantineProvider", @@ -1910,7 +1917,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/mantineprovider/" + "documentationUrl": "https://mantine.dev/core/mantine-provider/" }, { "name": "MantineThemeProvider", @@ -1918,7 +1925,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/mantinethemeprovider/" + "documentationUrl": "https://mantine.dev/core/mantine-theme-provider/" }, { "name": "MenuCheckboxGroup", @@ -1926,7 +1933,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menucheckboxgroup/" + "documentationUrl": "https://mantine.dev/core/menu-checkbox-group/" }, { "name": "MenuCheckboxItem", @@ -1934,7 +1941,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menucheckboxitem/" + "documentationUrl": "https://mantine.dev/core/menu-checkbox-item/" }, { "name": "MenuContextMenu", @@ -1942,7 +1949,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menucontextmenu/" + "documentationUrl": "https://mantine.dev/core/menu-context-menu/" }, { "name": "MenuRadioGroup", @@ -1950,7 +1957,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menuradiogroup/" + "documentationUrl": "https://mantine.dev/core/menu-radio-group/" }, { "name": "MenuRadioItem", @@ -1958,7 +1965,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menuradioitem/" + "documentationUrl": "https://mantine.dev/core/menu-radio-item/" }, { "name": "MenuSearch", @@ -1966,7 +1973,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menusearch/" + "documentationUrl": "https://mantine.dev/core/menu-search/" }, { "name": "MenuSub", @@ -1974,7 +1981,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menusub/" + "documentationUrl": "https://mantine.dev/core/menu-sub/" }, { "name": "MenuSubDropdown", @@ -1982,7 +1989,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menusubdropdown/" + "documentationUrl": "https://mantine.dev/core/menu-sub-dropdown/" }, { "name": "MenuSubItem", @@ -1990,7 +1997,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menusubitem/" + "documentationUrl": "https://mantine.dev/core/menu-sub-item/" }, { "name": "MenuSubTarget", @@ -1998,7 +2005,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menusubtarget/" + "documentationUrl": "https://mantine.dev/core/menu-sub-target/" }, { "name": "MenubarDropdown", @@ -2006,7 +2013,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menubardropdown/" + "documentationUrl": "https://mantine.dev/core/menubar-dropdown/" }, { "name": "MenubarMenu", @@ -2014,7 +2021,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menubarmenu/" + "documentationUrl": "https://mantine.dev/core/menubar-menu/" }, { "name": "MenubarTarget", @@ -2022,7 +2029,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/menubartarget/" + "documentationUrl": "https://mantine.dev/core/menubar-target/" }, { "name": "ModalBaseBody", @@ -2030,7 +2037,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalbasebody/" + "documentationUrl": "https://mantine.dev/core/modal-base-body/" }, { "name": "ModalBaseCloseButton", @@ -2038,7 +2045,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalbaseclosebutton/" + "documentationUrl": "https://mantine.dev/core/modal-base-close-button/" }, { "name": "ModalBaseContent", @@ -2046,7 +2053,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalbasecontent/" + "documentationUrl": "https://mantine.dev/core/modal-base-content/" }, { "name": "ModalBaseHeader", @@ -2054,7 +2061,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalbaseheader/" + "documentationUrl": "https://mantine.dev/core/modal-base-header/" }, { "name": "ModalBaseOverlay", @@ -2062,7 +2069,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalbaseoverlay/" + "documentationUrl": "https://mantine.dev/core/modal-base-overlay/" }, { "name": "ModalBaseTitle", @@ -2070,7 +2077,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalbasetitle/" + "documentationUrl": "https://mantine.dev/core/modal-base-title/" }, { "name": "ModalBody", @@ -2078,7 +2085,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalbody/" + "documentationUrl": "https://mantine.dev/core/modal-body/" }, { "name": "ModalCloseButton", @@ -2086,7 +2093,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalclosebutton/" + "documentationUrl": "https://mantine.dev/core/modal-close-button/" }, { "name": "ModalContent", @@ -2094,7 +2101,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalcontent/" + "documentationUrl": "https://mantine.dev/core/modal-content/" }, { "name": "ModalHeader", @@ -2102,7 +2109,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalheader/" + "documentationUrl": "https://mantine.dev/core/modal-header/" }, { "name": "ModalOverlay", @@ -2110,7 +2117,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modaloverlay/" + "documentationUrl": "https://mantine.dev/core/modal-overlay/" }, { "name": "ModalRoot", @@ -2118,7 +2125,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalroot/" + "documentationUrl": "https://mantine.dev/core/modal-root/" }, { "name": "ModalStack", @@ -2126,7 +2133,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modalstack/" + "documentationUrl": "https://mantine.dev/core/modal-stack/" }, { "name": "ModalTitle", @@ -2134,7 +2141,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/modaltitle/" + "documentationUrl": "https://mantine.dev/core/modal-title/" }, { "name": "NativeScrollArea", @@ -2142,7 +2149,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/nativescrollarea/" + "documentationUrl": "https://mantine.dev/core/native-scroll-area/" }, { "name": "OptionalPortal", @@ -2150,7 +2157,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/optionalportal/" + "documentationUrl": "https://mantine.dev/core/optional-portal/" }, { "name": "OptionsDropdown", @@ -2158,7 +2165,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/optionsdropdown/" + "documentationUrl": "https://mantine.dev/core/options-dropdown/" }, { "name": "PaginationControl", @@ -2166,7 +2173,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationcontrol/" + "documentationUrl": "https://mantine.dev/core/pagination-control/" }, { "name": "PaginationDots", @@ -2174,7 +2181,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationdots/" + "documentationUrl": "https://mantine.dev/core/pagination-dots/" }, { "name": "PaginationFirst", @@ -2182,7 +2189,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationfirst/" + "documentationUrl": "https://mantine.dev/core/pagination-first/" }, { "name": "PaginationItems", @@ -2190,7 +2197,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationitems/" + "documentationUrl": "https://mantine.dev/core/pagination-items/" }, { "name": "PaginationLabel", @@ -2198,7 +2205,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationlabel/" + "documentationUrl": "https://mantine.dev/core/pagination-label/" }, { "name": "PaginationLast", @@ -2206,7 +2213,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationlast/" + "documentationUrl": "https://mantine.dev/core/pagination-last/" }, { "name": "PaginationNext", @@ -2214,7 +2221,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationnext/" + "documentationUrl": "https://mantine.dev/core/pagination-next/" }, { "name": "PaginationPrevious", @@ -2222,7 +2229,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationprevious/" + "documentationUrl": "https://mantine.dev/core/pagination-previous/" }, { "name": "PaginationRoot", @@ -2230,7 +2237,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/paginationroot/" + "documentationUrl": "https://mantine.dev/core/pagination-root/" }, { "name": "PillGroup", @@ -2238,7 +2245,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/pillgroup/" + "documentationUrl": "https://mantine.dev/core/pill-group/" }, { "name": "PillsInputField", @@ -2246,7 +2253,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/pillsinputfield/" + "documentationUrl": "https://mantine.dev/core/pills-input-field/" }, { "name": "PopoverContextMenu", @@ -2254,7 +2261,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/popovercontextmenu/" + "documentationUrl": "https://mantine.dev/core/popover-context-menu/" }, { "name": "PopoverDropdown", @@ -2262,7 +2269,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/popoverdropdown/" + "documentationUrl": "https://mantine.dev/core/popover-dropdown/" }, { "name": "PopoverTarget", @@ -2270,7 +2277,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/popovertarget/" + "documentationUrl": "https://mantine.dev/core/popover-target/" }, { "name": "ProgressLabel", @@ -2278,7 +2285,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/progresslabel/" + "documentationUrl": "https://mantine.dev/core/progress-label/" }, { "name": "ProgressRoot", @@ -2286,7 +2293,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/progressroot/" + "documentationUrl": "https://mantine.dev/core/progress-root/" }, { "name": "RadioCard", @@ -2294,7 +2301,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/radiocard/" + "documentationUrl": "https://mantine.dev/core/radio-card/" }, { "name": "RadioGroup", @@ -2302,7 +2309,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/radiogroup/" + "documentationUrl": "https://mantine.dev/core/radio-group/" }, { "name": "RadioIcon", @@ -2310,7 +2317,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/radioicon/" + "documentationUrl": "https://mantine.dev/core/radio-icon/" }, { "name": "RadioIndicator", @@ -2318,7 +2325,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/radioindicator/" + "documentationUrl": "https://mantine.dev/core/radio-indicator/" }, { "name": "RangeSlider", @@ -2326,7 +2333,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/rangeslider/" + "documentationUrl": "https://mantine.dev/core/range-slider/" }, { "name": "ScrollAreaAutosize", @@ -2334,7 +2341,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/scrollareaautosize/" + "documentationUrl": "https://mantine.dev/core/scroll-area-autosize/" }, { "name": "SplitterPane", @@ -2342,7 +2349,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/splitterpane/" + "documentationUrl": "https://mantine.dev/core/splitter-pane/" }, { "name": "StepperCompleted", @@ -2350,7 +2357,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/steppercompleted/" + "documentationUrl": "https://mantine.dev/core/stepper-completed/" }, { "name": "SwitchGroup", @@ -2358,7 +2365,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/switchgroup/" + "documentationUrl": "https://mantine.dev/core/switch-group/" }, { "name": "TableScrollContainer", @@ -2366,7 +2373,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/tablescrollcontainer/" + "documentationUrl": "https://mantine.dev/core/table-scroll-container/" }, { "name": "TooltipFloating", @@ -2374,7 +2381,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/tooltipfloating/" + "documentationUrl": "https://mantine.dev/core/tooltip-floating/" }, { "name": "TooltipGroup", @@ -2382,7 +2389,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/tooltipgroup/" + "documentationUrl": "https://mantine.dev/core/tooltip-group/" }, { "name": "TreeSelectOption", @@ -2390,7 +2397,7 @@ "category": "blocked", "safety": "denied", "reason": "Internal, provider, compound-control, form, portal, or document-level export outside the safe declarative surface", - "documentationUrl": "https://mantine.dev/core/treeselectoption/" + "documentationUrl": "https://mantine.dev/core/tree-select-option/" }, { "name": "AreaGradient", @@ -2398,7 +2405,7 @@ "category": "blocked", "safety": "denied", "reason": "Low-level chart implementation helper that is not a standalone declarative display component", - "documentationUrl": "https://mantine.dev/charts/areagradient/" + "documentationUrl": "https://mantine.dev/charts/area-gradient/" }, { "name": "DatesProvider", @@ -2406,7 +2413,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/datesprovider/" + "documentationUrl": "https://mantine.dev/dates/dates-provider/" }, { "name": "HiddenDatesInput", @@ -2414,7 +2421,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/hiddendatesinput/" + "documentationUrl": "https://mantine.dev/dates/hidden-dates-input/" }, { "name": "TimeInput", @@ -2422,7 +2429,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/timeinput/" + "documentationUrl": "https://mantine.dev/dates/time-input/" }, { "name": "TimePicker", @@ -2430,7 +2437,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/timepicker/" + "documentationUrl": "https://mantine.dev/dates/time-picker/" }, { "name": "PickerInputBase", @@ -2438,7 +2445,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/pickerinputbase/" + "documentationUrl": "https://mantine.dev/dates/picker-input-base/" }, { "name": "DateInput", @@ -2446,7 +2453,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/dateinput/" + "documentationUrl": "https://mantine.dev/dates/date-input/" }, { "name": "DateTimePicker", @@ -2454,7 +2461,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/datetimepicker/" + "documentationUrl": "https://mantine.dev/dates/date-time-picker/" }, { "name": "InlineDateTimePicker", @@ -2462,7 +2469,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/inlinedatetimepicker/" + "documentationUrl": "https://mantine.dev/dates/inline-date-time-picker/" }, { "name": "YearPickerInput", @@ -2470,7 +2477,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/yearpickerinput/" + "documentationUrl": "https://mantine.dev/dates/year-picker-input/" }, { "name": "MonthPickerInput", @@ -2478,7 +2485,7 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/monthpickerinput/" + "documentationUrl": "https://mantine.dev/dates/month-picker-input/" }, { "name": "DatePickerInput", @@ -2486,6 +2493,6 @@ "category": "blocked", "safety": "denied", "reason": "Input and provider components are outside the read-only template surface", - "documentationUrl": "https://mantine.dev/dates/datepickerinput/" + "documentationUrl": "https://mantine.dev/dates/date-picker-input/" } ] diff --git a/apps/nextjs/package.json b/apps/nextjs/package.json index 65612a08c..b805c8a46 100644 --- a/apps/nextjs/package.json +++ b/apps/nextjs/package.json @@ -31,6 +31,7 @@ "@homarr/boards": "workspace:^0.1.0", "@homarr/common": "workspace:^0.1.0", "@homarr/core": "workspace:^0.1.0", + "@homarr/custom-widgets": "workspace:^0.1.0", "@homarr/cron-job-status": "workspace:^0.1.0", "@homarr/db": "workspace:^0.1.0", "@homarr/definitions": "workspace:^0.1.0", diff --git a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_beta-banner.tsx b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_beta-banner.tsx index 6ac28cd7c..6a9ab18cc 100644 --- a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_beta-banner.tsx +++ b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_beta-banner.tsx @@ -1,18 +1,21 @@ +"use client"; + import { Alert, Anchor, Text } from "@mantine/core"; import { IconFlask } from "@tabler/icons-react"; +import { useScopedI18n } from "@homarr/translation/client"; const FEEDBACK_URL = "https://github.com/homarr-labs/homarr/discussions/categories/custom-widgets"; export function CustomWidgetBetaBanner() { + const t = useScopedI18n("customWidget.betaBanner"); return ( - }> + }> - This feature is experimental and will probably change a lot in the future. If you encounter bugs, wish it did - more, or find something confusing, then please complain to us as much as possible! Only feedback posted on the{" "} + {t("description")}{" "} - official discussion thread + {t("link")} {" "} - will be taken into account. Happy Hacking! + {t("closing")} ); diff --git a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor-diagnostics.tsx b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor-diagnostics.tsx new file mode 100644 index 000000000..0da12af38 --- /dev/null +++ b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor-diagnostics.tsx @@ -0,0 +1,51 @@ +import type { EditorView } from "@codemirror/view"; +import { Alert, Stack, Text, UnstyledButton } from "@mantine/core"; +import { IconAlertTriangle } from "@tabler/icons-react"; + +import type { EditorDiagnostic } from "@homarr/custom-widgets/workbench"; + +import classes from "./_code-editor.module.css"; + +interface CodeEditorDiagnosticsProps { + diagnostics: EditorDiagnostic[]; + editorView: EditorView | null; + title: string; + formatDiagnostic: (diagnostic: EditorDiagnostic) => string; +} + +export function CodeEditorDiagnostics({ + diagnostics, + editorView, + title, + formatDiagnostic, +}: CodeEditorDiagnosticsProps) { + if (diagnostics.length === 0) return null; + return ( + + {diagnostics.map((diagnostic, index) => ( +
  • + { + if (!editorView || diagnostic.index === undefined) return; + const anchor = Math.min(diagnostic.index, editorView.state.doc.length); + editorView.dispatch({ selection: { anchor }, scrollIntoView: true }); + editorView.focus(); + }} + > + } + > + {formatDiagnostic(diagnostic)} + + +
  • + ))} +
    + ); +} diff --git a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor.tsx b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor.tsx index 97bc4177a..769b9940c 100644 --- a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor.tsx +++ b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_code-editor.tsx @@ -8,37 +8,15 @@ import { redo, redoDepth, undo, undoDepth } from "@codemirror/commands"; import { javascript } from "@codemirror/lang-javascript"; import { json } from "@codemirror/lang-json"; import { linter } from "@codemirror/lint"; -import type { EditorView } from "@codemirror/view"; -import { - Alert, - Badge, - Button, - Group, - Input, - Loader, - Popover, - ScrollArea, - Stack, - Text, - TextInput, - UnstyledButton, - useComputedColorScheme, -} from "@mantine/core"; -import { - IconAlertTriangle, - IconArrowBackUp, - IconArrowForwardUp, - IconCheck, - IconCode, - IconComponents, - IconFileCode, - IconSearch, - IconWand, -} from "@tabler/icons-react"; -import { enabledCustomJsxComponents } from "@homarr/definitions"; +import { EditorView } from "@codemirror/view"; +import { Badge, Button, Group, Input, Loader, Text, useComputedColorScheme } from "@mantine/core"; +import { IconArrowBackUp, IconArrowForwardUp, IconCheck, IconCode, IconFileCode, IconWand } from "@tabler/icons-react"; +import { enabledCustomJsxComponents } from "@homarr/custom-widgets/core"; +import { ComponentReference } from "@homarr/custom-widgets/workbench"; +import type { EditorDiagnostic } from "@homarr/custom-widgets/workbench"; import { useScopedI18n } from "@homarr/translation/client"; -import { validateCustomJsxTemplate } from "@homarr/validation/custom-jsx-template"; +import { CodeEditorDiagnostics } from "./_code-editor-diagnostics"; import classes from "./_code-editor.module.css"; const Editor = dynamic(() => import("@uiw/react-codemirror").then((module) => module.default), { @@ -50,43 +28,6 @@ const Editor = dynamic(() => import("@uiw/react-codemirror").then((module) => mo ), }); -export const CUSTOM_JSX_TEMPLATE_LIMIT = 50_000; - -export type EditorDiagnosticCode = - | "ast" - | "dangerousProperty" - | "dynamicRequestId" - | "eventHandler" - | "invalidRequestManifest" - | "legacyNetworkProps" - | "missingRequestId" - | "templateEmpty" - | "templateTooLong" - | "unknownRequest" - | "unsafeTag"; - -export interface EditorDiagnostic { - code: EditorDiagnosticCode; - severity: "error" | "warning"; - line?: number; - column?: number; - index?: number; - value?: string; -} - -interface AnalyzeJsxTemplateOptions { - apiVersion?: 1 | 2; - requestIds?: string[]; -} - -const unsafeTagPattern = /<\s*\/?\s*(script|iframe|object|embed|form|style|link|meta|base)\b/giu; -const eventHandlerPattern = /\s(on[A-Z][\w]*)\s*=/gu; -const dangerousPropertyPattern = - /(?:\.|\[\s*["'])(constructor|prototype|__proto__|caller|callee|arguments|bind|call|apply)(?:["']\s*\])?/giu; -const networkComponentPattern = /<(SubFetch|ActionButton|ToggleSwitch)\b([^>]*)>/giu; - -const getLine = (source: string, index: number) => source.slice(0, index).split("\n").length; - const customJsxCompletionSource: CompletionSource = (context) => { const word = context.matchBefore(/[A-Z][\w.]*/u); if (!word && !context.explicit) return null; @@ -100,111 +41,6 @@ const customJsxCompletionSource: CompletionSource = (context) => { }; }; -export function analyzeJsxTemplate( - template: string, - { apiVersion = 1, requestIds = [] }: AnalyzeJsxTemplateOptions = {}, -): EditorDiagnostic[] { - const diagnostics: EditorDiagnostic[] = []; - - if (template.trim().length === 0) { - diagnostics.push({ code: "templateEmpty", severity: "error", line: 1, column: 1, index: 0 }); - } - if (template.length > CUSTOM_JSX_TEMPLATE_LIMIT) { - diagnostics.push({ code: "templateTooLong", severity: "error", line: 1, column: 1, index: 0 }); - } - - for (const diagnostic of validateCustomJsxTemplate(template)) { - diagnostics.push({ - code: "ast", - severity: diagnostic.severity, - line: diagnostic.line, - column: diagnostic.column, - index: diagnostic.index, - value: diagnostic.message, - }); - } - - for (const match of template.matchAll(unsafeTagPattern)) { - diagnostics.push({ - code: "unsafeTag", - severity: "error", - line: getLine(template, match.index), - index: match.index, - value: match[1], - }); - } - for (const match of template.matchAll(eventHandlerPattern)) { - if (match[1] === "onParams") continue; - diagnostics.push({ - code: "eventHandler", - severity: "error", - line: getLine(template, match.index), - index: match.index, - value: match[1], - }); - } - for (const match of template.matchAll(dangerousPropertyPattern)) { - diagnostics.push({ - code: "dangerousProperty", - severity: "error", - line: getLine(template, match.index), - index: match.index, - value: match[1], - }); - } - - if (apiVersion === 2) { - const knownRequestIds = new Set(requestIds); - for (const match of template.matchAll(networkComponentPattern)) { - const props = match[2] ?? ""; - const line = getLine(template, match.index); - if (/\b(?:url|method|headers|body|onBody|offBody)\s*=/iu.test(props)) { - diagnostics.push({ code: "legacyNetworkProps", severity: "error", line, index: match.index }); - } - - const staticRequest = props.match(/\brequestId\s*=\s*["']([^"']+)["']/iu); - if (staticRequest?.[1]) { - if (!knownRequestIds.has(staticRequest[1])) { - diagnostics.push({ - code: "unknownRequest", - severity: "error", - line, - index: match.index, - value: staticRequest[1], - }); - } - } else if (/\brequestId\s*=/iu.test(props)) { - diagnostics.push({ code: "dynamicRequestId", severity: "error", line, index: match.index }); - } else { - diagnostics.push({ code: "missingRequestId", severity: "error", line, index: match.index }); - } - } - } - - return diagnostics; -} - -export function analyzeRequestManifest(value: string): EditorDiagnostic[] { - try { - const parsed: unknown = JSON.parse(value); - if (!Array.isArray(parsed)) { - return [{ code: "invalidRequestManifest", severity: "error", line: 1 }]; - } - return []; - } catch { - return [{ code: "invalidRequestManifest", severity: "error", line: 1 }]; - } -} - -export function parseRequestManifest(value: string): unknown[] { - try { - const parsed: unknown = JSON.parse(value); - return Array.isArray(parsed) ? parsed : []; - } catch { - return []; - } -} - interface CodeEditorProps { id: string; value: string; @@ -251,10 +87,19 @@ export function CodeEditor({ }; }), ); + const accessibilityExtension = EditorView.contentAttributes.of({ + id, + "aria-label": label, + }); return language === "jsx" - ? [javascript({ jsx: true }), autocompletion({ override: [customJsxCompletionSource] }), diagnosticsExtension] - : [json(), diagnosticsExtension]; - }, [diagnostics, language, t]); + ? [ + javascript({ jsx: true }), + autocompletion({ override: [customJsxCompletionSource] }), + diagnosticsExtension, + accessibilityExtension, + ] + : [json(), diagnosticsExtension, accessibilityExtension]; + }, [diagnostics, id, label, language, t]); const errorCount = diagnostics.filter((diagnostic) => diagnostic.severity === "error").length; const warningCount = diagnostics.length - errorCount; @@ -293,6 +138,7 @@ export function CodeEditor({ - {language === "jsx" && } + {language === "jsx" && ( + t("componentReference.count", { count }), + }} + /> + )} {starter && value.trim().length === 0 && ( )} - - - - setQuery(event.currentTarget.value)} - placeholder={t("componentReference.search")} - aria-label={t("componentReference.search")} - leftSection={} - /> - - - {components.map((component) => ( - - - {component.name} - - - {component.category} - - - ))} - {components.length === 0 && ( - - {t("componentReference.empty")} - - )} - - - - {t("componentReference.count", { count: enabledCustomJsxComponents.length })} - - - - - ); -} diff --git a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_copy-ai-prompt-button.tsx b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_copy-ai-prompt-button.tsx index 3ba070b3c..a7ec2b06d 100644 --- a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_copy-ai-prompt-button.tsx +++ b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_copy-ai-prompt-button.tsx @@ -5,176 +5,10 @@ import { useDisclosure } from "@mantine/hooks"; import { IconCopy, IconSparkles } from "@tabler/icons-react"; import { clientApi } from "@homarr/api/client"; -import { customJsxExamples, enabledCustomJsxComponents } from "@homarr/definitions"; +import { buildCustomWidgetAiPrompt } from "@homarr/custom-widgets/core"; import { showErrorNotification, showSuccessNotification } from "@homarr/notifications"; import { useScopedI18n } from "@homarr/translation/client"; -const PROMPT_HEADER = `You are configuring a Homarr custom widget. Ask a concise clarifying question only when the requested behavior is ambiguous. - -For Custom JSX, return a Homarr authoring bundle with exactly two fenced code blocks: -1. A \`json\` block containing the complete import object. Set \`displayConfig.template\` to \`"__HOMARR_TEMPLATE__"\`. -2. A \`jsx\` block containing the readable, multiline template with no JSON escaping. - -The user can paste both blocks together into Homarr. Homarr combines and validates them before import. For non-Custom-JSX display types, return only the complete JSON block. - -## Rules -- Use \`"$schema": "homarr-custom-widget-v3"\`. -- \`displayType\` and \`displayConfig.type\` must match. -- Prefer \`customJsx\` with \`jsxApiVersion: 2\` for custom layouts. -- The base widget request must use GET. Mutations belong in named action requests. -- JSX cannot call \`fetch\` or use event handlers. Use SubFetch, ActionButton, ToggleSwitch, and RefreshButton. -- Version 2 network components reference a literal \`requestId\` and pass only declared \`params\`. -- SubFetch can reference query requests only. ActionButton and ToggleSwitch can reference action requests only. -- Prefer the SubFetch function-as-children API for fetched data. The callback receives \`(response, metadata)\` and may return any safe JSX tree. Use SubData only for very small path-based displays. -- SubFetch owns loading, failure, retry, cancellation, and stale-response handling. The render callback runs only when response data is available. -- Named request paths are same-origin paths beginning with \`/\`. Do not put credentials in a template or export. -- Query requests use GET and view permission. POST, PUT, and PATCH actions default to modify. DELETE requires full permission and confirmation. -- Use only components in the generated component reference below. -- Template output must fit inside a dashboard widget and remain usable at narrow widths. -- Return the complete import object, not a template fragment. Preserve unrelated fields from the current configuration. -- Include stable keys for rendered collections, accessible labels for controls and images, useful empty states, and concise content that works in light and dark themes. -- Prefer one clear information hierarchy over nested cards. Use ActionButton and ToggleSwitch only when the named action and required permission are declared. - -## Named request shape -\`\`\`ts -interface CustomJsxRequest { - id: string; - kind: "query" | "action"; - method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; - pathTemplate: \`/\${string}\`; - parameters: Record; - bodyTemplate?: unknown; - staticHeaders?: Record; - auth: "inherit" | "none"; - minimumBoardPermission: "view" | "modify" | "full"; - cacheTtlSeconds?: number; -} -\`\`\` - -Path parameters use \`{name}\`. JSON body parameters use \`{ "$param": "name" }\` and preserve the declared type. - -## SubFetch rendering -Use a render child when a named query needs its own layout: - -\`\`\`jsx - - {(detail, meta) => - - - {detail.name} - HTTP {meta.status} - - {detail.metrics.map((metric) => - - {metric.name} - {metric.value} - - )} - - } - -\`\`\` - -The callback is an interpreter-managed inline arrow function. Do not use native callbacks, event handlers, global state, or direct network access. Keep list keys stable and design for narrow and wide widget sizes. -`; - -const PROMPT_NO_RESPONSE = `No sample response is available. Leave this marker in your reasoning and ask the user for a representative response if its shape is required: - -\`\`\`json -PASTE_API_RESPONSE_HERE -\`\`\` -`; - -function buildComponentReference() { - const categories = new Map(); - for (const component of enabledCustomJsxComponents) { - const names = categories.get(component.category) ?? []; - names.push(component.name); - categories.set(component.category, names); - } - - return [...categories.entries()].map(([category, names]) => `- ${category}: ${names.join(", ")}`).join("\n"); -} - -function buildExamples() { - return customJsxExamples - .map( - (example) => `### ${example.title} -${example.description} -\`\`\`json -${JSON.stringify( - { - displayType: "customJsx", - displayConfig: { - type: "customJsx", - jsxApiVersion: 2, - networkScope: "public", - template: "__HOMARR_TEMPLATE__", - requests: example.requests, - }, - }, - null, - 2, -)} -\`\`\` -\`\`\`jsx -${example.template} -\`\`\``, - ) - .join("\n\n"); -} - -function buildAiPrompt( - jsonSchema: unknown, - rawResponse?: string | null, - currentConfig?: Record | null, -) { - const responseSection = rawResponse - ? `## API response\n\n\`\`\`json\n${rawResponse}\n\`\`\`\n` - : `## API response\n\n${PROMPT_NO_RESPONSE}`; - const currentDisplayConfig = currentConfig?.displayConfig; - const currentTemplate = - currentDisplayConfig && typeof currentDisplayConfig === "object" && "template" in currentDisplayConfig - ? currentDisplayConfig.template - : null; - const readableCurrentConfig = currentConfig - ? { - ...currentConfig, - ...(currentTemplate && typeof currentTemplate === "string" - ? { - displayConfig: { - ...(currentDisplayConfig as Record), - template: "__HOMARR_TEMPLATE__", - }, - } - : {}), - } - : null; - const configSection = readableCurrentConfig - ? `## Current configuration\n\nUse this as the starting point and preserve unrelated settings.\n\n\`\`\`json\n${JSON.stringify(readableCurrentConfig, null, 2)}\n\`\`\`\n${typeof currentTemplate === "string" ? `\n\`\`\`jsx\n${currentTemplate}\n\`\`\`\n` : ""}` - : ""; - - return `${PROMPT_HEADER} -## Import schema -The \`__HOMARR_TEMPLATE__\` value is an authoring transport placeholder. Homarr replaces it with the following JSX block before schema and AST validation. - -\`\`\`json -${JSON.stringify(jsonSchema, null, 2)} -\`\`\` - -## Generated component reference -${buildComponentReference()} - -## Tested examples -${buildExamples()} - -${responseSection} -${configSection} -## Requested widget -Describe what the widget should show and which interactions it needs: -`; -} - interface CopyAiPromptButtonProps { rawResponse?: string | null; currentConfig?: Record | null; @@ -188,7 +22,7 @@ export const CopyAiPromptButton = ({ rawResponse, currentConfig }: CopyAiPromptB const handleCopy = async () => { if (!schema) return; try { - await navigator.clipboard.writeText(buildAiPrompt(schema, rawResponse, currentConfig)); + await navigator.clipboard.writeText(buildCustomWidgetAiPrompt(schema, rawResponse, currentConfig)); close(); showSuccessNotification({ title: t("action.copyAiPrompt"), message: t("notification.aiPromptCopied") }); } catch { @@ -200,6 +34,7 @@ export const CopyAiPromptButton = ({ rawResponse, currentConfig }: CopyAiPromptB diff --git a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-actions.tsx b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-actions.tsx index bb3fd3724..264602d6d 100644 --- a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-actions.tsx +++ b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-actions.tsx @@ -1,31 +1,19 @@ "use client"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { - ActionIcon, - Alert, - Badge, - Button, - Code, - Group, - Menu, - Modal, - Paper, - SimpleGrid, - Stack, - Text, -} from "@mantine/core"; +import { ActionIcon, Menu } from "@mantine/core"; import { useDisclosure } from "@mantine/hooks"; -import { IconAlertTriangle, IconCopy, IconDots, IconDownload, IconTrash, IconUpload } from "@tabler/icons-react"; +import { IconCopy, IconDots, IconDownload, IconTrash, IconUpload } from "@tabler/icons-react"; import { clientApi } from "@homarr/api/client"; import { revalidatePathActionAsync } from "@homarr/common/client"; +import { getImportReview, parseCustomWidgetClipboard } from "@homarr/custom-widgets/core"; +import { ImportReviewDialog } from "@homarr/custom-widgets/workbench"; import { useConfirmModal } from "@homarr/modals"; import { showErrorNotification, showSuccessNotification } from "@homarr/notifications"; import { useScopedI18n } from "@homarr/translation/client"; import { MobileAffixButton } from "~/components/manage/mobile-affix-button"; -import { getImportReview, parseCustomWidgetClipboard } from "./_custom-widget-import-utils"; const iconProps = { size: 16, stroke: 1.5 }; @@ -214,80 +202,28 @@ export const ImportCustomWidgetButton = () => { onChange={handleImport} aria-label={t("importReview.fileLabel")} /> - - {pendingImport && review && ( - - - {t("importReview.description")} - - - - - - - - -
    - - {t("importReview.methods")} - - - {review.methods.map((method) => ( - - {method} - - ))} - -
    - -
    - - {t("importReview.permissions")} - - - {review.permissions.map((permission) => ( - - {t(`preview.request.permission.${permission}` as never)} - - ))} - -
    - - {review.hasActions && ( - }> - - {t("importReview.actionWarning.title")} - - {t("importReview.actionWarning.description")} - - )} - - - - - -
    - )} -
    + pendingImport && importMutation.mutate(pendingImport as never)} + messages={{ + title: t("importReview.title"), + description: t("importReview.description"), + name: t("importReview.name"), + origin: t("importReview.origin"), + authentication: t("importReview.authentication"), + networkScope: t("importReview.networkScope"), + methods: t("importReview.methods"), + permissions: t("importReview.permissions"), + actionWarningTitle: t("importReview.actionWarning.title"), + actionWarningDescription: t("importReview.actionWarning.description"), + cancel: t("importReview.cancel"), + confirm: t("importReview.confirm"), + permission: (permission) => t(`preview.request.permission.${permission}` as never), + }} + /> ); }; - -function ImportFact({ label, value }: { label: string; value: string }) { - return ( - - - {label} - - {value || "—"} - - ); -} diff --git a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-errors.ts b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-errors.ts new file mode 100644 index 000000000..84c4e09be --- /dev/null +++ b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-errors.ts @@ -0,0 +1,42 @@ +const serverToFormFieldMap: Record> = { + statGrid: { items: "statGridItems" }, + countGrid: { items: "countGridItems" }, + statusIndicator: { items: "statusItems" }, + progressBars: { bars: "progressBars" }, + keyValue: { mappings: "mappings" }, + table: { columns: "columns", tablePath: "tablePath" }, + singleValue: { jsonPath: "jsonPath", label: "label", unit: "unit" }, + raw: { jsonPath: "rawJsonPath" }, + actionButton: { buttonLabel: "buttonLabel" }, + customJsx: { template: "template", requests: "requestManifest", networkScope: "networkScope" }, +}; + +export function extractServerErrors(error: unknown, displayType: string): Record { + const errors: Record = {}; + const trpcError = error as { + data?: { zodError?: { fieldErrors?: Record } }; + message?: string; + }; + if (trpcError.data?.zodError?.fieldErrors) { + for (const [field, messages] of Object.entries(trpcError.data.zodError.fieldErrors)) { + if (messages?.[0]) errors[field] = messages[0]; + } + return errors; + } + try { + const issues = JSON.parse(trpcError.message ?? "[]") as Array<{ path: (string | number)[]; message: string }>; + const fieldMap = serverToFormFieldMap[displayType] ?? {}; + for (const issue of issues) { + const path = [...issue.path]; + if (path[0] === "displayConfig") { + path.shift(); + const serverField = String(path[0]); + path[0] = fieldMap[serverField] ?? serverField; + } + errors[path.join(".")] = issue.message; + } + } catch { + // Non-validation server errors are handled by the caller's notification. + } + return errors; +} diff --git a/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-sections.tsx b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-sections.tsx new file mode 100644 index 000000000..7e8060998 --- /dev/null +++ b/apps/nextjs/src/app/[locale]/manage/custom-widgets/_custom-widget-form-sections.tsx @@ -0,0 +1,238 @@ +import type { RefObject } from "react"; +import { + Button, + Fieldset, + Group, + PasswordInput, + SegmentedControl, + Select, + Stack, + Text, + TextInput, + Textarea, + ThemeIcon, +} from "@mantine/core"; +import { IconCode, IconLayoutGrid, IconPlayerPlay } from "@tabler/icons-react"; +import { IconPicker } from "@homarr/forms-collection"; +import { CUSTOM_JSX_STARTER } from "@homarr/custom-widgets/core"; +import { + CUSTOM_WIDGET_AUTH_SECRET_FIELDS, + CUSTOM_WIDGET_AUTH_USES_HEADER_NAME, +} from "@homarr/custom-widgets/workbench"; + +import type { DisplayFieldsProps } from "./_display-field-types"; +import { DISPLAY_TYPE_ICONS, DisplayTypeFields, DisplayTypePicker } from "./_display-type-fields"; +import classes from "./_custom-widget-form.module.css"; + +interface SharedSectionProps extends DisplayFieldsProps { + sectionRef: RefObject; +} + +interface FormatSectionProps extends SharedSectionProps { + onContinue: () => void; +} + +export function FormatSection({ form, t, sectionRef, onContinue }: FormatSectionProps) { + return ( +
    + + + + + +
    + + +