@miragon/mcp-toolkit-ui 2.6.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -5
- package/dist/app/adapt-data-widget.d.ts +1 -22
- package/dist/app/adapt-data-widget.d.ts.map +1 -1
- package/dist/app/adapt-data-widget.js +1 -35
- package/dist/app/adapt-data-widget.js.map +1 -1
- package/dist/app/builder/BuilderBanners.d.ts +7 -2
- package/dist/app/builder/BuilderBanners.d.ts.map +1 -1
- package/dist/app/builder/BuilderBanners.js +8 -3
- package/dist/app/builder/BuilderBanners.js.map +1 -1
- package/dist/app/builder/CanvasRow.d.ts +4 -2
- package/dist/app/builder/CanvasRow.d.ts.map +1 -1
- package/dist/app/builder/CanvasRow.js +29 -17
- package/dist/app/builder/CanvasRow.js.map +1 -1
- package/dist/app/builder/CatalogueSheet.d.ts.map +1 -1
- package/dist/app/builder/CatalogueSheet.js +14 -6
- package/dist/app/builder/CatalogueSheet.js.map +1 -1
- package/dist/app/builder/CellPropsSheet.d.ts +7 -3
- package/dist/app/builder/CellPropsSheet.d.ts.map +1 -1
- package/dist/app/builder/CellPropsSheet.js +10 -3
- package/dist/app/builder/CellPropsSheet.js.map +1 -1
- package/dist/app/builder/DiscardDialog.d.ts +18 -0
- package/dist/app/builder/DiscardDialog.d.ts.map +1 -0
- package/dist/app/builder/DiscardDialog.js +18 -0
- package/dist/app/builder/DiscardDialog.js.map +1 -0
- package/dist/app/builder/EmptyHint.d.ts +4 -0
- package/dist/app/builder/EmptyHint.d.ts.map +1 -1
- package/dist/app/builder/EmptyHint.js +6 -1
- package/dist/app/builder/EmptyHint.js.map +1 -1
- package/dist/app/builder/LayoutSurface.d.ts +33 -9
- package/dist/app/builder/LayoutSurface.d.ts.map +1 -1
- package/dist/app/builder/LayoutSurface.js +74 -23
- package/dist/app/builder/LayoutSurface.js.map +1 -1
- package/dist/app/builder/PipelineStrip.d.ts +5 -2
- package/dist/app/builder/PipelineStrip.d.ts.map +1 -1
- package/dist/app/builder/PipelineStrip.js +33 -15
- package/dist/app/builder/PipelineStrip.js.map +1 -1
- package/dist/app/builder/SaveDialog.d.ts +9 -1
- package/dist/app/builder/SaveDialog.d.ts.map +1 -1
- package/dist/app/builder/SaveDialog.js +9 -3
- package/dist/app/builder/SaveDialog.js.map +1 -1
- package/dist/app/builder/Toolbar.d.ts +14 -4
- package/dist/app/builder/Toolbar.d.ts.map +1 -1
- package/dist/app/builder/Toolbar.js +24 -7
- package/dist/app/builder/Toolbar.js.map +1 -1
- package/dist/app/builder/Workspace.d.ts +23 -3
- package/dist/app/builder/Workspace.d.ts.map +1 -1
- package/dist/app/builder/Workspace.js +58 -8
- package/dist/app/builder/Workspace.js.map +1 -1
- package/dist/app/builder/builder-model.d.ts +146 -3
- package/dist/app/builder/builder-model.d.ts.map +1 -1
- package/dist/app/builder/builder-model.js +196 -5
- package/dist/app/builder/builder-model.js.map +1 -1
- package/dist/app/builder/labels.d.ts +13 -62
- package/dist/app/builder/labels.d.ts.map +1 -1
- package/dist/app/builder/labels.js +9 -58
- package/dist/app/builder/labels.js.map +1 -1
- package/dist/app/builder/reveal.d.ts +10 -0
- package/dist/app/builder/reveal.d.ts.map +1 -0
- package/dist/app/builder/reveal.js +10 -0
- package/dist/app/builder/reveal.js.map +1 -0
- package/dist/app/builder/status-chip.d.ts.map +1 -1
- package/dist/app/builder/status-chip.js +3 -2
- package/dist/app/builder/status-chip.js.map +1 -1
- package/dist/app/builder/use-builder-catalogue.d.ts +5 -1
- package/dist/app/builder/use-builder-catalogue.d.ts.map +1 -1
- package/dist/app/builder/use-builder-catalogue.js +50 -17
- package/dist/app/builder/use-builder-catalogue.js.map +1 -1
- package/dist/app/builder/use-builder-session.d.ts +30 -0
- package/dist/app/builder/use-builder-session.d.ts.map +1 -0
- package/dist/app/builder/use-builder-session.js +58 -0
- package/dist/app/builder/use-builder-session.js.map +1 -0
- package/dist/app/builder/use-display-resolver.d.ts +17 -0
- package/dist/app/builder/use-display-resolver.d.ts.map +1 -0
- package/dist/app/builder/use-display-resolver.js +16 -0
- package/dist/app/builder/use-display-resolver.js.map +1 -0
- package/dist/app/builder/use-save-dashboard.d.ts +3 -1
- package/dist/app/builder/use-save-dashboard.d.ts.map +1 -1
- package/dist/app/builder/use-save-dashboard.js +3 -1
- package/dist/app/builder/use-save-dashboard.js.map +1 -1
- package/dist/app/index.d.ts +8 -3
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +8 -2
- package/dist/app/index.js.map +1 -1
- package/dist/app/layout-builder.d.ts +18 -25
- package/dist/app/layout-builder.d.ts.map +1 -1
- package/dist/app/layout-builder.js +84 -78
- package/dist/app/layout-builder.js.map +1 -1
- package/dist/app/mcp-app-view-chrome.d.ts +103 -20
- package/dist/app/mcp-app-view-chrome.d.ts.map +1 -1
- package/dist/app/mcp-app-view-chrome.js +125 -40
- package/dist/app/mcp-app-view-chrome.js.map +1 -1
- package/dist/app/mcp-app-view-states.d.ts +23 -0
- package/dist/app/mcp-app-view-states.d.ts.map +1 -0
- package/dist/app/mcp-app-view-states.js +55 -0
- package/dist/app/mcp-app-view-states.js.map +1 -0
- package/dist/app/mcp-app-view.d.ts +72 -5
- package/dist/app/mcp-app-view.d.ts.map +1 -1
- package/dist/app/mcp-app-view.js +241 -141
- package/dist/app/mcp-app-view.js.map +1 -1
- package/dist/app/mcp-toolkit-app.d.ts +8 -2
- package/dist/app/mcp-toolkit-app.d.ts.map +1 -1
- package/dist/app/mcp-toolkit-app.js +33 -4
- package/dist/app/mcp-toolkit-app.js.map +1 -1
- package/dist/app/mcp-use-host-bridge.d.ts +15 -6
- package/dist/app/mcp-use-host-bridge.d.ts.map +1 -1
- package/dist/app/mcp-use-host-bridge.js +51 -22
- package/dist/app/mcp-use-host-bridge.js.map +1 -1
- package/dist/app/model-context.d.ts +71 -0
- package/dist/app/model-context.d.ts.map +1 -0
- package/dist/app/model-context.js +101 -0
- package/dist/app/model-context.js.map +1 -0
- package/dist/app/use-build-mode-focus.d.ts +33 -0
- package/dist/app/use-build-mode-focus.d.ts.map +1 -0
- package/dist/app/use-build-mode-focus.js +59 -0
- package/dist/app/use-build-mode-focus.js.map +1 -0
- package/dist/app/use-view-actions.d.ts +31 -0
- package/dist/app/use-view-actions.d.ts.map +1 -0
- package/dist/app/use-view-actions.js +81 -0
- package/dist/app/use-view-actions.js.map +1 -0
- package/dist/app/use-view-lifecycle.d.ts +42 -0
- package/dist/app/use-view-lifecycle.d.ts.map +1 -0
- package/dist/app/use-view-lifecycle.js +81 -0
- package/dist/app/use-view-lifecycle.js.map +1 -0
- package/dist/app/view-lifecycle.d.ts +185 -0
- package/dist/app/view-lifecycle.d.ts.map +1 -0
- package/dist/app/view-lifecycle.js +207 -0
- package/dist/app/view-lifecycle.js.map +1 -0
- package/dist/app/widget-fixture.d.ts +10 -3
- package/dist/app/widget-fixture.d.ts.map +1 -1
- package/dist/app/widget-fixture.js +21 -8
- package/dist/app/widget-fixture.js.map +1 -1
- package/dist/app/widget-props-sheet.d.ts +6 -10
- package/dist/app/widget-props-sheet.d.ts.map +1 -1
- package/dist/app/widget-props-sheet.js +25 -20
- package/dist/app/widget-props-sheet.js.map +1 -1
- package/dist/app/widget-renderer.d.ts +41 -1
- package/dist/app/widget-renderer.d.ts.map +1 -1
- package/dist/app/widget-renderer.js +82 -31
- package/dist/app/widget-renderer.js.map +1 -1
- package/dist/components/DrillButton.d.ts +9 -6
- package/dist/components/DrillButton.d.ts.map +1 -1
- package/dist/components/DrillButton.js +9 -6
- package/dist/components/DrillButton.js.map +1 -1
- package/dist/components/EmptyState.d.ts +33 -0
- package/dist/components/EmptyState.d.ts.map +1 -0
- package/dist/components/EmptyState.js +19 -0
- package/dist/components/EmptyState.js.map +1 -0
- package/dist/components/ErrorState.d.ts +53 -0
- package/dist/components/ErrorState.d.ts.map +1 -0
- package/dist/components/ErrorState.js +77 -0
- package/dist/components/ErrorState.js.map +1 -0
- package/dist/components/FilterBar.d.ts +16 -5
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +13 -5
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/GroupCard.d.ts.map +1 -1
- package/dist/components/GroupCard.js +2 -1
- package/dist/components/GroupCard.js.map +1 -1
- package/dist/components/KpiGrid.d.ts +70 -18
- package/dist/components/KpiGrid.d.ts.map +1 -1
- package/dist/components/KpiGrid.js +112 -23
- package/dist/components/KpiGrid.js.map +1 -1
- package/dist/components/ListFooter.d.ts +32 -4
- package/dist/components/ListFooter.d.ts.map +1 -1
- package/dist/components/ListFooter.js +35 -6
- package/dist/components/ListFooter.js.map +1 -1
- package/dist/components/PagedListFooter.d.ts +57 -0
- package/dist/components/PagedListFooter.d.ts.map +1 -0
- package/dist/components/PagedListFooter.js +27 -0
- package/dist/components/PagedListFooter.js.map +1 -0
- package/dist/components/Pills.d.ts +36 -12
- package/dist/components/Pills.d.ts.map +1 -1
- package/dist/components/Pills.js +29 -8
- package/dist/components/Pills.js.map +1 -1
- package/dist/components/SectionHeading.d.ts +3 -1
- package/dist/components/SectionHeading.d.ts.map +1 -1
- package/dist/components/SectionHeading.js +6 -2
- package/dist/components/SectionHeading.js.map +1 -1
- package/dist/components/Toast.d.ts +43 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +106 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/WidgetHeader.d.ts +34 -10
- package/dist/components/WidgetHeader.d.ts.map +1 -1
- package/dist/components/WidgetHeader.js +11 -6
- package/dist/components/WidgetHeader.js.map +1 -1
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/tool-result-recovery-model.d.ts +155 -0
- package/dist/hooks/tool-result-recovery-model.d.ts.map +1 -0
- package/dist/hooks/tool-result-recovery-model.js +273 -0
- package/dist/hooks/tool-result-recovery-model.js.map +1 -0
- package/dist/hooks/use-tool-query.d.ts +56 -14
- package/dist/hooks/use-tool-query.d.ts.map +1 -1
- package/dist/hooks/use-tool-query.js +102 -25
- package/dist/hooks/use-tool-query.js.map +1 -1
- package/dist/hooks/use-tool-result-recovery.d.ts +61 -44
- package/dist/hooks/use-tool-result-recovery.d.ts.map +1 -1
- package/dist/hooks/use-tool-result-recovery.js +62 -110
- package/dist/hooks/use-tool-result-recovery.js.map +1 -1
- package/dist/hooks/use-view-data.d.ts +55 -7
- package/dist/hooks/use-view-data.d.ts.map +1 -1
- package/dist/hooks/use-view-data.js +81 -11
- package/dist/hooks/use-view-data.js.map +1 -1
- package/dist/hooks/use-view-tool-query.d.ts +12 -7
- package/dist/hooks/use-view-tool-query.d.ts.map +1 -1
- package/dist/hooks/use-view-tool-query.js +15 -14
- package/dist/hooks/use-view-tool-query.js.map +1 -1
- package/dist/index.d.ts +27 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/focus-return.d.ts +61 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/focus-return.js +46 -0
- package/dist/lib/focus-return.js.map +1 -0
- package/dist/lib/focus-ring.d.ts +18 -0
- package/dist/lib/focus-ring.d.ts.map +1 -0
- package/dist/lib/focus-ring.js +18 -0
- package/dist/lib/focus-ring.js.map +1 -0
- package/dist/lib/icon-stroke.d.ts +12 -0
- package/dist/lib/icon-stroke.d.ts.map +1 -0
- package/dist/lib/icon-stroke.js +12 -0
- package/dist/lib/icon-stroke.js.map +1 -0
- package/dist/lib/parse-tool-result.d.ts +23 -1
- package/dist/lib/parse-tool-result.d.ts.map +1 -1
- package/dist/lib/parse-tool-result.js +38 -2
- package/dist/lib/parse-tool-result.js.map +1 -1
- package/dist/lib/toast-model.d.ts +86 -0
- package/dist/lib/toast-model.d.ts.map +1 -0
- package/dist/lib/toast-model.js +102 -0
- package/dist/lib/toast-model.js.map +1 -0
- package/dist/lib/tone-utils.d.ts +95 -9
- package/dist/lib/tone-utils.d.ts.map +1 -1
- package/dist/lib/tone-utils.js +100 -9
- package/dist/lib/tone-utils.js.map +1 -1
- package/dist/lib/tool-query.d.ts +107 -0
- package/dist/lib/tool-query.d.ts.map +1 -0
- package/dist/lib/tool-query.js +182 -0
- package/dist/lib/tool-query.js.map +1 -0
- package/dist/lib/tool-result-observer.d.ts +108 -0
- package/dist/lib/tool-result-observer.d.ts.map +1 -0
- package/dist/lib/tool-result-observer.js +158 -0
- package/dist/lib/tool-result-observer.js.map +1 -0
- package/dist/lib/typography.d.ts +37 -0
- package/dist/lib/typography.d.ts.map +1 -0
- package/dist/lib/typography.js +41 -0
- package/dist/lib/typography.js.map +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +11 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/locale/index.d.ts +3 -1
- package/dist/locale/index.d.ts.map +1 -1
- package/dist/locale/index.js +2 -1
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/locale-provider.d.ts +42 -1
- package/dist/locale/locale-provider.d.ts.map +1 -1
- package/dist/locale/locale-provider.js +44 -3
- package/dist/locale/locale-provider.js.map +1 -1
- package/dist/locale/message-types.d.ts +336 -0
- package/dist/locale/message-types.d.ts.map +1 -0
- package/dist/locale/message-types.js +7 -0
- package/dist/locale/message-types.js.map +1 -0
- package/dist/locale/messages-de.d.ts +9 -0
- package/dist/locale/messages-de.d.ts.map +1 -0
- package/dist/locale/messages-de.js +185 -0
- package/dist/locale/messages-de.js.map +1 -0
- package/dist/locale/messages-en.d.ts +8 -0
- package/dist/locale/messages-en.d.ts.map +1 -0
- package/dist/locale/messages-en.js +184 -0
- package/dist/locale/messages-en.js.map +1 -0
- package/dist/locale/toolkit-messages.d.ts +57 -0
- package/dist/locale/toolkit-messages.d.ts.map +1 -0
- package/dist/locale/toolkit-messages.js +103 -0
- package/dist/locale/toolkit-messages.js.map +1 -0
- package/dist/primitives/alert.d.ts +1 -1
- package/dist/primitives/alert.d.ts.map +1 -1
- package/dist/primitives/alert.js +6 -2
- package/dist/primitives/alert.js.map +1 -1
- package/dist/primitives/badge.d.ts +1 -1
- package/dist/primitives/badge.d.ts.map +1 -1
- package/dist/primitives/badge.js +19 -6
- package/dist/primitives/badge.js.map +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.d.ts.map +1 -1
- package/dist/primitives/button.js +12 -8
- package/dist/primitives/button.js.map +1 -1
- package/dist/primitives/card.js +4 -4
- package/dist/primitives/card.js.map +1 -1
- package/dist/primitives/dialog.d.ts +7 -3
- package/dist/primitives/dialog.d.ts.map +1 -1
- package/dist/primitives/dialog.js +22 -8
- package/dist/primitives/dialog.js.map +1 -1
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +4 -1
- package/dist/primitives/input.js.map +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/scroll-area.js.map +1 -1
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +6 -3
- package/dist/primitives/select.js.map +1 -1
- package/dist/primitives/sheet.d.ts +3 -1
- package/dist/primitives/sheet.d.ts.map +1 -1
- package/dist/primitives/sheet.js +17 -7
- package/dist/primitives/sheet.js.map +1 -1
- package/dist/primitives/skeleton.js +1 -1
- package/dist/primitives/skeleton.js.map +1 -1
- package/dist/primitives/switch.d.ts.map +1 -1
- package/dist/primitives/switch.js +2 -1
- package/dist/primitives/switch.js.map +1 -1
- package/dist/primitives/tabs.d.ts.map +1 -1
- package/dist/primitives/tabs.js +5 -3
- package/dist/primitives/tabs.js.map +1 -1
- package/dist/providers/query-provider.d.ts +32 -1
- package/dist/providers/query-provider.d.ts.map +1 -1
- package/dist/providers/query-provider.js +53 -4
- package/dist/providers/query-provider.js.map +1 -1
- package/dist/render-cases-primitives.js +1 -1
- package/dist/render-cases-primitives.js.map +1 -1
- package/dist/render-cases.d.ts.map +1 -1
- package/dist/render-cases.js +48 -6
- package/dist/render-cases.js.map +1 -1
- package/dist/render-effects.d.ts +42 -0
- package/dist/render-effects.d.ts.map +1 -0
- package/dist/render-effects.js +81 -0
- package/dist/render-effects.js.map +1 -0
- package/dist/render-scan.d.ts +25 -0
- package/dist/render-scan.d.ts.map +1 -0
- package/dist/render-scan.js +66 -0
- package/dist/render-scan.js.map +1 -0
- package/dist/theme/cd-tokens.d.ts +66 -0
- package/dist/theme/cd-tokens.d.ts.map +1 -0
- package/dist/theme/cd-tokens.js +64 -0
- package/dist/theme/cd-tokens.js.map +1 -0
- package/dist/theme/create-theme.d.ts +214 -39
- package/dist/theme/create-theme.d.ts.map +1 -1
- package/dist/theme/create-theme.js +204 -13
- package/dist/theme/create-theme.js.map +1 -1
- package/dist/theme/fonts.d.ts +38 -0
- package/dist/theme/fonts.d.ts.map +1 -0
- package/dist/theme/fonts.js +56 -0
- package/dist/theme/fonts.js.map +1 -0
- package/dist/theme/host-fonts.d.ts +39 -0
- package/dist/theme/host-fonts.d.ts.map +1 -0
- package/dist/theme/host-fonts.js +44 -0
- package/dist/theme/host-fonts.js.map +1 -0
- package/dist/theme/index.d.ts +8 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +5 -1
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/portal-container.d.ts +16 -0
- package/dist/theme/portal-container.d.ts.map +1 -0
- package/dist/theme/portal-container.js +19 -0
- package/dist/theme/portal-container.js.map +1 -0
- package/dist/theme/presets.d.ts +24 -9
- package/dist/theme/presets.d.ts.map +1 -1
- package/dist/theme/presets.js +44 -11
- package/dist/theme/presets.js.map +1 -1
- package/dist/theme/theme-provider.d.ts +27 -9
- package/dist/theme/theme-provider.d.ts.map +1 -1
- package/dist/theme/theme-provider.js +42 -20
- package/dist/theme/theme-provider.js.map +1 -1
- package/package.json +11 -5
- package/src/app/adapt-data-widget.tsx +2 -42
- package/src/app/builder/BuilderBanners.tsx +26 -13
- package/src/app/builder/CanvasRow.tsx +79 -32
- package/src/app/builder/CatalogueSheet.tsx +58 -35
- package/src/app/builder/CellPropsSheet.tsx +17 -2
- package/src/app/builder/DiscardDialog.tsx +59 -0
- package/src/app/builder/EmptyHint.tsx +16 -11
- package/src/app/builder/LayoutSurface.tsx +207 -67
- package/src/app/builder/PipelineStrip.tsx +265 -156
- package/src/app/builder/SaveDialog.tsx +25 -14
- package/src/app/builder/Toolbar.tsx +154 -57
- package/src/app/builder/Workspace.tsx +226 -56
- package/src/app/builder/builder-feedback.test.tsx +75 -0
- package/src/app/builder/builder-model.test.ts +5 -0
- package/src/app/builder/builder-model.ts +346 -6
- package/src/app/builder/builder-model.ux.test.ts +456 -0
- package/src/app/builder/builder-ux.test.tsx +844 -0
- package/src/app/builder/labels.ts +15 -121
- package/src/app/builder/reveal.ts +10 -0
- package/src/app/builder/status-chip.tsx +8 -4
- package/src/app/builder/use-builder-catalogue.ts +62 -19
- package/src/app/builder/use-builder-session.ts +68 -0
- package/src/app/builder/use-display-resolver.ts +24 -0
- package/src/app/builder/use-save-dashboard.ts +5 -0
- package/src/app/index.ts +20 -3
- package/src/app/layout-builder.tsx +193 -186
- package/src/app/mcp-app-view-chrome.test.tsx +487 -14
- package/src/app/mcp-app-view-chrome.tsx +328 -100
- package/src/app/mcp-app-view-states.tsx +140 -0
- package/src/app/mcp-app-view.effects.test.tsx +292 -0
- package/src/app/mcp-app-view.test.tsx +478 -0
- package/src/app/mcp-app-view.tsx +447 -190
- package/src/app/mcp-toolkit-app.test.tsx +40 -0
- package/src/app/mcp-toolkit-app.tsx +39 -8
- package/src/app/mcp-use-host-bridge.test.tsx +180 -0
- package/src/app/mcp-use-host-bridge.tsx +67 -24
- package/src/app/model-context.test.tsx +116 -0
- package/src/app/model-context.tsx +125 -0
- package/src/app/use-build-mode-focus.ts +62 -0
- package/src/app/use-view-actions.ts +89 -0
- package/src/app/use-view-lifecycle.ts +122 -0
- package/src/app/view-lifecycle.test.ts +443 -0
- package/src/app/view-lifecycle.ts +334 -0
- package/src/app/widget-fixture.effects.test.tsx +51 -0
- package/src/app/widget-fixture.render.test.tsx +81 -0
- package/src/app/widget-fixture.tsx +34 -11
- package/src/app/widget-props-sheet.tsx +67 -39
- package/src/app/widget-renderer.render.test.tsx +131 -0
- package/src/app/widget-renderer.tsx +136 -38
- package/src/components/DrillButton.tsx +24 -10
- package/src/components/EmptyState.tsx +83 -0
- package/src/components/ErrorState.tsx +204 -0
- package/src/components/FilterBar.test.tsx +82 -0
- package/src/components/FilterBar.tsx +56 -27
- package/src/components/GroupCard.tsx +3 -2
- package/src/components/KpiGrid.test.tsx +279 -0
- package/src/components/KpiGrid.tsx +329 -91
- package/src/components/ListFooter.test.tsx +116 -0
- package/src/components/ListFooter.tsx +110 -12
- package/src/components/PagedListFooter.test.tsx +140 -0
- package/src/components/PagedListFooter.tsx +107 -0
- package/src/components/Pills.test.tsx +77 -0
- package/src/components/Pills.tsx +78 -16
- package/src/components/SectionHeading.tsx +9 -3
- package/src/components/Toast.tsx +206 -0
- package/src/components/WidgetHeader.test.tsx +78 -0
- package/src/components/WidgetHeader.tsx +63 -16
- package/src/components/feedback-states.test.tsx +314 -0
- package/src/components/tone-figures.test.tsx +58 -0
- package/src/fonts.css +19 -0
- package/src/globals.css +9 -165
- package/src/hooks/index.ts +6 -3
- package/src/hooks/tool-result-recovery-model.test.ts +744 -0
- package/src/hooks/tool-result-recovery-model.ts +418 -0
- package/src/hooks/use-tool-query.effects.test.tsx +205 -0
- package/src/hooks/use-tool-query.ts +156 -33
- package/src/hooks/use-tool-result-recovery.effects.test.tsx +141 -0
- package/src/hooks/use-tool-result-recovery.test.ts +28 -5
- package/src/hooks/use-tool-result-recovery.ts +101 -131
- package/src/hooks/use-view-data.test.tsx +169 -0
- package/src/hooks/use-view-data.ts +131 -10
- package/src/hooks/use-view-tool-query.ts +25 -19
- package/src/i18n-coverage.test.tsx +425 -0
- package/src/index.ts +102 -13
- package/src/lib/focus-return.test.ts +288 -0
- package/src/lib/focus-return.ts +96 -0
- package/src/lib/focus-ring.ts +20 -0
- package/src/lib/icon-stroke.test.ts +59 -0
- package/src/lib/icon-stroke.ts +13 -0
- package/src/lib/parse-tool-result.test.ts +46 -1
- package/src/lib/parse-tool-result.ts +40 -2
- package/src/lib/toast-model.test.ts +233 -0
- package/src/lib/toast-model.ts +165 -0
- package/src/lib/tone-utils.test.ts +125 -16
- package/src/lib/tone-utils.ts +144 -15
- package/src/lib/tool-query.test.ts +569 -0
- package/src/lib/tool-query.ts +253 -0
- package/src/lib/tool-result-observer.test.ts +296 -0
- package/src/lib/tool-result-observer.ts +211 -0
- package/src/lib/typography.test.ts +45 -0
- package/src/lib/typography.ts +47 -0
- package/src/lib/utils.ts +12 -1
- package/src/locale/index.ts +14 -1
- package/src/locale/locale-provider.test.tsx +87 -0
- package/src/locale/locale-provider.tsx +90 -3
- package/src/locale/message-types.ts +337 -0
- package/src/locale/messages-de.ts +198 -0
- package/src/locale/messages-en.ts +196 -0
- package/src/locale/toolkit-messages.test.ts +349 -0
- package/src/locale/toolkit-messages.ts +143 -0
- package/src/no-hardcoded-copy.test.ts +432 -0
- package/src/primitives/alert.tsx +7 -2
- package/src/primitives/badge.tsx +19 -7
- package/src/primitives/button.tsx +13 -8
- package/src/primitives/card.tsx +4 -4
- package/src/primitives/dialog.tsx +42 -8
- package/src/primitives/input.tsx +5 -3
- package/src/primitives/scroll-area.tsx +1 -1
- package/src/primitives/select.tsx +7 -4
- package/src/primitives/sheet.tsx +33 -6
- package/src/primitives/skeleton.tsx +1 -1
- package/src/primitives/switch.tsx +4 -2
- package/src/primitives/tabs.tsx +9 -6
- package/src/providers/query-provider.test.tsx +154 -0
- package/src/providers/query-provider.tsx +66 -5
- package/src/render-cases-primitives.tsx +1 -1
- package/src/render-cases.tsx +82 -6
- package/src/render-effects.tsx +96 -0
- package/src/render-scan.ts +75 -0
- package/src/theme/cd-tokens.generated.css +48 -0
- package/src/theme/cd-tokens.test.ts +109 -0
- package/src/theme/cd-tokens.ts +67 -0
- package/src/theme/create-theme.test.ts +253 -5
- package/src/theme/create-theme.ts +341 -41
- package/src/theme/fonts.test.ts +85 -0
- package/src/theme/fonts.ts +72 -0
- package/src/theme/host-fonts.test.ts +135 -0
- package/src/theme/host-fonts.ts +52 -0
- package/src/theme/index.ts +15 -1
- package/src/theme/portal-container.ts +20 -0
- package/src/theme/presets.ts +44 -11
- package/src/theme/theme-css.test.ts +619 -0
- package/src/theme/theme-provider.test.tsx +82 -0
- package/src/theme/theme-provider.tsx +60 -24
- package/src/theme.css +344 -0
- package/ui-catalog.json +783 -49
package/dist/theme/presets.js
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import { createTheme } from "./create-theme.js";
|
|
2
2
|
/**
|
|
3
3
|
* Ready-made white-label themes — a demonstration of {@link createTheme} and a
|
|
4
|
-
* starting point a client can fork. Each preset sets
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `
|
|
4
|
+
* starting point a client can fork. Each preset sets its whole interactive
|
|
5
|
+
* family from one brand hue, in light AND dark: `primary` with its
|
|
6
|
+
* `primaryForeground` and `primaryHover`, `link`, `focus` (plus the legacy
|
|
7
|
+
* `ring`), a matching `accent`, and a `radius`. The dark side brightens the
|
|
8
|
+
* brand colour for legibility on dark surfaces. Every preset meets the same
|
|
9
|
+
* contrast bar as the default theme in both modes (`theme-css.test.ts`).
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
+
* The toolkit's DEFAULT is the Miragon theme (theme.css, built on the vendored
|
|
12
|
+
* corporate-design tokens); it needs no preset. A full customer brand may set
|
|
13
|
+
* more roles than these presets do (the status `*Ink` colours); see
|
|
14
|
+
* docs/guides/white-labeling.md. Apply one with
|
|
15
|
+
* `<ThemeProvider theme={themePresets.emerald}>`.
|
|
11
16
|
*/
|
|
12
17
|
export const themePresets = {
|
|
13
18
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
19
|
+
* An approximation of the Miragon blue from before the toolkit shipped the
|
|
20
|
+
* Miragon corporate design.
|
|
21
|
+
*
|
|
22
|
+
* @deprecated The Miragon theme is now the toolkit's default: render without
|
|
23
|
+
* a theme (or `<ThemeProvider>` without `theme`) to get the exact CI values.
|
|
24
|
+
* This preset is off-palette and will be removed in the next major.
|
|
16
25
|
*/
|
|
17
26
|
miragon: createTheme({
|
|
18
27
|
primary: "oklch(0.52 0.21 264)",
|
|
19
28
|
primaryForeground: "oklch(0.985 0 0)",
|
|
29
|
+
primaryHover: "oklch(0.46 0.2 264)",
|
|
30
|
+
link: "oklch(0.52 0.21 264)",
|
|
31
|
+
focus: "oklch(0.52 0.21 264)",
|
|
20
32
|
accent: "oklch(0.95 0.03 264)",
|
|
21
33
|
accentForeground: "oklch(0.32 0.12 264)",
|
|
22
34
|
ring: "oklch(0.52 0.21 264)",
|
|
@@ -25,15 +37,27 @@ export const themePresets = {
|
|
|
25
37
|
dark: {
|
|
26
38
|
primary: "oklch(0.7 0.16 264)",
|
|
27
39
|
primaryForeground: "oklch(0.18 0.02 264)",
|
|
40
|
+
primaryHover: "oklch(0.76 0.13 264)",
|
|
41
|
+
link: "oklch(0.7 0.16 264)",
|
|
42
|
+
focus: "oklch(0.7 0.16 264)",
|
|
28
43
|
accent: "oklch(0.32 0.06 264)",
|
|
29
44
|
accentForeground: "oklch(0.97 0 0)",
|
|
30
45
|
ring: "oklch(0.7 0.16 264)",
|
|
31
46
|
},
|
|
32
47
|
}),
|
|
33
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* A vivid violet brand with rounder corners — playful, consumer-facing.
|
|
50
|
+
*
|
|
51
|
+
* @deprecated The violet tech default is the look the Miragon design system
|
|
52
|
+
* rules out (anti-slop U9). Fork {@link createTheme} with your own brand
|
|
53
|
+
* values instead. Will be removed in the next major.
|
|
54
|
+
*/
|
|
34
55
|
violet: createTheme({
|
|
35
56
|
primary: "oklch(0.55 0.24 295)",
|
|
36
57
|
primaryForeground: "oklch(0.985 0 0)",
|
|
58
|
+
primaryHover: "oklch(0.49 0.23 295)",
|
|
59
|
+
link: "oklch(0.55 0.24 295)",
|
|
60
|
+
focus: "oklch(0.55 0.24 295)",
|
|
37
61
|
accent: "oklch(0.95 0.04 295)",
|
|
38
62
|
accentForeground: "oklch(0.34 0.14 295)",
|
|
39
63
|
ring: "oklch(0.55 0.24 295)",
|
|
@@ -42,6 +66,9 @@ export const themePresets = {
|
|
|
42
66
|
dark: {
|
|
43
67
|
primary: "oklch(0.72 0.18 295)",
|
|
44
68
|
primaryForeground: "oklch(0.18 0.03 295)",
|
|
69
|
+
primaryHover: "oklch(0.78 0.15 295)",
|
|
70
|
+
link: "oklch(0.72 0.18 295)",
|
|
71
|
+
focus: "oklch(0.72 0.18 295)",
|
|
45
72
|
accent: "oklch(0.33 0.08 295)",
|
|
46
73
|
accentForeground: "oklch(0.97 0 0)",
|
|
47
74
|
ring: "oklch(0.72 0.18 295)",
|
|
@@ -49,16 +76,22 @@ export const themePresets = {
|
|
|
49
76
|
}),
|
|
50
77
|
/** A grounded emerald brand with a crisp, near-square radius — enterprise. */
|
|
51
78
|
emerald: createTheme({
|
|
52
|
-
primary: "oklch(0.
|
|
79
|
+
primary: "oklch(0.5 0.12 162)",
|
|
53
80
|
primaryForeground: "oklch(0.985 0 0)",
|
|
81
|
+
primaryHover: "oklch(0.44 0.11 162)",
|
|
82
|
+
link: "oklch(0.5 0.12 162)",
|
|
83
|
+
focus: "oklch(0.5 0.12 162)",
|
|
54
84
|
accent: "oklch(0.95 0.04 162)",
|
|
55
85
|
accentForeground: "oklch(0.34 0.1 162)",
|
|
56
|
-
ring: "oklch(0.
|
|
86
|
+
ring: "oklch(0.5 0.12 162)",
|
|
57
87
|
radius: "0.375rem",
|
|
58
88
|
}, {
|
|
59
89
|
dark: {
|
|
60
90
|
primary: "oklch(0.72 0.15 162)",
|
|
61
91
|
primaryForeground: "oklch(0.17 0.03 162)",
|
|
92
|
+
primaryHover: "oklch(0.78 0.14 162)",
|
|
93
|
+
link: "oklch(0.72 0.15 162)",
|
|
94
|
+
focus: "oklch(0.72 0.15 162)",
|
|
62
95
|
accent: "oklch(0.32 0.07 162)",
|
|
63
96
|
accentForeground: "oklch(0.97 0 0)",
|
|
64
97
|
ring: "oklch(0.72 0.15 162)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../src/theme/presets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAA;AAErE
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../src/theme/presets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAA;AAErE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;;;;;;;OAOG;IACH,OAAO,EAAE,WAAW,CAClB;QACE,OAAO,EAAE,sBAAsB;QAC/B,iBAAiB,EAAE,kBAAkB;QACrC,YAAY,EAAE,qBAAqB;QACnC,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,sBAAsB;QAC9B,gBAAgB,EAAE,sBAAsB;QACxC,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,QAAQ;KACjB,EACD;QACE,IAAI,EAAE;YACJ,OAAO,EAAE,qBAAqB;YAC9B,iBAAiB,EAAE,sBAAsB;YACzC,YAAY,EAAE,sBAAsB;YACpC,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,qBAAqB;YAC5B,MAAM,EAAE,sBAAsB;YAC9B,gBAAgB,EAAE,iBAAiB;YACnC,IAAI,EAAE,qBAAqB;SAC5B;KACF,CACF;IAED;;;;;;OAMG;IACH,MAAM,EAAE,WAAW,CACjB;QACE,OAAO,EAAE,sBAAsB;QAC/B,iBAAiB,EAAE,kBAAkB;QACrC,YAAY,EAAE,sBAAsB;QACpC,IAAI,EAAE,sBAAsB;QAC5B,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,sBAAsB;QAC9B,gBAAgB,EAAE,sBAAsB;QACxC,IAAI,EAAE,sBAAsB;QAC5B,MAAM,EAAE,UAAU;KACnB,EACD;QACE,IAAI,EAAE;YACJ,OAAO,EAAE,sBAAsB;YAC/B,iBAAiB,EAAE,sBAAsB;YACzC,YAAY,EAAE,sBAAsB;YACpC,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,MAAM,EAAE,sBAAsB;YAC9B,gBAAgB,EAAE,iBAAiB;YACnC,IAAI,EAAE,sBAAsB;SAC7B;KACF,CACF;IAED,8EAA8E;IAC9E,OAAO,EAAE,WAAW,CAClB;QACE,OAAO,EAAE,qBAAqB;QAC9B,iBAAiB,EAAE,kBAAkB;QACrC,YAAY,EAAE,sBAAsB;QACpC,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,qBAAqB;QAC5B,MAAM,EAAE,sBAAsB;QAC9B,gBAAgB,EAAE,qBAAqB;QACvC,IAAI,EAAE,qBAAqB;QAC3B,MAAM,EAAE,UAAU;KACnB,EACD;QACE,IAAI,EAAE;YACJ,OAAO,EAAE,sBAAsB;YAC/B,iBAAiB,EAAE,sBAAsB;YACzC,YAAY,EAAE,sBAAsB;YACpC,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,sBAAsB;YAC7B,MAAM,EAAE,sBAAsB;YAC9B,gBAAgB,EAAE,iBAAiB;YACnC,IAAI,EAAE,sBAAsB;SAC7B;KACF,CACF;CACwC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { type ThemeDefinition } from "./create-theme.js";
|
|
3
3
|
/**
|
|
4
4
|
* How the `.dark` class is resolved on the theme scope:
|
|
5
5
|
* - `"light"` / `"dark"` — forced, ignores the OS preference.
|
|
@@ -27,8 +27,11 @@ export declare function useTheme(): ThemeContextValue;
|
|
|
27
27
|
/** Props for {@link ThemeProvider}. */
|
|
28
28
|
export interface ThemeProviderProps {
|
|
29
29
|
/**
|
|
30
|
-
* The white-label theme to apply (from {@link createTheme}
|
|
31
|
-
*
|
|
30
|
+
* The white-label theme to apply (from {@link createTheme}). Omit to keep the
|
|
31
|
+
* theme of the nearest enclosing `ThemeProvider` (re-applied in this
|
|
32
|
+
* provider's mode, so a light island inside a dark branded scope stays on
|
|
33
|
+
* the brand), or, at the top, to manage only the light/dark `mode` against
|
|
34
|
+
* the toolkit defaults (the Miragon theme).
|
|
32
35
|
*/
|
|
33
36
|
theme?: ThemeDefinition;
|
|
34
37
|
/**
|
|
@@ -49,19 +52,34 @@ export interface ThemeProviderProps {
|
|
|
49
52
|
/**
|
|
50
53
|
* Apply a white-label {@link ThemeDefinition} to a subtree. Renders a wrapper
|
|
51
54
|
* element carrying the theme's CSS variables as inline `style`, so they override
|
|
52
|
-
* the
|
|
53
|
-
* `text-
|
|
55
|
+
* the toolkit's defaults (the Miragon theme) for every descendant — `Card`,
|
|
56
|
+
* `Button`, `bg-card`, `text-link`, and `rounded-md` all re-skin without
|
|
57
|
+
* touching the widgets.
|
|
54
58
|
*
|
|
55
|
-
* Dark mode is handled at the scope: the `.dark` class
|
|
56
|
-
* (not `<html>`) per the resolved {@link ThemeMode}
|
|
57
|
-
*
|
|
59
|
+
* Dark mode is handled at the scope: the `.dark` class and `data-theme-mode`
|
|
60
|
+
* are set on the wrapper (not `<html>`) per the resolved {@link ThemeMode}. In
|
|
61
|
+
* dark mode the wrapper gets the toolkit's dark roles plus the theme's dark
|
|
62
|
+
* tokens and its mode-invariant light tokens ({@link resolveThemeVars}) — a
|
|
63
|
+
* light surface colour never leaks into a dark scope (mcp-toolkit#178 N35). A
|
|
64
|
+
* light scope inside a dark scope stays light: there, `data-theme-mode="light"`
|
|
65
|
+
* re-declares the toolkit's light roles. A light scope in a light document
|
|
66
|
+
* re-declares nothing and keeps what the document set (a consumer's `:root`
|
|
67
|
+
* brand). A nested provider without `theme` re-applies the enclosing one's
|
|
68
|
+
* theme in its own mode. This keeps theming local — two differently themed
|
|
58
69
|
* subtrees (e.g. a brand preview gallery) coexist on one page.
|
|
59
70
|
*
|
|
71
|
+
* Overlays opened inside the scope (Dialog, Sheet, Select) portal into a node
|
|
72
|
+
* within it, so they wear the same theme and mode (#178 N36,
|
|
73
|
+
* {@link usePortalContainer}). That node is the wrapper's FIRST child, an empty
|
|
74
|
+
* `display: contents` element: it draws no box, and `space-*`, `divide-*`,
|
|
75
|
+
* `gap` and `last:` on the wrapper see only your children. Only selectors on
|
|
76
|
+
* the wrapper's first/nth child (`first:`, `odd:`) count it.
|
|
77
|
+
*
|
|
60
78
|
* Uses only React + the DOM (no `mcp-use/react`), so it ships from the root
|
|
61
79
|
* barrel and works in a host-free standalone app, a host, or SSR alike.
|
|
62
80
|
*
|
|
63
81
|
* @example
|
|
64
|
-
* <ThemeProvider theme={
|
|
82
|
+
* <ThemeProvider theme={brand} mode={host.theme ?? "system"}>
|
|
65
83
|
* <YourWidget />
|
|
66
84
|
* </ThemeProvider>
|
|
67
85
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAG1E;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEnD,6CAA6C;AAC7C,MAAM,WAAW,iBAAiB;IAChC,gFAAgF;IAChF,KAAK,EAAE,eAAe,GAAG,IAAI,CAAA;IAC7B,iEAAiE;IACjE,IAAI,EAAE,SAAS,CAAA;IACf,+EAA+E;IAC/E,YAAY,EAAE,OAAO,GAAG,MAAM,CAAA;CAC/B;AAID;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AA6BD,uCAAuC;AACvC,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;IACxC,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,IAAc,EACd,EAAE,EAAE,EAAU,EACd,SAAS,EACT,QAAQ,GACT,EAAE,kBAAkB,GAAG,SAAS,CA+ChC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useEffect, useMemo, useState, } from "react";
|
|
3
|
+
import { resolveThemeVars } from "./create-theme.js";
|
|
4
|
+
import { PortalContainerContext } from "./portal-container.js";
|
|
3
5
|
const ThemeContext = createContext(null);
|
|
4
6
|
/**
|
|
5
7
|
* Read the active theme/mode from the nearest {@link ThemeProvider}. Throws when
|
|
@@ -41,39 +43,59 @@ function useResolvedMode(mode) {
|
|
|
41
43
|
/**
|
|
42
44
|
* Apply a white-label {@link ThemeDefinition} to a subtree. Renders a wrapper
|
|
43
45
|
* element carrying the theme's CSS variables as inline `style`, so they override
|
|
44
|
-
* the
|
|
45
|
-
* `text-
|
|
46
|
+
* the toolkit's defaults (the Miragon theme) for every descendant — `Card`,
|
|
47
|
+
* `Button`, `bg-card`, `text-link`, and `rounded-md` all re-skin without
|
|
48
|
+
* touching the widgets.
|
|
46
49
|
*
|
|
47
|
-
* Dark mode is handled at the scope: the `.dark` class
|
|
48
|
-
* (not `<html>`) per the resolved {@link ThemeMode}
|
|
49
|
-
*
|
|
50
|
+
* Dark mode is handled at the scope: the `.dark` class and `data-theme-mode`
|
|
51
|
+
* are set on the wrapper (not `<html>`) per the resolved {@link ThemeMode}. In
|
|
52
|
+
* dark mode the wrapper gets the toolkit's dark roles plus the theme's dark
|
|
53
|
+
* tokens and its mode-invariant light tokens ({@link resolveThemeVars}) — a
|
|
54
|
+
* light surface colour never leaks into a dark scope (mcp-toolkit#178 N35). A
|
|
55
|
+
* light scope inside a dark scope stays light: there, `data-theme-mode="light"`
|
|
56
|
+
* re-declares the toolkit's light roles. A light scope in a light document
|
|
57
|
+
* re-declares nothing and keeps what the document set (a consumer's `:root`
|
|
58
|
+
* brand). A nested provider without `theme` re-applies the enclosing one's
|
|
59
|
+
* theme in its own mode. This keeps theming local — two differently themed
|
|
50
60
|
* subtrees (e.g. a brand preview gallery) coexist on one page.
|
|
51
61
|
*
|
|
62
|
+
* Overlays opened inside the scope (Dialog, Sheet, Select) portal into a node
|
|
63
|
+
* within it, so they wear the same theme and mode (#178 N36,
|
|
64
|
+
* {@link usePortalContainer}). That node is the wrapper's FIRST child, an empty
|
|
65
|
+
* `display: contents` element: it draws no box, and `space-*`, `divide-*`,
|
|
66
|
+
* `gap` and `last:` on the wrapper see only your children. Only selectors on
|
|
67
|
+
* the wrapper's first/nth child (`first:`, `odd:`) count it.
|
|
68
|
+
*
|
|
52
69
|
* Uses only React + the DOM (no `mcp-use/react`), so it ships from the root
|
|
53
70
|
* barrel and works in a host-free standalone app, a host, or SSR alike.
|
|
54
71
|
*
|
|
55
72
|
* @example
|
|
56
|
-
* <ThemeProvider theme={
|
|
73
|
+
* <ThemeProvider theme={brand} mode={host.theme ?? "system"}>
|
|
57
74
|
* <YourWidget />
|
|
58
75
|
* </ThemeProvider>
|
|
59
76
|
*/
|
|
60
77
|
export function ThemeProvider({ theme, mode = "light", as: As = "div", className, children, }) {
|
|
61
78
|
const resolvedMode = useResolvedMode(mode);
|
|
62
79
|
const isDark = resolvedMode === "dark";
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const classes = [isDark ? "dark" : undefined, "bg-background text-foreground", className]
|
|
80
|
+
const [portalContainer, setPortalContainer] = useState(null);
|
|
81
|
+
// Without its own theme a nested provider keeps the enclosing one's brand.
|
|
82
|
+
const enclosing = useContext(ThemeContext);
|
|
83
|
+
const activeTheme = theme ?? enclosing?.theme ?? null;
|
|
84
|
+
const style = useMemo(() => resolveThemeVars(activeTheme, resolvedMode), [activeTheme, resolvedMode]);
|
|
85
|
+
const value = useMemo(() => ({ theme: activeTheme, mode, resolvedMode }), [activeTheme, mode, resolvedMode]);
|
|
86
|
+
const classes = [
|
|
87
|
+
isDark ? "dark" : undefined,
|
|
88
|
+
"bg-background text-foreground font-sans",
|
|
89
|
+
className,
|
|
90
|
+
]
|
|
75
91
|
.filter(Boolean)
|
|
76
92
|
.join(" ");
|
|
77
|
-
|
|
93
|
+
// The portal node OPENS the scope as an empty `display: contents` element:
|
|
94
|
+
// it draws no box, yet overlays portaled into it inherit the scope's
|
|
95
|
+
// variables and its `.dark` / `data-theme-mode`. First, not last: Tailwind's
|
|
96
|
+
// `space-*`/`divide-*` and `last:` target the last child, so a trailing node
|
|
97
|
+
// would hand the real last child a margin or divider it never had.
|
|
98
|
+
const PortalRoot = As === "span" ? "span" : "div";
|
|
99
|
+
return (_jsx(ThemeContext.Provider, { value: value, children: _jsx(PortalContainerContext.Provider, { value: portalContainer, children: _jsxs(As, { className: classes, style: style, "data-theme-mode": resolvedMode, children: [_jsx(PortalRoot, { ref: setPortalContainer, "data-slot": "theme-portal", style: { display: "contents" } }), children] }) }) }));
|
|
78
100
|
}
|
|
79
101
|
//# sourceMappingURL=theme-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.js","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,GAGT,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"theme-provider.js","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miragon/mcp-toolkit-ui",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "React UI for MCP servers:
|
|
3
|
+
"version": "2.8.0",
|
|
4
|
+
"description": "React UI for MCP servers in the Miragon design system (white-label through role tokens): primitives, composite components, TanStack Query hooks, and the MCP App shell (McpAppView + WidgetRenderer).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/Miragon/mcp-toolkit.git",
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
"types": "./dist/hooks/index.d.ts",
|
|
27
27
|
"import": "./dist/hooks/index.js"
|
|
28
28
|
},
|
|
29
|
-
"./globals.css": "./src/globals.css"
|
|
29
|
+
"./globals.css": "./src/globals.css",
|
|
30
|
+
"./theme.css": "./src/theme.css",
|
|
31
|
+
"./fonts.css": "./src/fonts.css",
|
|
32
|
+
"./cd-tokens.generated.css": "./src/theme/cd-tokens.generated.css"
|
|
30
33
|
},
|
|
31
34
|
"files": [
|
|
32
35
|
"dist",
|
|
@@ -42,11 +45,12 @@
|
|
|
42
45
|
"react": "^19.2.0",
|
|
43
46
|
"react-dom": "^19.2.0",
|
|
44
47
|
"tailwindcss": "^4.3.0",
|
|
45
|
-
"@miragon/mcp-toolkit-core": "~2.
|
|
48
|
+
"@miragon/mcp-toolkit-core": "~2.8.0"
|
|
46
49
|
},
|
|
47
50
|
"dependencies": {
|
|
48
51
|
"@base-ui/react": "1.8.0",
|
|
49
52
|
"@fontsource-variable/geist": "5.3.0",
|
|
53
|
+
"@fontsource-variable/geist-mono": "5.3.0",
|
|
50
54
|
"@tanstack/react-query": "5.103.2",
|
|
51
55
|
"class-variance-authority": "0.7.1",
|
|
52
56
|
"clsx": "2.1.1",
|
|
@@ -58,17 +62,19 @@
|
|
|
58
62
|
"devDependencies": {
|
|
59
63
|
"@stryker-mutator/core": "10.0.0",
|
|
60
64
|
"@stryker-mutator/vitest-runner": "10.0.0",
|
|
65
|
+
"@types/node": "26.6.4",
|
|
61
66
|
"@types/react": "19.3.0",
|
|
62
67
|
"@types/react-dom": "19.3.0",
|
|
63
68
|
"@vitest/coverage-v8": "4.1.11",
|
|
64
69
|
"fast-check": "4.10.2",
|
|
70
|
+
"happy-dom": "20.14.5",
|
|
65
71
|
"mcp-use": "2.7.3",
|
|
66
72
|
"react": "19.3.0",
|
|
67
73
|
"react-dom": "19.3.0",
|
|
68
74
|
"tailwindcss": "4.3.3",
|
|
69
75
|
"typescript": "6.0.3",
|
|
70
76
|
"vitest": "4.1.11",
|
|
71
|
-
"@miragon/mcp-toolkit-core": "2.
|
|
77
|
+
"@miragon/mcp-toolkit-core": "2.8.0"
|
|
72
78
|
},
|
|
73
79
|
"engines": {
|
|
74
80
|
"node": ">=22.22.2"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ModelContext } from "mcp-use/react"
|
|
1
|
+
import type { ComponentType } from "react"
|
|
3
2
|
import type { WidgetProps } from "@miragon/mcp-toolkit-core"
|
|
4
|
-
import {
|
|
5
|
-
import { useIsInsideMcpUseView } from "./mcp-use-host-bridge.js"
|
|
3
|
+
import { HostModelContext } from "./model-context.js"
|
|
6
4
|
import type { WidgetComponent } from "./widget-renderer.js"
|
|
7
5
|
|
|
8
6
|
/**
|
|
@@ -16,44 +14,6 @@ export type DescribeForModel<T> = (
|
|
|
16
14
|
props: Readonly<Record<string, unknown>>,
|
|
17
15
|
) => string
|
|
18
16
|
|
|
19
|
-
/**
|
|
20
|
-
* Model-context reporting that works on every host — the host-portable
|
|
21
|
-
* replacement for rendering `mcp-use/react`'s `ModelContext` directly.
|
|
22
|
-
*
|
|
23
|
-
* mcp-use 2.x's `ModelContext` registers with the view runtime and THROWS
|
|
24
|
-
* outside a `bootstrapView` mount, so it is only rendered inside an mcp-use
|
|
25
|
-
* view (where it aggregates nested nodes into one tree). Everywhere else —
|
|
26
|
-
* ChatGPT via `createChatGptHostBridge`, the `WidgetFixtureHost` harness,
|
|
27
|
-
* standalone apps — the description flows through the bridge's
|
|
28
|
-
* `setModelContext` instead (last-writer-wins; fine for the single-widget
|
|
29
|
-
* mounts those hosts render).
|
|
30
|
-
*
|
|
31
|
-
* Widgets that self-fetch and report their own context (cockpit views like
|
|
32
|
-
* `TasksBoard`) must use this instead of importing `ModelContext` from
|
|
33
|
-
* `mcp-use/react` — the direct import crashes the widget in every non-view
|
|
34
|
-
* mount, starting with the widget playground.
|
|
35
|
-
*/
|
|
36
|
-
export function HostModelContext({
|
|
37
|
-
content,
|
|
38
|
-
children,
|
|
39
|
-
}: {
|
|
40
|
-
content: string
|
|
41
|
-
children: ReactNode
|
|
42
|
-
}): ReactNode {
|
|
43
|
-
const insideView = useIsInsideMcpUseView()
|
|
44
|
-
if (insideView) return <ModelContext content={content}>{children}</ModelContext>
|
|
45
|
-
return <BridgeModelContext content={content}>{children}</BridgeModelContext>
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function BridgeModelContext({ content, children }: { content: string; children: ReactNode }) {
|
|
49
|
-
const bridge = useHostBridgeOrNull()
|
|
50
|
-
const setModelContext = bridge?.setModelContext
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
setModelContext?.(content)
|
|
53
|
-
}, [setModelContext, content])
|
|
54
|
-
return children
|
|
55
|
-
}
|
|
56
|
-
|
|
57
17
|
/**
|
|
58
18
|
* Wraps a "single-data" widget component (signature `({ data }: { data: T | null })`)
|
|
59
19
|
* so it can be registered as a framework {@link WidgetComponent} (which receives
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AlertTriangle } from "lucide-react"
|
|
2
|
+
import { ErrorState } from "../../components/ErrorState.js"
|
|
3
|
+
import { TONE_ICON } from "../../lib/tone-utils.js"
|
|
2
4
|
import type { LayoutBuilderLabels } from "./labels.js"
|
|
3
5
|
|
|
4
6
|
// -------------------------------------------------------------------------- //
|
|
@@ -9,7 +11,10 @@ import type { LayoutBuilderLabels } from "./labels.js"
|
|
|
9
11
|
* Inline feedback strip under the toolbar. Surfaces two things the builder
|
|
10
12
|
* previously swallowed:
|
|
11
13
|
* - a `get-builder-catalogue` fetch failure (Finding [3]) — only console-
|
|
12
|
-
* logged before, so the user couldn't tell the palette was stale
|
|
14
|
+
* logged before, so the user couldn't tell the palette was stale. It is
|
|
15
|
+
* the kit's inline `ErrorState`: what happened, what to do, a retry, and
|
|
16
|
+
* the tool name with the raw reason under "Details" (never in the
|
|
17
|
+
* sentence the user reads), and
|
|
13
18
|
* - pipeline validation issues (Finding [10]/[6]) the catalogue reports
|
|
14
19
|
* fail-soft but `render-view` would reject fail-hard.
|
|
15
20
|
*
|
|
@@ -21,29 +26,37 @@ export function BuilderBanners({
|
|
|
21
26
|
catalogueToolName,
|
|
22
27
|
refreshError,
|
|
23
28
|
validationIssues,
|
|
29
|
+
onRetry,
|
|
24
30
|
}: {
|
|
25
31
|
L: Required<LayoutBuilderLabels>
|
|
26
32
|
catalogueToolName: string
|
|
27
33
|
refreshError: string | null
|
|
28
34
|
validationIssues: string[]
|
|
35
|
+
/** Fetches the catalogue again; the error state offers it as its retry. */
|
|
36
|
+
onRetry?: () => void
|
|
29
37
|
}) {
|
|
30
38
|
if (!refreshError && validationIssues.length === 0) return null
|
|
31
39
|
return (
|
|
32
|
-
<div className="flex flex-col gap-2"
|
|
40
|
+
<div className="flex flex-col gap-2">
|
|
33
41
|
{refreshError && (
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
42
|
+
<ErrorState
|
|
43
|
+
variant="inline"
|
|
44
|
+
title={L.catalogueError}
|
|
45
|
+
description={L.catalogueErrorHint}
|
|
46
|
+
details={`${catalogueToolName}: ${refreshError}`}
|
|
47
|
+
onRetry={onRetry}
|
|
48
|
+
/>
|
|
43
49
|
)}
|
|
44
50
|
{validationIssues.length > 0 && (
|
|
45
|
-
<div
|
|
46
|
-
|
|
51
|
+
<div
|
|
52
|
+
role="status"
|
|
53
|
+
aria-live="polite"
|
|
54
|
+
className="border-warning bg-warning-soft text-foreground text-small flex items-start gap-2 rounded-md border px-3 py-2"
|
|
55
|
+
>
|
|
56
|
+
<AlertTriangle
|
|
57
|
+
className={`mt-0.5 size-3.5 shrink-0 ${TONE_ICON.warning}`}
|
|
58
|
+
aria-hidden="true"
|
|
59
|
+
/>
|
|
47
60
|
<div className="min-w-0">
|
|
48
61
|
<p className="font-medium">{L.validationWarning}</p>
|
|
49
62
|
<ul className="mt-0.5 list-inside list-disc space-y-0.5">
|