@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
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { useQuery, type UseQueryResult } from "@tanstack/react-query"
|
|
2
|
-
import { useCallTool } from "../providers/query-provider.js"
|
|
2
|
+
import { useCallTool, useToolNameInQueryKey } from "../providers/query-provider.js"
|
|
3
3
|
import { parseViewToolResult } from "../lib/parse-tool-result.js"
|
|
4
|
+
import { toolQueryOptions, type UseToolQueryOptions } from "../lib/tool-query.js"
|
|
5
|
+
import { useRefetchOnTransport, useToolKeyGuard } from "./use-tool-query.js"
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Options of {@link useViewToolQuery}: TanStack's query options, passed
|
|
9
|
+
* through like `useToolQuery`'s (`enabled`, `retry`, `staleTime`,
|
|
10
|
+
* `placeholderData`, `initialData`, …).
|
|
11
|
+
*/
|
|
12
|
+
export type UseViewToolQueryOptions<T = unknown> = UseToolQueryOptions<T>
|
|
8
13
|
|
|
9
14
|
/**
|
|
10
15
|
* Self-fetch hook for `*_show_*` widget tools — the envelope-unwrapping sibling
|
|
@@ -14,25 +19,26 @@ export interface UseViewToolQueryOptions {
|
|
|
14
19
|
* envelope; this hook decodes via {@link parseViewToolResult} (single-step →
|
|
15
20
|
* flat data, multi-step → keyed by step id) instead.
|
|
16
21
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
22
|
+
* Same key and options contract as {@link useToolQuery}: the effective key is
|
|
23
|
+
* `[...queryKey, args]` (`[...queryKey, toolName, args]` under an
|
|
24
|
+
* `AppQueryProvider` with `toolNameInQueryKey`), so sibling widgets sharing a
|
|
25
|
+
* query key and args collapse to a single deduped tool call.
|
|
20
26
|
*/
|
|
21
27
|
export function useViewToolQuery<T = unknown>(
|
|
22
|
-
queryKey: unknown[],
|
|
28
|
+
queryKey: readonly unknown[],
|
|
23
29
|
toolName: string,
|
|
24
30
|
args: object,
|
|
25
|
-
opts?: UseViewToolQueryOptions
|
|
31
|
+
opts?: UseViewToolQueryOptions<T>,
|
|
26
32
|
): UseQueryResult<T, Error> {
|
|
27
33
|
const callTool = useCallTool()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const toolNameInKey = useToolNameInQueryKey()
|
|
35
|
+
useToolKeyGuard(queryKey, toolName, args)
|
|
36
|
+
const query = useQuery<T, Error>(
|
|
37
|
+
toolQueryOptions<T>(queryKey, toolName, args, callTool, opts, {
|
|
38
|
+
decode: parseViewToolResult,
|
|
39
|
+
toolNameInKey,
|
|
40
|
+
}),
|
|
41
|
+
)
|
|
42
|
+
useRefetchOnTransport(callTool, query)
|
|
43
|
+
return query
|
|
38
44
|
}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { isValidElement, type ReactElement } from "react"
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server"
|
|
3
|
+
import { describe, expect, it } from "vitest"
|
|
4
|
+
import type { WidgetProps } from "@miragon/mcp-toolkit-core"
|
|
5
|
+
import { EmptyState } from "./components/EmptyState.js"
|
|
6
|
+
import { ErrorState } from "./components/ErrorState.js"
|
|
7
|
+
import { ToastViewport } from "./components/Toast.js"
|
|
8
|
+
import { LocaleProvider } from "./locale/locale-provider.js"
|
|
9
|
+
import { TOOLKIT_MESSAGES, type ToolkitMessages } from "./locale/toolkit-messages.js"
|
|
10
|
+
import { createToast } from "./lib/toast-model.js"
|
|
11
|
+
import { RENDER_CASES } from "./render-cases.js"
|
|
12
|
+
import { userFacingTexts } from "./render-scan.js"
|
|
13
|
+
import { StepErrors, ViewToolbar, type ViewData } from "./app/mcp-app-view-chrome.js"
|
|
14
|
+
import { ViewPlaceholder } from "./app/mcp-app-view-states.js"
|
|
15
|
+
import { LayoutBuilder } from "./app/layout-builder.js"
|
|
16
|
+
import { BuilderBanners } from "./app/builder/BuilderBanners.js"
|
|
17
|
+
import { PipelineStrip } from "./app/builder/PipelineStrip.js"
|
|
18
|
+
import { StatusChip } from "./app/builder/status-chip.js"
|
|
19
|
+
import { Toolbar } from "./app/builder/Toolbar.js"
|
|
20
|
+
import { Workspace } from "./app/builder/Workspace.js"
|
|
21
|
+
import { WidgetCrashFallback, WidgetRenderer } from "./app/widget-renderer.js"
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Render half of the i18n guard (the static half is `no-hardcoded-copy.test.ts`):
|
|
25
|
+
* render every component under the German locale with a MARKED catalog —
|
|
26
|
+
* each catalog string wrapped in ⟦…⟧ — and scan every text node and text
|
|
27
|
+
* attribute. Whatever is neither marked (it came from the catalog) nor a
|
|
28
|
+
* fixture value the case passed in (it came from props) is a hard-coded
|
|
29
|
+
* string that a German user would read in English.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const OPEN = "⟦"
|
|
33
|
+
const CLOSE = "⟧"
|
|
34
|
+
|
|
35
|
+
function marked(messages: ToolkitMessages): ToolkitMessages {
|
|
36
|
+
const mark = (value: unknown): unknown =>
|
|
37
|
+
typeof value === "function"
|
|
38
|
+
? (...args: unknown[]) => `${OPEN}${(value as (...a: unknown[]) => string)(...args)}${CLOSE}`
|
|
39
|
+
: `${OPEN}${String(value)}${CLOSE}`
|
|
40
|
+
return Object.fromEntries(
|
|
41
|
+
Object.entries(messages).map(([section, entries]) => [
|
|
42
|
+
section,
|
|
43
|
+
Object.fromEntries(
|
|
44
|
+
Object.entries(entries as Record<string, unknown>).map(([k, v]) => [k, mark(v)]),
|
|
45
|
+
),
|
|
46
|
+
]),
|
|
47
|
+
) as unknown as ToolkitMessages
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const PSEUDO = marked(TOOLKIT_MESSAGES.de)
|
|
51
|
+
|
|
52
|
+
/** Every string/number a case hands to the tree through props (its fixtures). */
|
|
53
|
+
function fixtureStrings(node: unknown, out = new Set<string>(), seen = new Set<unknown>()) {
|
|
54
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
55
|
+
const text = String(node).trim()
|
|
56
|
+
if (text.length >= 2) out.add(text)
|
|
57
|
+
return out
|
|
58
|
+
}
|
|
59
|
+
if (!node || typeof node !== "object" || seen.has(node)) return out
|
|
60
|
+
seen.add(node)
|
|
61
|
+
if (node instanceof Error) return fixtureStrings(node.message, out, seen)
|
|
62
|
+
if (isValidElement(node)) return fixtureStrings(node.props, out, seen)
|
|
63
|
+
for (const value of Array.isArray(node) ? node : Object.values(node)) {
|
|
64
|
+
fixtureStrings(value, out, seen)
|
|
65
|
+
}
|
|
66
|
+
return out
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Text a German user would read that came neither from the catalog nor from props. */
|
|
70
|
+
function leaks(element: ReactElement): string[] {
|
|
71
|
+
const html = renderToStaticMarkup(
|
|
72
|
+
<LocaleProvider locale="de" toolkitMessages={PSEUDO}>
|
|
73
|
+
{element}
|
|
74
|
+
</LocaleProvider>,
|
|
75
|
+
)
|
|
76
|
+
const fixtures = [...fixtureStrings(element)].sort((a, b) => b.length - a.length)
|
|
77
|
+
const found: string[] = []
|
|
78
|
+
for (const { source, value } of userFacingTexts(html)) {
|
|
79
|
+
let rest = value
|
|
80
|
+
const innermost = /⟦[^⟦⟧]*⟧/g
|
|
81
|
+
while (innermost.test(rest)) rest = rest.replace(innermost, " ")
|
|
82
|
+
rest = rest.replace(/RC:[\w:-]+/g, " ")
|
|
83
|
+
for (const fixture of fixtures) rest = rest.split(fixture).join(" ")
|
|
84
|
+
if (/\p{L}/u.test(rest)) found.push(`${source}: "${value}" → "${rest.trim()}"`)
|
|
85
|
+
}
|
|
86
|
+
return found
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const noop = (): void => {}
|
|
90
|
+
const asyncNoop = (): Promise<void> => Promise.resolve()
|
|
91
|
+
|
|
92
|
+
const view: ViewData = {
|
|
93
|
+
title: "Prozessdefinitionen",
|
|
94
|
+
context: { keys: {}, stepIds: [], stepData: {}, errors: [] },
|
|
95
|
+
layout: { rows: [] },
|
|
96
|
+
_refreshParams: { layout: { rows: [] } },
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function Crash(): never {
|
|
100
|
+
throw new Error("kaputt")
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function Fine({ keys }: WidgetProps) {
|
|
104
|
+
return <span>{typeof keys.label === "string" ? keys.label : ""}</span>
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** The toolkit chrome no catalogued render case reaches. */
|
|
108
|
+
const CHROME_CASES: { name: string; render: () => ReactElement }[] = [
|
|
109
|
+
{
|
|
110
|
+
name: "ViewPlaceholder waiting + slow hint",
|
|
111
|
+
render: () => (
|
|
112
|
+
<ViewPlaceholder
|
|
113
|
+
lifecycle={{ phase: "waiting", slow: true }}
|
|
114
|
+
labels={PSEUDO.view}
|
|
115
|
+
onRetry={noop}
|
|
116
|
+
/>
|
|
117
|
+
),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "ViewPlaceholder error",
|
|
121
|
+
render: () => (
|
|
122
|
+
<ViewPlaceholder
|
|
123
|
+
lifecycle={{ phase: "error", reason: "[503] engine down", canRetry: true }}
|
|
124
|
+
labels={PSEUDO.view}
|
|
125
|
+
onRetry={noop}
|
|
126
|
+
/>
|
|
127
|
+
),
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "ViewPlaceholder error without a retry",
|
|
131
|
+
render: () => (
|
|
132
|
+
<ViewPlaceholder
|
|
133
|
+
lifecycle={{ phase: "error", reason: undefined, canRetry: false }}
|
|
134
|
+
labels={PSEUDO.view}
|
|
135
|
+
onRetry={noop}
|
|
136
|
+
/>
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "ViewPlaceholder blocked (a writing tool, no retry)",
|
|
141
|
+
render: () => (
|
|
142
|
+
<ViewPlaceholder
|
|
143
|
+
lifecycle={{ phase: "error", reason: undefined, canRetry: false, kind: "blocked" }}
|
|
144
|
+
labels={PSEUDO.view}
|
|
145
|
+
onRetry={noop}
|
|
146
|
+
/>
|
|
147
|
+
),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: "ViewPlaceholder blocked (load the view)",
|
|
151
|
+
render: () => (
|
|
152
|
+
<ViewPlaceholder
|
|
153
|
+
lifecycle={{ phase: "error", reason: undefined, canRetry: true, kind: "blocked" }}
|
|
154
|
+
labels={PSEUDO.view}
|
|
155
|
+
onRetry={noop}
|
|
156
|
+
/>
|
|
157
|
+
),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "StepErrors without a refresh",
|
|
161
|
+
render: () => (
|
|
162
|
+
<StepErrors
|
|
163
|
+
hidden={false}
|
|
164
|
+
errors={[{ stepId: "inc", reason: "[503] engine down" }]}
|
|
165
|
+
labels={PSEUDO.view}
|
|
166
|
+
/>
|
|
167
|
+
),
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "ViewPlaceholder cancelled",
|
|
171
|
+
render: () => (
|
|
172
|
+
<ViewPlaceholder lifecycle={{ phase: "cancelled" }} labels={PSEUDO.view} onRetry={noop} />
|
|
173
|
+
),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "ViewToolbar",
|
|
177
|
+
render: () => (
|
|
178
|
+
<ViewToolbar
|
|
179
|
+
hidden={false}
|
|
180
|
+
viewData={view}
|
|
181
|
+
builderAvailable
|
|
182
|
+
isFullscreen={false}
|
|
183
|
+
canFullscreen
|
|
184
|
+
isRefreshing={false}
|
|
185
|
+
labels={PSEUDO.view}
|
|
186
|
+
titleMode="show"
|
|
187
|
+
titleLevel={2}
|
|
188
|
+
onRefresh={asyncNoop}
|
|
189
|
+
onEnterBuildMode={noop}
|
|
190
|
+
onToggleFullscreen={asyncNoop}
|
|
191
|
+
dataAsOf="14:32"
|
|
192
|
+
/>
|
|
193
|
+
),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "StepErrors",
|
|
197
|
+
render: () => (
|
|
198
|
+
<StepErrors
|
|
199
|
+
hidden={false}
|
|
200
|
+
errors={[{ stepId: "inc", reason: "[503] engine down" }]}
|
|
201
|
+
steps={[{ id: "inc", step: "camunda7:incidents" }]}
|
|
202
|
+
labels={PSEUDO.view}
|
|
203
|
+
onRetry={noop}
|
|
204
|
+
/>
|
|
205
|
+
),
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "WidgetRenderer: unknown widget + crashing widget",
|
|
209
|
+
render: () => (
|
|
210
|
+
<WidgetRenderer
|
|
211
|
+
layout={{ rows: [{ row: [{ widget: "demo:gone" }, { widget: "demo:fine" }] }] }}
|
|
212
|
+
keys={{ label: "Rechnung 42" }}
|
|
213
|
+
errors={[]}
|
|
214
|
+
widgets={{ "demo:fine": Fine }}
|
|
215
|
+
/>
|
|
216
|
+
),
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "WidgetCrashFallback",
|
|
220
|
+
render: () => (
|
|
221
|
+
<WidgetCrashFallback widgetId="demo:crash" error={new Error("kaputt")} onRetry={noop} />
|
|
222
|
+
),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: "ToastViewport",
|
|
226
|
+
render: () => (
|
|
227
|
+
<ToastViewport
|
|
228
|
+
toasts={[createToast(1, { tone: "success", title: "Job neu eingeplant." })]}
|
|
229
|
+
onDismiss={noop}
|
|
230
|
+
/>
|
|
231
|
+
),
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "ErrorState defaults",
|
|
235
|
+
render: () => <ErrorState title="Fehler" details="raw" onRetry={noop} />,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "EmptyState",
|
|
239
|
+
render: () => <EmptyState title="Leer" description="Nichts zu tun." />,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: "LayoutBuilder (empty: data-sources hint)",
|
|
243
|
+
render: () => <LayoutBuilder widgets={{}} callTool={() => Promise.resolve({})} />,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "LayoutBuilder (tabs, cells, unknown widget)",
|
|
247
|
+
render: () => (
|
|
248
|
+
<LayoutBuilder
|
|
249
|
+
initialLayout={{
|
|
250
|
+
tabs: [
|
|
251
|
+
{ label: "Übersicht", rows: [{ row: [{ widget: "demo:gone" }] }, { row: [] }] },
|
|
252
|
+
{ label: "Details-Tab", rows: [] },
|
|
253
|
+
],
|
|
254
|
+
}}
|
|
255
|
+
widgets={{ "demo:fine": Crash }}
|
|
256
|
+
callTool={() => Promise.resolve({})}
|
|
257
|
+
/>
|
|
258
|
+
),
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "Builder toolbar (advanced, unsaved)",
|
|
262
|
+
render: () => (
|
|
263
|
+
<Toolbar
|
|
264
|
+
L={PSEUDO.builder}
|
|
265
|
+
previewMode={false}
|
|
266
|
+
isBusy={false}
|
|
267
|
+
status="pending"
|
|
268
|
+
liveKeys={2}
|
|
269
|
+
reachableCount={5}
|
|
270
|
+
unreachableCount={1}
|
|
271
|
+
advanced
|
|
272
|
+
onToggleAdvanced={noop}
|
|
273
|
+
unsaved
|
|
274
|
+
onOpenCatalogue={noop}
|
|
275
|
+
onOpenSave={noop}
|
|
276
|
+
onDiscard={noop}
|
|
277
|
+
onApply={noop}
|
|
278
|
+
hasAnyCell
|
|
279
|
+
/>
|
|
280
|
+
),
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: "Builder workspace (titled and untitled palette entries, canvas cells)",
|
|
284
|
+
render: () => (
|
|
285
|
+
<Workspace
|
|
286
|
+
L={PSEUDO.builder}
|
|
287
|
+
paletteByApp={[
|
|
288
|
+
[
|
|
289
|
+
"demo",
|
|
290
|
+
[
|
|
291
|
+
{
|
|
292
|
+
id: "demo:orders",
|
|
293
|
+
app: "demo",
|
|
294
|
+
requires: ["demo:key"],
|
|
295
|
+
size: "full",
|
|
296
|
+
title: { en: "Orders", de: "Bestellungen" },
|
|
297
|
+
summary: { de: "Alle offenen Bestellungen." },
|
|
298
|
+
},
|
|
299
|
+
{ id: "demo:raw", app: "demo", requires: [], size: "half" },
|
|
300
|
+
],
|
|
301
|
+
],
|
|
302
|
+
]}
|
|
303
|
+
appDisplayByName={new Map()}
|
|
304
|
+
paletteCount={2}
|
|
305
|
+
paletteLoading={false}
|
|
306
|
+
onOpenDataSources={noop}
|
|
307
|
+
activeRows={[{ row: [{ widget: "demo:orders" }] }, { row: [] }]}
|
|
308
|
+
focusedRowIndex={0}
|
|
309
|
+
setFocusedRowIndex={noop}
|
|
310
|
+
dragOverRow={null}
|
|
311
|
+
setDragOverRow={noop}
|
|
312
|
+
onAddRow={noop}
|
|
313
|
+
onRemoveRow={noop}
|
|
314
|
+
onMoveRow={noop}
|
|
315
|
+
onSetCellSpan={noop}
|
|
316
|
+
onRemoveCell={noop}
|
|
317
|
+
onAddWidget={noop}
|
|
318
|
+
onConfigureCell={noop}
|
|
319
|
+
propsSchemaByWidgetId={new Map([["demo:orders", { type: "object" }]])}
|
|
320
|
+
displayByWidgetId={new Map([["demo:orders", { title: { de: "Bestellungen" } }]])}
|
|
321
|
+
advanced
|
|
322
|
+
widgets={{}}
|
|
323
|
+
widgetProps={{ keys: {}, context: { keys: {}, steps: {}, errors: [] } }}
|
|
324
|
+
onAddTab={noop}
|
|
325
|
+
/>
|
|
326
|
+
),
|
|
327
|
+
},
|
|
328
|
+
...[true, false].map((paletteLoading) => ({
|
|
329
|
+
name: `Builder workspace (palette ${paletteLoading ? "loading" : "empty"})`,
|
|
330
|
+
render: () => (
|
|
331
|
+
<Workspace
|
|
332
|
+
L={PSEUDO.builder}
|
|
333
|
+
paletteByApp={[]}
|
|
334
|
+
appDisplayByName={new Map()}
|
|
335
|
+
paletteCount={0}
|
|
336
|
+
paletteLoading={paletteLoading}
|
|
337
|
+
onOpenDataSources={noop}
|
|
338
|
+
activeRows={[{ row: [] }]}
|
|
339
|
+
focusedRowIndex={0}
|
|
340
|
+
setFocusedRowIndex={noop}
|
|
341
|
+
dragOverRow={null}
|
|
342
|
+
setDragOverRow={noop}
|
|
343
|
+
onAddRow={noop}
|
|
344
|
+
onRemoveRow={noop}
|
|
345
|
+
onMoveRow={noop}
|
|
346
|
+
onSetCellSpan={noop}
|
|
347
|
+
onRemoveCell={noop}
|
|
348
|
+
onAddWidget={noop}
|
|
349
|
+
onConfigureCell={noop}
|
|
350
|
+
propsSchemaByWidgetId={new Map()}
|
|
351
|
+
displayByWidgetId={new Map()}
|
|
352
|
+
advanced={false}
|
|
353
|
+
widgets={{}}
|
|
354
|
+
widgetProps={{ keys: {}, context: { keys: {}, steps: {}, errors: [] } }}
|
|
355
|
+
/>
|
|
356
|
+
),
|
|
357
|
+
})),
|
|
358
|
+
{
|
|
359
|
+
name: "Builder data sources",
|
|
360
|
+
render: () => (
|
|
361
|
+
<PipelineStrip
|
|
362
|
+
L={PSEUDO.builder}
|
|
363
|
+
keyEntries={[
|
|
364
|
+
{ name: "demo:id", rawValue: "42" },
|
|
365
|
+
{ name: "demo:live", rawValue: "" },
|
|
366
|
+
]}
|
|
367
|
+
stepEntries={[{ id: "s1", step: "demo:load" }]}
|
|
368
|
+
keyCatalog={[]}
|
|
369
|
+
availableSteps={[
|
|
370
|
+
{ id: "demo:load", app: "demo", dataType: "demo:t", requires: [], produces: [] },
|
|
371
|
+
]}
|
|
372
|
+
stepsByApp={[]}
|
|
373
|
+
liveKeys={{ "demo:live": 7 }}
|
|
374
|
+
onAddKey={noop}
|
|
375
|
+
onUpdateKey={noop}
|
|
376
|
+
onRemoveKey={noop}
|
|
377
|
+
onAddStep={noop}
|
|
378
|
+
onUpdateStep={noop}
|
|
379
|
+
onRemoveStep={noop}
|
|
380
|
+
status="refreshing"
|
|
381
|
+
/>
|
|
382
|
+
),
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: "Builder banners + status chips",
|
|
386
|
+
render: () => (
|
|
387
|
+
<div>
|
|
388
|
+
<BuilderBanners
|
|
389
|
+
L={PSEUDO.builder}
|
|
390
|
+
catalogueToolName="get-builder-catalogue"
|
|
391
|
+
refreshError="timeout"
|
|
392
|
+
validationIssues={["demo:id fehlt"]}
|
|
393
|
+
/>
|
|
394
|
+
<StatusChip status="idle" L={PSEUDO.builder} />
|
|
395
|
+
<StatusChip status="pending" L={PSEUDO.builder} />
|
|
396
|
+
<StatusChip status="refreshing" L={PSEUDO.builder} />
|
|
397
|
+
</div>
|
|
398
|
+
),
|
|
399
|
+
},
|
|
400
|
+
]
|
|
401
|
+
|
|
402
|
+
describe("no English leaks into a German view", () => {
|
|
403
|
+
it("the marked catalog marks every string (the scan can see catalog text)", () => {
|
|
404
|
+
expect(PSEUDO.view.loading).toBe(`⟦${TOOLKIT_MESSAGES.de.view.loading}⟧`)
|
|
405
|
+
expect(PSEUDO.builder.saved("x")).toBe(`⟦${TOOLKIT_MESSAGES.de.builder.saved("x")}⟧`)
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
for (const renderCase of [...RENDER_CASES, ...CHROME_CASES]) {
|
|
409
|
+
it(`${renderCase.name} renders only catalog text and props under de`, () => {
|
|
410
|
+
expect(leaks(renderCase.render())).toEqual([])
|
|
411
|
+
})
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
it("catches a hard-coded string (gate self-test)", () => {
|
|
415
|
+
const Leaky = ({ name }: { name: string }) => (
|
|
416
|
+
<button type="button" aria-label="Close">
|
|
417
|
+
{name} Load more
|
|
418
|
+
</button>
|
|
419
|
+
)
|
|
420
|
+
expect(leaks(<Leaky name="Rechnung" />)).toEqual([
|
|
421
|
+
'text: "Rechnung Load more" → "Load more"',
|
|
422
|
+
'aria-label: "Close" → "Close"',
|
|
423
|
+
])
|
|
424
|
+
})
|
|
425
|
+
})
|
package/src/index.ts
CHANGED
|
@@ -66,27 +66,65 @@ export {
|
|
|
66
66
|
// NOTE: the view-tool hooks (`useViewToolQuery`, `useViewData`) are exported
|
|
67
67
|
// from the `./hooks` subpath only — see `packages/ui/src/hooks/index.ts`.
|
|
68
68
|
export { useIsMobile } from "./hooks/use-mobile.js"
|
|
69
|
-
export { useToolQuery, useToolMutation } from "./hooks/use-tool-query.js"
|
|
70
|
-
export type { UseToolQueryOptions } from "./hooks/use-tool-query.js"
|
|
69
|
+
export { useToolQuery, useToolQueryKey, useToolMutation } from "./hooks/use-tool-query.js"
|
|
70
|
+
export type { UseToolQueryOptions, UseToolMutationOptions } from "./hooks/use-tool-query.js"
|
|
71
|
+
// The query layer's contract: the effective cache key, the opt-in retry
|
|
72
|
+
// policy (no retry of a tool's own isError answer), and TanStack's
|
|
73
|
+
// keepPreviousData for `placeholderData`, so a consumer needs no direct
|
|
74
|
+
// @tanstack/react-query import for the common options.
|
|
75
|
+
export { toolQueryKey, shouldRetryToolCall } from "./lib/tool-query.js"
|
|
76
|
+
export { ToolResultError, isToolError } from "./lib/parse-tool-result.js"
|
|
77
|
+
export { keepPreviousData } from "@tanstack/react-query"
|
|
71
78
|
export { useDebouncedValue } from "./hooks/use-debounced-value.js"
|
|
72
79
|
|
|
73
80
|
// Tone token system — the semantic status tones (ToneVariant + TONE_* maps)
|
|
74
|
-
// behind the tone-aware components below. Pure data + class strings.
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
// behind the tone-aware components below. Pure data + class strings. ONE
|
|
82
|
+
// vocabulary (TONE_VARIANTS; retired names map through resolveTone). Three
|
|
83
|
+
// roles per tone: colour (TONE_DOT/TONE_BORDER/TONE_ICON), tint (TONE_SOFT,
|
|
84
|
+
// foreground text on it; TONE_TINT alone), text on a plain surface (TONE_INK,
|
|
85
|
+
// the -ink role; TONE_TEXT is its deprecated name).
|
|
86
|
+
export {
|
|
87
|
+
TONE_VARIANTS,
|
|
88
|
+
TONE_ALIASES,
|
|
89
|
+
resolveTone,
|
|
90
|
+
isToneVariant,
|
|
91
|
+
TONE_SOFT,
|
|
92
|
+
TONE_TINT,
|
|
93
|
+
TONE_DOT,
|
|
94
|
+
TONE_INK,
|
|
95
|
+
TONE_TEXT,
|
|
96
|
+
TONE_BORDER,
|
|
97
|
+
TONE_ICON,
|
|
98
|
+
} from "./lib/tone-utils.js"
|
|
99
|
+
export type { ToneVariant, ToneAlias, ToneName } from "./lib/tone-utils.js"
|
|
100
|
+
// The type scale (CI §4): text-title/section/body/dense/small utilities, 13 px floor.
|
|
101
|
+
export { TYPE_SCALE, TYPE_STEPS, TYPE_FLOOR_PX, MICRO_LABEL } from "./lib/typography.js"
|
|
102
|
+
export type { TypeStep } from "./lib/typography.js"
|
|
103
|
+
// The kit's opaque focus ring as class strings, for custom controls.
|
|
104
|
+
export { FOCUS_RING, FOCUS_RING_INSET } from "./lib/focus-ring.js"
|
|
77
105
|
|
|
78
106
|
// Composed components — focused widget building blocks assembled from the
|
|
79
107
|
// primitives. Pure (React + primitives + cn), so they live in the root barrel.
|
|
80
108
|
export { GridLayout, GridItem } from "./components/GridLayout.js"
|
|
81
109
|
export type { GridLayoutProps, GridItemProps } from "./components/GridLayout.js"
|
|
82
|
-
export { KpiGrid } from "./components/KpiGrid.js"
|
|
83
|
-
export type {
|
|
84
|
-
|
|
85
|
-
|
|
110
|
+
export { KpiGrid, KpiGridSkeleton } from "./components/KpiGrid.js"
|
|
111
|
+
export type {
|
|
112
|
+
KpiGridProps,
|
|
113
|
+
KpiGridHeader,
|
|
114
|
+
KpiCell,
|
|
115
|
+
KpiGridSkeletonProps,
|
|
116
|
+
} from "./components/KpiGrid.js"
|
|
117
|
+
export { LivePill, CountPill, StatusBadge } from "./components/Pills.js"
|
|
118
|
+
export type {
|
|
119
|
+
LivePillProps,
|
|
120
|
+
CountPillProps,
|
|
121
|
+
StatusBadgeProps,
|
|
122
|
+
StatusBadgeText,
|
|
123
|
+
} from "./components/Pills.js"
|
|
86
124
|
export { SectionHeading } from "./components/SectionHeading.js"
|
|
87
125
|
export type { SectionHeadingProps } from "./components/SectionHeading.js"
|
|
88
126
|
export { WidgetHeader } from "./components/WidgetHeader.js"
|
|
89
|
-
export type { WidgetHeaderProps } from "./components/WidgetHeader.js"
|
|
127
|
+
export type { WidgetHeaderProps, WidgetHeadingLevel } from "./components/WidgetHeader.js"
|
|
90
128
|
export { GroupCard } from "./components/GroupCard.js"
|
|
91
129
|
export type { GroupCardProps } from "./components/GroupCard.js"
|
|
92
130
|
export { FilterBar } from "./components/FilterBar.js"
|
|
@@ -95,6 +133,16 @@ export { DrillButton } from "./components/DrillButton.js"
|
|
|
95
133
|
export type { DrillButtonProps } from "./components/DrillButton.js"
|
|
96
134
|
export { ListFooter } from "./components/ListFooter.js"
|
|
97
135
|
export type { ListFooterProps } from "./components/ListFooter.js"
|
|
136
|
+
export { PagedListFooter } from "./components/PagedListFooter.js"
|
|
137
|
+
export type { PagedListFooterProps, PagedListState } from "./components/PagedListFooter.js"
|
|
138
|
+
|
|
139
|
+
// Feedback and states — one pattern each for toasts, empty and error states.
|
|
140
|
+
export { ToastProvider, useToast } from "./components/Toast.js"
|
|
141
|
+
export type { ToastApi, ToastOptions, ToastTone } from "./components/Toast.js"
|
|
142
|
+
export { EmptyState } from "./components/EmptyState.js"
|
|
143
|
+
export type { EmptyStateProps, StateHeadingLevel } from "./components/EmptyState.js"
|
|
144
|
+
export { ErrorState } from "./components/ErrorState.js"
|
|
145
|
+
export type { ErrorStateProps, ErrorStateTone } from "./components/ErrorState.js"
|
|
98
146
|
|
|
99
147
|
// Providers
|
|
100
148
|
export { AppQueryProvider, useCallTool, queryClient } from "./providers/query-provider.js"
|
|
@@ -103,7 +151,23 @@ export { AppQueryProvider, useCallTool, queryClient } from "./providers/query-pr
|
|
|
103
151
|
// `mcp-use/react`), so it belongs in this root barrel: a consumer can re-skin
|
|
104
152
|
// the toolkit's primitives from a single switch without pulling in the host
|
|
105
153
|
// runtime. See packages/ui/src/theme/ and docs/guides/white-labeling.md.
|
|
106
|
-
|
|
154
|
+
// The defaults are the Miragon theme (theme.css over the vendored --cd-*
|
|
155
|
+
// corporate-design tokens); a brand overrides the ROLE_TOKENS only.
|
|
156
|
+
export {
|
|
157
|
+
createTheme,
|
|
158
|
+
resolveThemeVars,
|
|
159
|
+
ROLE_TOKENS,
|
|
160
|
+
ThemeProvider,
|
|
161
|
+
useTheme,
|
|
162
|
+
usePortalContainer,
|
|
163
|
+
themePresets,
|
|
164
|
+
CD_TOKENS,
|
|
165
|
+
CD_TOKENS_VERSION,
|
|
166
|
+
fontFaces,
|
|
167
|
+
GEIST_FONT_FILES,
|
|
168
|
+
adoptHostFontVariables,
|
|
169
|
+
HOST_FONT_VARIABLES,
|
|
170
|
+
} from "./theme/index.js"
|
|
107
171
|
export type {
|
|
108
172
|
ThemeTokens,
|
|
109
173
|
ThemeDefinition,
|
|
@@ -113,6 +177,9 @@ export type {
|
|
|
113
177
|
ThemeContextValue,
|
|
114
178
|
ThemeProviderProps,
|
|
115
179
|
ThemePresetId,
|
|
180
|
+
CdTokenName,
|
|
181
|
+
FontFacesOptions,
|
|
182
|
+
InlineStyleTarget,
|
|
116
183
|
} from "./theme/index.js"
|
|
117
184
|
|
|
118
185
|
// i18n / localization. Browser-safe (React only, no `mcp-use/react`), so it
|
|
@@ -120,8 +187,30 @@ export type {
|
|
|
120
187
|
// <LocaleProvider locale=… translator=…> and reads the active locale with
|
|
121
188
|
// useLocale/useTranslate. Pairs with `createTranslator` from
|
|
122
189
|
// `@miragon/mcp-toolkit-core`. See packages/ui/src/locale/.
|
|
123
|
-
export {
|
|
124
|
-
|
|
190
|
+
export {
|
|
191
|
+
LocaleProvider,
|
|
192
|
+
useLocale,
|
|
193
|
+
useTranslate,
|
|
194
|
+
useToolkitMessages,
|
|
195
|
+
TOOLKIT_MESSAGES,
|
|
196
|
+
formatCount,
|
|
197
|
+
resolveToolkitMessages,
|
|
198
|
+
} from "./locale/index.js"
|
|
199
|
+
export type {
|
|
200
|
+
LocaleContextValue,
|
|
201
|
+
LocaleProviderProps,
|
|
202
|
+
BoundTranslate,
|
|
203
|
+
BuilderMessages,
|
|
204
|
+
CommonMessages,
|
|
205
|
+
FilterBarMessages,
|
|
206
|
+
ListFooterMessages,
|
|
207
|
+
PropsSheetMessages,
|
|
208
|
+
RendererMessages,
|
|
209
|
+
ToolkitLocale,
|
|
210
|
+
ToolkitMessages,
|
|
211
|
+
ToolkitMessagesOverride,
|
|
212
|
+
ViewMessages,
|
|
213
|
+
} from "./locale/index.js"
|
|
125
214
|
|
|
126
215
|
// NOTE: MCP App shell (McpAppView, WidgetRenderer) is exported from the
|
|
127
216
|
// `./app` subpath only. Keeping it out of the main barrel prevents consumers
|