@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,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
apply?: string;
|
|
5
|
-
cancel?: string;
|
|
6
|
-
reset?: string;
|
|
7
|
-
noProps?: string;
|
|
8
|
-
unsetOption?: string;
|
|
9
|
-
}
|
|
1
|
+
import type { PropsSheetMessages } from "../locale/toolkit-messages.js";
|
|
2
|
+
/** Override strings of the sheet; each defaults to the locale's `propsSheet` catalog. */
|
|
3
|
+
export type WidgetPropsSheetLabels = Partial<PropsSheetMessages>;
|
|
10
4
|
export interface WidgetPropsSheetProps {
|
|
11
5
|
open: boolean;
|
|
12
6
|
onOpenChange: (open: boolean) => void;
|
|
13
7
|
widgetId: string;
|
|
8
|
+
/** The widget's human name (its title); the id then shows as a quiet hint under it. */
|
|
9
|
+
widgetTitle?: string;
|
|
14
10
|
schema: Record<string, unknown> | undefined;
|
|
15
11
|
value: Record<string, unknown> | undefined;
|
|
16
12
|
onApply: (next: Record<string, unknown> | undefined) => void;
|
|
17
13
|
labels?: WidgetPropsSheetLabels;
|
|
18
14
|
}
|
|
19
|
-
export declare function WidgetPropsSheet({ open, onOpenChange, widgetId, schema, value, onApply, labels, }: WidgetPropsSheetProps): import("react").JSX.Element;
|
|
15
|
+
export declare function WidgetPropsSheet({ open, onOpenChange, widgetId, widgetTitle, schema, value, onApply, labels, }: WidgetPropsSheetProps): import("react").JSX.Element;
|
|
20
16
|
//# sourceMappingURL=widget-props-sheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-props-sheet.d.ts","sourceRoot":"","sources":["../../src/app/widget-props-sheet.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"widget-props-sheet.d.ts","sourceRoot":"","sources":["../../src/app/widget-props-sheet.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AA0CvE,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAIhE,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KAAK,IAAI,CAAA;IAC5D,MAAM,CAAC,EAAE,sBAAsB,CAAA;CAChC;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,MAAM,EACN,KAAK,EACL,OAAO,EACP,MAAM,GACP,EAAE,qBAAqB,+BAkFvB"}
|
|
@@ -5,18 +5,14 @@ import { Input } from "../primitives/input.js";
|
|
|
5
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../primitives/select.js";
|
|
6
6
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, } from "../primitives/sheet.js";
|
|
7
7
|
import { Switch } from "../primitives/switch.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
apply: "Apply",
|
|
12
|
-
cancel: "Cancel",
|
|
13
|
-
reset: "Reset",
|
|
14
|
-
noProps: "This widget takes no per-instance props.",
|
|
15
|
-
unsetOption: "(unset)",
|
|
16
|
-
};
|
|
8
|
+
import { useToolkitMessages } from "../locale/locale-provider.js";
|
|
9
|
+
import { propFieldText } from "./builder/builder-model.js";
|
|
10
|
+
import { useDisplayResolver } from "./builder/use-display-resolver.js";
|
|
17
11
|
const UNSET_SENTINEL = "__unset__";
|
|
18
|
-
export function WidgetPropsSheet({ open, onOpenChange, widgetId, schema, value, onApply, labels, }) {
|
|
19
|
-
const
|
|
12
|
+
export function WidgetPropsSheet({ open, onOpenChange, widgetId, widgetTitle, schema, value, onApply, labels, }) {
|
|
13
|
+
const messages = useToolkitMessages();
|
|
14
|
+
const { locale, resolveKey } = useDisplayResolver();
|
|
15
|
+
const L = { ...messages.propsSheet, ...labels };
|
|
20
16
|
const obj = (schema ?? {});
|
|
21
17
|
const [draft, setDraft] = useState(value ?? {});
|
|
22
18
|
// Reset the form to the saved value on the open→true transition so a
|
|
@@ -41,7 +37,7 @@ export function WidgetPropsSheet({ open, onOpenChange, widgetId, schema, value,
|
|
|
41
37
|
onApply(Object.keys(cleaned).length > 0 ? cleaned : undefined);
|
|
42
38
|
onOpenChange(false);
|
|
43
39
|
};
|
|
44
|
-
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { className: "w-[400px] sm:max-w-md", children: [_jsxs(SheetHeader, { children: [_jsx(SheetTitle, { children: L.title }), _jsxs(SheetDescription, { children: [_jsx("span", {
|
|
40
|
+
return (_jsx(Sheet, { open: open, onOpenChange: onOpenChange, children: _jsxs(SheetContent, { className: "w-[400px] sm:max-w-md", children: [_jsxs(SheetHeader, { children: [_jsx(SheetTitle, { children: L.title }), _jsxs(SheetDescription, { className: "flex flex-col items-start gap-1", children: [_jsx("span", { children: L.description }), widgetTitle && _jsx("span", { className: "text-foreground font-medium", children: widgetTitle }), _jsx("span", { className: "bg-muted text-small rounded px-1 font-mono", children: widgetId })] })] }), _jsx("div", { className: "flex flex-col gap-4 px-4 py-4", children: propEntries.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: L.noProps })) : (propEntries.map(([key, prop]) => (_jsx(PropertyField, { name: key, text: propFieldText(key, prop, locale, resolveKey), prop: prop, value: draft[key], unsetLabel: L.unsetOption, unsupportedLabel: L.unsupportedType, onChange: (v) => setDraft((prev) => {
|
|
45
41
|
if (v === undefined) {
|
|
46
42
|
const rest = {};
|
|
47
43
|
for (const [k, val] of Object.entries(prev)) {
|
|
@@ -53,20 +49,20 @@ export function WidgetPropsSheet({ open, onOpenChange, widgetId, schema, value,
|
|
|
53
49
|
return { ...prev, [key]: v };
|
|
54
50
|
}) }, key)))) }), _jsxs("div", { className: "flex items-center justify-end gap-2 border-t px-4 py-3", children: [_jsx(Button, { variant: "ghost", onClick: () => setDraft({}), children: L.reset }), _jsx(Button, { variant: "outline", onClick: () => onOpenChange(false), children: L.cancel }), _jsx(Button, { onClick: handleApply, children: L.apply })] })] }) }));
|
|
55
51
|
}
|
|
56
|
-
function PropertyField({ name, prop, value, unsetLabel, onChange, }) {
|
|
52
|
+
function PropertyField({ name, text, prop, value, unsetLabel, unsupportedLabel, onChange, }) {
|
|
57
53
|
const id = `prop-${name}`;
|
|
58
54
|
if (prop.type === "string" && Array.isArray(prop.enum)) {
|
|
59
55
|
const options = prop.enum.filter((v) => typeof v === "string");
|
|
60
56
|
const current = typeof value === "string" && value !== "" ? value : UNSET_SENTINEL;
|
|
61
|
-
return (_jsx(FieldShell, { id: id,
|
|
57
|
+
return (_jsx(FieldShell, { id: id, text: text, children: _jsxs(Select, { value: current, onValueChange: (v) => onChange(v === UNSET_SENTINEL ? undefined : v), children: [_jsx(SelectTrigger, { id: id, "aria-describedby": helpId(id, text), children: _jsx(SelectValue, { placeholder: unsetLabel }) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: UNSET_SENTINEL, children: unsetLabel }), options.map((opt) => (_jsx(SelectItem, { value: opt, children: opt }, opt)))] })] }) }));
|
|
62
58
|
}
|
|
63
59
|
if (prop.type === "string") {
|
|
64
60
|
const current = typeof value === "string" ? value : "";
|
|
65
|
-
return (_jsx(FieldShell, { id: id,
|
|
61
|
+
return (_jsx(FieldShell, { id: id, text: text, children: _jsx(Input, { id: id, "aria-describedby": helpId(id, text), value: current, onChange: (e) => onChange(e.target.value === "" ? undefined : e.target.value) }) }));
|
|
66
62
|
}
|
|
67
63
|
if (prop.type === "number" || prop.type === "integer") {
|
|
68
64
|
const current = typeof value === "number" ? String(value) : "";
|
|
69
|
-
return (_jsx(FieldShell, { id: id,
|
|
65
|
+
return (_jsx(FieldShell, { id: id, text: text, children: _jsx(Input, { id: id, "aria-describedby": helpId(id, text), type: "number", value: current, onChange: (e) => {
|
|
70
66
|
const raw = e.target.value;
|
|
71
67
|
if (raw === "")
|
|
72
68
|
return onChange(undefined);
|
|
@@ -77,11 +73,20 @@ function PropertyField({ name, prop, value, unsetLabel, onChange, }) {
|
|
|
77
73
|
}
|
|
78
74
|
if (prop.type === "boolean") {
|
|
79
75
|
const current = value === true;
|
|
80
|
-
return (_jsx(FieldShell, { id: id,
|
|
76
|
+
return (_jsx(FieldShell, { id: id, text: text, children: _jsx(Switch, { id: id, "aria-describedby": helpId(id, text), checked: current, onCheckedChange: (checked) => onChange(checked || undefined) }) }));
|
|
81
77
|
}
|
|
82
|
-
return (_jsx(FieldShell, { id: id,
|
|
78
|
+
return (_jsx(FieldShell, { id: id, text: text, children: _jsx("p", { className: "text-muted-foreground text-small italic", children: unsupportedLabel(prop.type ?? "?") }) }));
|
|
83
79
|
}
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
/** The id of a field's help line, when it has one (its `aria-describedby`). */
|
|
81
|
+
function helpId(id, text) {
|
|
82
|
+
return text.help ? `${id}-help` : undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Label (the human title), the raw property name as a quiet hint beside it
|
|
86
|
+
* (outside the label, so the accessible name stays the title), the control,
|
|
87
|
+
* and the help line it is described by.
|
|
88
|
+
*/
|
|
89
|
+
function FieldShell({ id, text, children, }) {
|
|
90
|
+
return (_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2", children: [_jsx("label", { htmlFor: id, className: "text-sm font-medium", children: text.label }), text.hint && (_jsx("code", { "data-slot": "prop-name", className: "text-muted-foreground text-small font-mono", children: text.hint }))] }), children, text.help ? (_jsx("p", { id: helpId(id, text), className: "text-muted-foreground text-small", children: text.help })) : null] }));
|
|
86
91
|
}
|
|
87
92
|
//# sourceMappingURL=widget-props-sheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-props-sheet.js","sourceRoot":"","sources":["../../src/app/widget-props-sheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,UAAU,GACX,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"widget-props-sheet.js","sourceRoot":"","sources":["../../src/app/widget-props-sheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EACL,MAAM,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,KAAK,GACL,EACP,IAAI,CAAC,IAAI,IAAI,CACZ,4BAAgB,WAAW,EAAC,SAAS,EAAC,4CAA4C,YAC/E,IAAI,CAAC,IAAI,GACL,CACR,IACG,EACL,QAAQ,EACR,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACX,YAAG,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,SAAS,EAAC,kCAAkC,YAClE,IAAI,CAAC,IAAI,GACR,CACL,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { Component, type ComponentType, type ReactNode, type ErrorInfo } from "react";
|
|
2
2
|
import type { LayoutConfig, PipelineContext, WidgetProps } from "@miragon/mcp-toolkit-core";
|
|
3
3
|
export type WidgetComponent = ComponentType<WidgetProps>;
|
|
4
|
+
/**
|
|
5
|
+
* True when two reset-key lists differ (length or any entry by identity).
|
|
6
|
+
* Exported for tests: it decides when a crashed widget gets a fresh render.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resetKeysChanged(prev: readonly unknown[] | undefined, next: readonly unknown[] | undefined): boolean;
|
|
4
9
|
/**
|
|
5
10
|
* Catches render-time crashes from a single widget so one broken widget
|
|
6
11
|
* can't take down the entire iframe view (or the builder canvas/preview).
|
|
7
12
|
*
|
|
13
|
+
* The fallback is localized, names what happened, keeps the raw error under
|
|
14
|
+
* "Details" and offers a retry. The boundary resets itself when its
|
|
15
|
+
* `resetKeys` change, so new data (a refresh, a new tool result, a builder
|
|
16
|
+
* edit) gets a fresh render instead of a latched failure (toolkit#176 N24).
|
|
17
|
+
* When a retry crashes again, keyboard focus moves to the new retry button
|
|
18
|
+
* instead of falling back to the document (the pressed one unmounted). After
|
|
19
|
+
* a retry that renders, the widget's own markup is unknown here, so focus
|
|
20
|
+
* returns to the document.
|
|
21
|
+
*
|
|
8
22
|
* Exported so the visual builder's canvas + preview render sites reuse the
|
|
9
23
|
* same isolation the rendered `WidgetRenderer` already had — every place a
|
|
10
24
|
* widget component is rendered goes through {@link RenderedWidget}, which
|
|
@@ -13,18 +27,39 @@ export type WidgetComponent = ComponentType<WidgetProps>;
|
|
|
13
27
|
export declare class WidgetErrorBoundary extends Component<{
|
|
14
28
|
widgetId: string;
|
|
15
29
|
children: ReactNode;
|
|
30
|
+
resetKeys?: readonly unknown[];
|
|
16
31
|
}, {
|
|
17
32
|
error: Error | null;
|
|
18
33
|
}> {
|
|
19
34
|
state: {
|
|
20
35
|
error: Error | null;
|
|
21
36
|
};
|
|
37
|
+
/** Set by the user's retry; consumed by the next update. */
|
|
38
|
+
private retryFocusOwed;
|
|
39
|
+
private readonly fallbackRef;
|
|
22
40
|
static getDerivedStateFromError(error: Error): {
|
|
23
41
|
error: Error;
|
|
24
42
|
};
|
|
25
43
|
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
44
|
+
componentDidUpdate(prevProps: {
|
|
45
|
+
resetKeys?: readonly unknown[];
|
|
46
|
+
}): void;
|
|
47
|
+
reset: () => void;
|
|
48
|
+
/** The fallback's retry: a reset that keeps keyboard focus if the widget crashes again. */
|
|
49
|
+
retry: () => void;
|
|
26
50
|
render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
27
51
|
}
|
|
52
|
+
/** The localized crash fallback of {@link WidgetErrorBoundary}. */
|
|
53
|
+
export declare function WidgetCrashFallback({ widgetId, error, onRetry, }: {
|
|
54
|
+
widgetId: string;
|
|
55
|
+
error: Error;
|
|
56
|
+
onRetry: () => void;
|
|
57
|
+
}): import("react").JSX.Element;
|
|
58
|
+
/** A layout cell names a widget the bundle does not contain: say so, quietly. */
|
|
59
|
+
export declare function UnavailableWidget({ widgetId, className, }: {
|
|
60
|
+
widgetId: string;
|
|
61
|
+
className?: string;
|
|
62
|
+
}): import("react").JSX.Element;
|
|
28
63
|
/**
|
|
29
64
|
* True when the pipeline context carries no widget data at all — no step
|
|
30
65
|
* results and no keys. A widget rendered against an empty context typically
|
|
@@ -40,7 +75,7 @@ export declare function contextHasNoData(context: PipelineContext): boolean;
|
|
|
40
75
|
* The single render site for a layout cell's widget, shared across the
|
|
41
76
|
* rendered view (`RowsRenderer`), the builder canvas, and the builder
|
|
42
77
|
* preview so all three isolate crashes identically:
|
|
43
|
-
* - missing component → "not
|
|
78
|
+
* - missing component → a localized "not available in this version" note,
|
|
44
79
|
* - render crash → caught by {@link WidgetErrorBoundary} (Finding [1]),
|
|
45
80
|
* - (builder only, opt-in) empty pipeline context → a dezent
|
|
46
81
|
* "no data yet" hint (Finding [4]).
|
|
@@ -83,5 +118,10 @@ export interface WidgetRendererProps {
|
|
|
83
118
|
*/
|
|
84
119
|
widgets: Record<string, WidgetComponent>;
|
|
85
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* The pipeline context widgets read. `WidgetRenderer` rebuilds it only when
|
|
123
|
+
* the view data changes — its identity is the error boundaries' reset key.
|
|
124
|
+
*/
|
|
125
|
+
export declare function buildPipelineContext(keys: Record<string, unknown>, stepData: WidgetRendererProps["stepData"], errors: WidgetRendererProps["errors"]): PipelineContext;
|
|
86
126
|
export declare function WidgetRenderer({ layout, keys, stepData, errors, widgets }: WidgetRendererProps): import("react").JSX.Element;
|
|
87
127
|
//# sourceMappingURL=widget-renderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-renderer.d.ts","sourceRoot":"","sources":["../../src/app/widget-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"widget-renderer.d.ts","sourceRoot":"","sources":["../../src/app/widget-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO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U,CAAC,EACzC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,GACpC,eAAe,CAMjB;AAED,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,+BA2B9F"}
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Component } from "react";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Component, createRef, useMemo, } from "react";
|
|
3
3
|
import { normalizeLayout } from "@miragon/mcp-toolkit-core";
|
|
4
|
+
import { ErrorState } from "../components/ErrorState.js";
|
|
4
5
|
import { GridLayout, GridItem } from "../components/GridLayout.js";
|
|
5
|
-
import {
|
|
6
|
+
import { useToolkitMessages } from "../locale/locale-provider.js";
|
|
6
7
|
import { Tabs, TabsList, TabsTrigger, TabsContent } from "../primitives/tabs.js";
|
|
8
|
+
/**
|
|
9
|
+
* True when two reset-key lists differ (length or any entry by identity).
|
|
10
|
+
* Exported for tests: it decides when a crashed widget gets a fresh render.
|
|
11
|
+
*/
|
|
12
|
+
export function resetKeysChanged(prev, next) {
|
|
13
|
+
if (prev === next)
|
|
14
|
+
return false;
|
|
15
|
+
if (!prev || !next || prev.length !== next.length)
|
|
16
|
+
return true;
|
|
17
|
+
return prev.some((value, idx) => !Object.is(value, next[idx]));
|
|
18
|
+
}
|
|
7
19
|
/**
|
|
8
20
|
* Catches render-time crashes from a single widget so one broken widget
|
|
9
21
|
* can't take down the entire iframe view (or the builder canvas/preview).
|
|
10
22
|
*
|
|
23
|
+
* The fallback is localized, names what happened, keeps the raw error under
|
|
24
|
+
* "Details" and offers a retry. The boundary resets itself when its
|
|
25
|
+
* `resetKeys` change, so new data (a refresh, a new tool result, a builder
|
|
26
|
+
* edit) gets a fresh render instead of a latched failure (toolkit#176 N24).
|
|
27
|
+
* When a retry crashes again, keyboard focus moves to the new retry button
|
|
28
|
+
* instead of falling back to the document (the pressed one unmounted). After
|
|
29
|
+
* a retry that renders, the widget's own markup is unknown here, so focus
|
|
30
|
+
* returns to the document.
|
|
31
|
+
*
|
|
11
32
|
* Exported so the visual builder's canvas + preview render sites reuse the
|
|
12
33
|
* same isolation the rendered `WidgetRenderer` already had — every place a
|
|
13
34
|
* widget component is rendered goes through {@link RenderedWidget}, which
|
|
@@ -15,19 +36,50 @@ import { Tabs, TabsList, TabsTrigger, TabsContent } from "../primitives/tabs.js"
|
|
|
15
36
|
*/
|
|
16
37
|
export class WidgetErrorBoundary extends Component {
|
|
17
38
|
state = { error: null };
|
|
39
|
+
/** Set by the user's retry; consumed by the next update. */
|
|
40
|
+
retryFocusOwed = false;
|
|
41
|
+
fallbackRef = createRef();
|
|
18
42
|
static getDerivedStateFromError(error) {
|
|
19
43
|
return { error };
|
|
20
44
|
}
|
|
21
45
|
componentDidCatch(error, info) {
|
|
22
46
|
console.error(`Widget ${this.props.widgetId} crashed:`, error, info);
|
|
23
47
|
}
|
|
48
|
+
componentDidUpdate(prevProps) {
|
|
49
|
+
if (this.retryFocusOwed) {
|
|
50
|
+
this.retryFocusOwed = false;
|
|
51
|
+
if (this.state.error)
|
|
52
|
+
this.fallbackRef.current?.querySelector("button")?.focus();
|
|
53
|
+
}
|
|
54
|
+
if (this.state.error && resetKeysChanged(prevProps.resetKeys, this.props.resetKeys)) {
|
|
55
|
+
this.reset();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
reset = () => {
|
|
59
|
+
this.setState({ error: null });
|
|
60
|
+
};
|
|
61
|
+
/** The fallback's retry: a reset that keeps keyboard focus if the widget crashes again. */
|
|
62
|
+
retry = () => {
|
|
63
|
+
this.retryFocusOwed = true;
|
|
64
|
+
this.reset();
|
|
65
|
+
};
|
|
24
66
|
render() {
|
|
25
67
|
if (this.state.error) {
|
|
26
|
-
return (_jsx(
|
|
68
|
+
return (_jsx("div", { ref: this.fallbackRef, "data-slot": "widget-crash", children: _jsx(WidgetCrashFallback, { widgetId: this.props.widgetId, error: this.state.error, onRetry: this.retry }) }));
|
|
27
69
|
}
|
|
28
70
|
return this.props.children;
|
|
29
71
|
}
|
|
30
72
|
}
|
|
73
|
+
/** The localized crash fallback of {@link WidgetErrorBoundary}. */
|
|
74
|
+
export function WidgetCrashFallback({ widgetId, error, onRetry, }) {
|
|
75
|
+
const messages = useToolkitMessages();
|
|
76
|
+
return (_jsx(ErrorState, { variant: "inline", title: messages.renderer.widgetCrashed, details: `${widgetId}: ${error.message}`, onRetry: onRetry }));
|
|
77
|
+
}
|
|
78
|
+
/** A layout cell names a widget the bundle does not contain: say so, quietly. */
|
|
79
|
+
export function UnavailableWidget({ widgetId, className = "text-muted-foreground rounded-md border border-dashed p-4 text-sm", }) {
|
|
80
|
+
const messages = useToolkitMessages();
|
|
81
|
+
return (_jsxs("div", { "data-slot": "widget-unavailable", "data-widget-id": widgetId, className: className, children: [_jsx("p", { children: messages.renderer.widgetUnavailable }), _jsx("p", { className: "text-small mt-1 font-mono break-all", children: widgetId })] }));
|
|
82
|
+
}
|
|
31
83
|
/**
|
|
32
84
|
* True when the pipeline context carries no widget data at all — no step
|
|
33
85
|
* results and no keys. A widget rendered against an empty context typically
|
|
@@ -45,7 +97,7 @@ export function contextHasNoData(context) {
|
|
|
45
97
|
* The single render site for a layout cell's widget, shared across the
|
|
46
98
|
* rendered view (`RowsRenderer`), the builder canvas, and the builder
|
|
47
99
|
* preview so all three isolate crashes identically:
|
|
48
|
-
* - missing component → "not
|
|
100
|
+
* - missing component → a localized "not available in this version" note,
|
|
49
101
|
* - render crash → caught by {@link WidgetErrorBoundary} (Finding [1]),
|
|
50
102
|
* - (builder only, opt-in) empty pipeline context → a dezent
|
|
51
103
|
* "no data yet" hint (Finding [4]).
|
|
@@ -59,43 +111,42 @@ export function contextHasNoData(context) {
|
|
|
59
111
|
* `notBundledClassName` lets each surface match its own chrome (the builder
|
|
60
112
|
* uses denser padding/text than the rendered view).
|
|
61
113
|
*/
|
|
62
|
-
export function RenderedWidget({ widget: Widget, widgetId, props, cellProps, showEmptyHint = false, notBundledClassName
|
|
63
|
-
if (!Widget)
|
|
64
|
-
return
|
|
65
|
-
}
|
|
114
|
+
export function RenderedWidget({ widget: Widget, widgetId, props, cellProps, showEmptyHint = false, notBundledClassName, }) {
|
|
115
|
+
if (!Widget)
|
|
116
|
+
return _jsx(UnavailableWidget, { widgetId: widgetId, className: notBundledClassName });
|
|
66
117
|
if (showEmptyHint && contextHasNoData(props.context)) {
|
|
67
|
-
return
|
|
118
|
+
return _jsx(NoDataYet, { className: notBundledClassName });
|
|
68
119
|
}
|
|
69
|
-
return (_jsx(WidgetErrorBoundary, { widgetId: widgetId, children: _jsx(Widget, { ...props, widgetProps: cellProps }) }));
|
|
120
|
+
return (_jsx(WidgetErrorBoundary, { widgetId: widgetId, resetKeys: [props.context, props.keys, cellProps], children: _jsx(Widget, { ...props, widgetProps: cellProps }) }));
|
|
121
|
+
}
|
|
122
|
+
function NoDataYet({ className = "text-muted-foreground rounded-md border border-dashed p-4 text-sm", }) {
|
|
123
|
+
const messages = useToolkitMessages();
|
|
124
|
+
return _jsx("div", { className: className, children: messages.renderer.noDataYet });
|
|
70
125
|
}
|
|
71
126
|
function RowsRenderer({ rows, props, widgets, }) {
|
|
72
127
|
return (_jsx("div", { className: "flex flex-col gap-4", children: rows.map((row, rowIdx) => (_jsx(GridLayout, { children: row.row.map((cell, cellIdx) => {
|
|
73
128
|
const WidgetComponent = widgets[cell.widget];
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
return null;
|
|
80
|
-
// Use a composite key so the same widget can appear in multiple
|
|
81
|
-
// cells of one row (e.g. side-by-side scoped dashboards) without
|
|
82
|
-
// colliding on React's reconciliation key.
|
|
129
|
+
// An unknown widget id renders the localized "not available"
|
|
130
|
+
// note in its cell instead of vanishing (an empty page reads as
|
|
131
|
+
// broken). The composite key lets the same widget appear in
|
|
132
|
+
// several cells of one row (e.g. side-by-side scoped dashboards)
|
|
133
|
+
// without colliding on React's reconciliation key.
|
|
83
134
|
return (_jsx(GridItem, { span: cell.span ?? 12, children: _jsx(RenderedWidget, { widget: WidgetComponent, widgetId: cell.widget, props: props, cellProps: cell.props }) }, `${cell.widget}-${cellIdx}`));
|
|
84
135
|
}) }, rowIdx))) }));
|
|
85
136
|
}
|
|
86
|
-
|
|
137
|
+
/**
|
|
138
|
+
* The pipeline context widgets read. `WidgetRenderer` rebuilds it only when
|
|
139
|
+
* the view data changes — its identity is the error boundaries' reset key.
|
|
140
|
+
*/
|
|
141
|
+
export function buildPipelineContext(keys, stepData, errors) {
|
|
87
142
|
const steps = {};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
steps[id] = { ...result, _step: id };
|
|
91
|
-
}
|
|
143
|
+
for (const [id, result] of Object.entries(stepData ?? {})) {
|
|
144
|
+
steps[id] = { ...result, _step: id };
|
|
92
145
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
const widgetProps = { keys, context: pipelineContext };
|
|
146
|
+
return { steps, keys, errors };
|
|
147
|
+
}
|
|
148
|
+
export function WidgetRenderer({ layout, keys, stepData, errors, widgets }) {
|
|
149
|
+
const widgetProps = useMemo(() => ({ keys, context: buildPipelineContext(keys, stepData, errors) }), [keys, stepData, errors]);
|
|
99
150
|
const normalized = normalizeLayout(layout);
|
|
100
151
|
if ("tabs" in normalized) {
|
|
101
152
|
return (_jsxs(Tabs, { defaultValue: normalized.tabs[0]?.label, children: [_jsx(TabsList, { children: normalized.tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.label, children: tab.label }, tab.label))) }), normalized.tabs.map((tab) => (_jsx(TabsContent, { value: tab.label, children: _jsx(RowsRenderer, { rows: tab.rows, props: widgetProps, widgets: widgets }) }, tab.label)))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-renderer.js","sourceRoot":"","sources":["../../src/app/widget-renderer.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"widget-renderer.js","sourceRoot":"","sources":["../../src/app/widget-renderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,OAAO,GAIR,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAIhF;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAoC,EACpC,IAAoC;IAEpC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAC/B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAChE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAGxC;IACU,KAAK,GAA4B,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IACzD,4DAA4D;IACpD,cAAc,GAAG,KAAK,CAAA;IACb,WAAW,GAAG,SAAS,EAAkB,CAAA;IAC1D,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,KAAK,EAAE,CAAA;IAClB,CAAC;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GAAG,CAAC,KAAK,CAEb,CACf,CAAC,GACO,EACV,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAC5B,KAAC,WAAW,IAAiB,KAAK,EAAE,GAAG,CAAC,KAAK,YAC3C,KAAC,YAAY,IAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAI,IADtD,GAAG,CAAC,KAAK,CAEb,CACf,CAAC,IACG,CACR,CAAA;IACH,CAAC;IAED,OAAO,KAAC,YAAY,IAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAI,CAAA;AACtF,CAAC"}
|
|
@@ -4,19 +4,22 @@ export interface DrillButtonProps {
|
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
/** Drill/navigation handler — wire to in-widget navigation (e.g. `showWidget`). */
|
|
6
6
|
onDrill: () => void;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Optional leading icon — a Lucide icon of the domain, never a typed glyph.
|
|
9
|
+
* Decorative (`aria-hidden`). The trailing arrow is always rendered.
|
|
10
|
+
*/
|
|
8
11
|
icon?: ReactNode;
|
|
9
12
|
/** `sm` for table rows, `md` for surface headers. Default `"sm"`. */
|
|
10
13
|
size?: "sm" | "md";
|
|
11
|
-
/** Accessible label when the visible text is terse. */
|
|
14
|
+
/** Accessible label when the visible text is terse; keep the visible text in it (WCAG 2.5.3). */
|
|
12
15
|
ariaLabel?: string;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* The single, deterministic in-widget navigation control: a neutral outline
|
|
16
|
-
* button with a trailing
|
|
17
|
-
* every in-app drill (row "Open", header nav) so they read identically
|
|
18
|
-
* visually quieter than primary/agentic actions. Decoupled from any
|
|
19
|
-
* an `onDrill` callback (e.g. wrapping `useHostActions().showWidget`).
|
|
19
|
+
* button with a trailing Lucide arrow that drills into a detail/sub-view. Use
|
|
20
|
+
* it for every in-app drill (row "Open", header nav) so they read identically
|
|
21
|
+
* and stay visually quieter than primary/agentic actions. Decoupled from any
|
|
22
|
+
* host — pass an `onDrill` callback (e.g. wrapping `useHostActions().showWidget`).
|
|
20
23
|
*/
|
|
21
24
|
export declare function DrillButton({ children, onDrill, icon, size, ariaLabel }: DrillButtonProps): import("react").JSX.Element;
|
|
22
25
|
//# sourceMappingURL=DrillButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrillButton.d.ts","sourceRoot":"","sources":["../../src/components/DrillButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"DrillButton.d.ts","sourceRoot":"","sources":["../../src/components/DrillButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB;IACpB,QAAQ,EAAE,SAAS,CAAA;IACnB,mFAAmF;IACnF,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,qEAAqE;IACrE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,iGAAiG;IACjG,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAW,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAsBhG"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowRight } from "lucide-react";
|
|
3
|
+
import { FOCUS_RING } from "../lib/focus-ring.js";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
2
5
|
/**
|
|
3
6
|
* The single, deterministic in-widget navigation control: a neutral outline
|
|
4
|
-
* button with a trailing
|
|
5
|
-
* every in-app drill (row "Open", header nav) so they read identically
|
|
6
|
-
* visually quieter than primary/agentic actions. Decoupled from any
|
|
7
|
-
* an `onDrill` callback (e.g. wrapping `useHostActions().showWidget`).
|
|
7
|
+
* button with a trailing Lucide arrow that drills into a detail/sub-view. Use
|
|
8
|
+
* it for every in-app drill (row "Open", header nav) so they read identically
|
|
9
|
+
* and stay visually quieter than primary/agentic actions. Decoupled from any
|
|
10
|
+
* host — pass an `onDrill` callback (e.g. wrapping `useHostActions().showWidget`).
|
|
8
11
|
*/
|
|
9
12
|
export function DrillButton({ children, onDrill, icon, size = "sm", ariaLabel }) {
|
|
10
|
-
const pad = size === "md" ? "px-3 py-1.5 text-
|
|
11
|
-
return (_jsxs("button", { type: "button", onClick: onDrill, "aria-label": ariaLabel, className:
|
|
13
|
+
const pad = size === "md" ? "px-3 py-1.5 text-dense" : "px-2.5 py-1 text-small";
|
|
14
|
+
return (_jsxs("button", { type: "button", onClick: onDrill, "aria-label": ariaLabel, className: cn("border-border text-foreground hover:border-focus hover:bg-accent hover:text-accent-foreground inline-flex items-center gap-1 rounded-md border font-medium transition-colors [&_svg:not([class*='size-'])]:size-4", FOCUS_RING, pad), children: [icon && (_jsx("span", { "aria-hidden": "true", className: "inline-flex", children: icon })), children, _jsx(ArrowRight, { "aria-hidden": "true", className: "size-4 shrink-0" })] }));
|
|
12
15
|
}
|
|
13
16
|
//# sourceMappingURL=DrillButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrillButton.js","sourceRoot":"","sources":["../../src/components/DrillButton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"DrillButton.js","sourceRoot":"","sources":["../../src/components/DrillButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AAkBpC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAoB;IAC/F,MAAM,GAAG,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,wBAAwB,CAAA;IAC/E,OAAO,CACL,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,SAAS,EACrB,SAAS,EAAE,EAAE,CACX,mNAAmN,EACnN,UAAU,EACV,GAAG,CACJ,aAEA,IAAI,IAAI,CACP,8BAAkB,MAAM,EAAC,SAAS,EAAC,aAAa,YAC7C,IAAI,GACA,CACR,EACA,QAAQ,EACT,KAAC,UAAU,mBAAa,MAAM,EAAC,SAAS,EAAC,iBAAiB,GAAG,IACtD,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Heading element for an empty/error state title (the surface decides the outline level). */
|
|
3
|
+
export type StateHeadingLevel = "h2" | "h3" | "h4" | "p";
|
|
4
|
+
export interface EmptyStateProps {
|
|
5
|
+
/**
|
|
6
|
+
* Icon or mark above the title, rendered decoratively (`aria-hidden`): a
|
|
7
|
+
* Lucide icon for the concrete situation (e.g. `<CircleCheck />` for "all
|
|
8
|
+
* done"), or a brand mark (an app passes its logo; a customer brand passes
|
|
9
|
+
* its own or nothing). An SVG renders at 24 px unless it carries its own
|
|
10
|
+
* `size-*` class, so a mark can be larger (`<Komet className="size-12" />`).
|
|
11
|
+
*/
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
/** Colour of the icon slot: `"neutral"` (muted, default) or `"success"` ("all done"). */
|
|
14
|
+
tone?: "neutral" | "success";
|
|
15
|
+
/** What is empty, in plain words ("No open incidents"). */
|
|
16
|
+
title: ReactNode;
|
|
17
|
+
/** One help line: why it is empty or what to do next. */
|
|
18
|
+
description?: ReactNode;
|
|
19
|
+
/** The primary next step (a `Button`). */
|
|
20
|
+
action?: ReactNode;
|
|
21
|
+
/** An optional second, quieter step. Empty states carry at most two actions. */
|
|
22
|
+
secondaryAction?: ReactNode;
|
|
23
|
+
/** Element of the title. Default `"h3"` (inside a widget below its own heading). */
|
|
24
|
+
titleAs?: StateHeadingLevel;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The one empty-state pattern: icon or mark, a title (600), one help line and
|
|
29
|
+
* up to two actions, centred in the space the content would take. Static (no
|
|
30
|
+
* live region): it replaces content, it does not announce a change.
|
|
31
|
+
*/
|
|
32
|
+
export declare function EmptyState({ icon, tone, title, description, action, secondaryAction, titleAs: Title, className, }: EmptyStateProps): import("react").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=EmptyState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../src/components/EmptyState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,8FAA8F;AAC9F,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,CAAA;AAExD,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,yFAAyF;IACzF,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC5B,2DAA2D;IAC3D,KAAK,EAAE,SAAS,CAAA;IAChB,yDAAyD;IACzD,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,gFAAgF;IAChF,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B,oFAAoF;IACpF,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAQD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,IAAgB,EAChB,KAAK,EACL,WAAW,EACX,MAAM,EACN,eAAe,EACf,OAAO,EAAE,KAAY,EACrB,SAAS,GACV,EAAE,eAAe,+BA+BjB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { resolveTone, TONE_ICON } from "../lib/tone-utils.js";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
/** The icon slot in the tone's icon colour (`TONE_ICON`): quiet, or the success tone. */
|
|
5
|
+
const ICON_TONE = {
|
|
6
|
+
neutral: TONE_ICON.neutral,
|
|
7
|
+
success: TONE_ICON.success,
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The one empty-state pattern: icon or mark, a title (600), one help line and
|
|
11
|
+
* up to two actions, centred in the space the content would take. Static (no
|
|
12
|
+
* live region): it replaces content, it does not announce a change.
|
|
13
|
+
*/
|
|
14
|
+
export function EmptyState({ icon, tone = "neutral", title, description, action, secondaryAction, titleAs: Title = "h3", className, }) {
|
|
15
|
+
// An untyped tone resolves (`ok` → success); anything else stays quiet.
|
|
16
|
+
const iconTone = resolveTone(tone) === "success" ? "success" : "neutral";
|
|
17
|
+
return (_jsxs("div", { "data-slot": "empty-state", className: cn("flex flex-col items-center gap-2 px-4 py-8 text-center", className), children: [icon && (_jsx("div", { "aria-hidden": "true", className: cn("mb-1 flex items-center justify-center [&_svg:not([class*='size-'])]:size-6", ICON_TONE[iconTone]), children: icon })), _jsx(Title, { className: "text-foreground text-body font-semibold", children: title }), description && (_jsx("p", { className: "text-muted-foreground text-body max-w-prose text-balance", children: description })), (action || secondaryAction) && (_jsxs("div", { className: "mt-2 flex flex-wrap items-center justify-center gap-2", children: [action, secondaryAction] }))] }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=EmptyState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyState.js","sourceRoot":"","sources":["../../src/components/EmptyState.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AA6BpC,yFAAyF;AACzF,MAAM,SAAS,GAAyD;IACtE,OAAO,EAAE,SAAS,CAAC,OAAO;IAC1B,OAAO,EAAE,SAAS,CAAC,OAAO;CAC3B,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,IAAI,GAAG,SAAS,EAChB,KAAK,EACL,WAAW,EACX,MAAM,EACN,eAAe,EACf,OAAO,EAAE,KAAK,GAAG,IAAI,EACrB,SAAS,GACO;IAChB,wEAAwE;IACxE,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;IACxE,OAAO,CACL,4BACY,aAAa,EACvB,SAAS,EAAE,EAAE,CAAC,wDAAwD,EAAE,SAAS,CAAC,aAEjF,IAAI,IAAI,CACP,6BACc,MAAM,EAClB,SAAS,EAAE,EAAE,CACX,4EAA4E,EAC5E,SAAS,CAAC,QAAQ,CAAC,CACpB,YAEA,IAAI,GACD,CACP,EACD,KAAC,KAAK,IAAC,SAAS,EAAC,yCAAyC,YAAE,KAAK,GAAS,EACzE,WAAW,IAAI,CACd,YAAG,SAAS,EAAC,0DAA0D,YAAE,WAAW,GAAK,CAC1F,EACA,CAAC,MAAM,IAAI,eAAe,CAAC,IAAI,CAC9B,eAAK,SAAS,EAAC,uDAAuD,aACnE,MAAM,EACN,eAAe,IACZ,CACP,IACG,CACP,CAAA;AACH,CAAC"}
|