@cohesivesystems/presentation-react-shadcn 0.1.0-alpha.1
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/LICENSE +55 -0
- package/dist/document-workspace-surface-slot-renderers.d.ts +58 -0
- package/dist/document-workspace-surface-slot-renderers.d.ts.map +1 -0
- package/dist/document-workspace-surface-slot-renderers.js +206 -0
- package/dist/document-workspace-surface-slot-renderers.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts +8 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.js +2 -0
- package/dist/navigation-shell-frame-renderer-registry.js.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts +9 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.js +2 -0
- package/dist/navigation-shell-slot-renderer-registry.js.map +1 -0
- package/dist/page-host-unavailable-renderer.d.ts +10 -0
- package/dist/page-host-unavailable-renderer.d.ts.map +1 -0
- package/dist/page-host-unavailable-renderer.js +27 -0
- package/dist/page-host-unavailable-renderer.js.map +1 -0
- package/dist/presentation-action-group.d.ts +99 -0
- package/dist/presentation-action-group.d.ts.map +1 -0
- package/dist/presentation-action-group.js +214 -0
- package/dist/presentation-action-group.js.map +1 -0
- package/dist/presentation-badge-target-interpreter.d.ts +26 -0
- package/dist/presentation-badge-target-interpreter.d.ts.map +1 -0
- package/dist/presentation-badge-target-interpreter.js +17 -0
- package/dist/presentation-badge-target-interpreter.js.map +1 -0
- package/dist/presentation-component-groups.d.ts +968 -0
- package/dist/presentation-component-groups.d.ts.map +1 -0
- package/dist/presentation-component-groups.js +505 -0
- package/dist/presentation-component-groups.js.map +1 -0
- package/dist/presentation-component-system-diagnostics.d.ts +27 -0
- package/dist/presentation-component-system-diagnostics.d.ts.map +1 -0
- package/dist/presentation-component-system-diagnostics.js +399 -0
- package/dist/presentation-component-system-diagnostics.js.map +1 -0
- package/dist/presentation-component-system.d.ts +31 -0
- package/dist/presentation-component-system.d.ts.map +1 -0
- package/dist/presentation-component-system.js +61 -0
- package/dist/presentation-component-system.js.map +1 -0
- package/dist/presentation-icon-diagnostics.d.ts +12 -0
- package/dist/presentation-icon-diagnostics.d.ts.map +1 -0
- package/dist/presentation-icon-diagnostics.js +17 -0
- package/dist/presentation-icon-diagnostics.js.map +1 -0
- package/dist/presentation-icon-registry.d.ts +28 -0
- package/dist/presentation-icon-registry.d.ts.map +1 -0
- package/dist/presentation-icon-registry.js +80 -0
- package/dist/presentation-icon-registry.js.map +1 -0
- package/dist/presentation-projection-trace-panel.d.ts +10 -0
- package/dist/presentation-projection-trace-panel.d.ts.map +1 -0
- package/dist/presentation-projection-trace-panel.js +48 -0
- package/dist/presentation-projection-trace-panel.js.map +1 -0
- package/dist/presentation-routed-surface-host.d.ts +19 -0
- package/dist/presentation-routed-surface-host.d.ts.map +1 -0
- package/dist/presentation-routed-surface-host.js +12 -0
- package/dist/presentation-routed-surface-host.js.map +1 -0
- package/dist/presentation-shadcn-component-system.d.ts +22 -0
- package/dist/presentation-shadcn-component-system.d.ts.map +1 -0
- package/dist/presentation-shadcn-component-system.js +2 -0
- package/dist/presentation-shadcn-component-system.js.map +1 -0
- package/dist/presentation-standard-renderers.d.ts +168 -0
- package/dist/presentation-standard-renderers.d.ts.map +1 -0
- package/dist/presentation-standard-renderers.js +440 -0
- package/dist/presentation-standard-renderers.js.map +1 -0
- package/dist/presentation-surface-renderer.d.ts +23 -0
- package/dist/presentation-surface-renderer.d.ts.map +1 -0
- package/dist/presentation-surface-renderer.js +119 -0
- package/dist/presentation-surface-renderer.js.map +1 -0
- package/dist/presentation-value-renderers.d.ts +10 -0
- package/dist/presentation-value-renderers.d.ts.map +1 -0
- package/dist/presentation-value-renderers.js +14 -0
- package/dist/presentation-value-renderers.js.map +1 -0
- package/dist/process-task-icons.d.ts +49 -0
- package/dist/process-task-icons.d.ts.map +1 -0
- package/dist/process-task-icons.js +154 -0
- package/dist/process-task-icons.js.map +1 -0
- package/dist/projected-activity-state.d.ts +17 -0
- package/dist/projected-activity-state.d.ts.map +1 -0
- package/dist/projected-activity-state.js +22 -0
- package/dist/projected-activity-state.js.map +1 -0
- package/dist/projected-collection-action-runtime-diagnostics.d.ts +4 -0
- package/dist/projected-collection-action-runtime-diagnostics.d.ts.map +1 -0
- package/dist/projected-collection-action-runtime-diagnostics.js +9 -0
- package/dist/projected-collection-action-runtime-diagnostics.js.map +1 -0
- package/dist/projected-collection-view.d.ts +90 -0
- package/dist/projected-collection-view.d.ts.map +1 -0
- package/dist/projected-collection-view.js +532 -0
- package/dist/projected-collection-view.js.map +1 -0
- package/dist/projected-document-action-status-notices.d.ts +15 -0
- package/dist/projected-document-action-status-notices.d.ts.map +1 -0
- package/dist/projected-document-action-status-notices.js +33 -0
- package/dist/projected-document-action-status-notices.js.map +1 -0
- package/dist/projected-document-badges.d.ts +24 -0
- package/dist/projected-document-badges.d.ts.map +1 -0
- package/dist/projected-document-badges.js +53 -0
- package/dist/projected-document-badges.js.map +1 -0
- package/dist/projected-document-editor-surface.d.ts +46 -0
- package/dist/projected-document-editor-surface.d.ts.map +1 -0
- package/dist/projected-document-editor-surface.js +399 -0
- package/dist/projected-document-editor-surface.js.map +1 -0
- package/dist/projected-document-workspace-notices.d.ts +24 -0
- package/dist/projected-document-workspace-notices.d.ts.map +1 -0
- package/dist/projected-document-workspace-notices.js +14 -0
- package/dist/projected-document-workspace-notices.js.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.d.ts +25 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.d.ts.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.js +41 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.js.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.d.ts +32 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.d.ts.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.js +77 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.js.map +1 -0
- package/dist/projected-document-workspace-shell.d.ts +100 -0
- package/dist/projected-document-workspace-shell.d.ts.map +1 -0
- package/dist/projected-document-workspace-shell.js +153 -0
- package/dist/projected-document-workspace-shell.js.map +1 -0
- package/dist/projected-document-workspace.d.ts +39 -0
- package/dist/projected-document-workspace.d.ts.map +1 -0
- package/dist/projected-document-workspace.js +63 -0
- package/dist/projected-document-workspace.js.map +1 -0
- package/dist/projected-field-value-rendering.d.ts +94 -0
- package/dist/projected-field-value-rendering.d.ts.map +1 -0
- package/dist/projected-field-value-rendering.js +377 -0
- package/dist/projected-field-value-rendering.js.map +1 -0
- package/dist/projected-inline-list.d.ts +20 -0
- package/dist/projected-inline-list.d.ts.map +1 -0
- package/dist/projected-inline-list.js +149 -0
- package/dist/projected-inline-list.js.map +1 -0
- package/dist/projected-input-form.d.ts +143 -0
- package/dist/projected-input-form.d.ts.map +1 -0
- package/dist/projected-input-form.js +612 -0
- package/dist/projected-input-form.js.map +1 -0
- package/dist/projected-metric-dashboard.d.ts +26 -0
- package/dist/projected-metric-dashboard.d.ts.map +1 -0
- package/dist/projected-metric-dashboard.js +20 -0
- package/dist/projected-metric-dashboard.js.map +1 -0
- package/dist/projected-metric-strip.d.ts +20 -0
- package/dist/projected-metric-strip.d.ts.map +1 -0
- package/dist/projected-metric-strip.js +131 -0
- package/dist/projected-metric-strip.js.map +1 -0
- package/dist/projected-navigation-shell-view-host.d.ts +34 -0
- package/dist/projected-navigation-shell-view-host.d.ts.map +1 -0
- package/dist/projected-navigation-shell-view-host.js +75 -0
- package/dist/projected-navigation-shell-view-host.js.map +1 -0
- package/dist/projected-navigation-shell.d.ts +33 -0
- package/dist/projected-navigation-shell.d.ts.map +1 -0
- package/dist/projected-navigation-shell.js +112 -0
- package/dist/projected-navigation-shell.js.map +1 -0
- package/dist/projected-presentation-badges.d.ts +34 -0
- package/dist/projected-presentation-badges.d.ts.map +1 -0
- package/dist/projected-presentation-badges.js +22 -0
- package/dist/projected-presentation-badges.js.map +1 -0
- package/dist/projected-presentation-diagnostics.d.ts +10 -0
- package/dist/projected-presentation-diagnostics.d.ts.map +1 -0
- package/dist/projected-presentation-diagnostics.js +40 -0
- package/dist/projected-presentation-diagnostics.js.map +1 -0
- package/dist/projected-presentation-flow-layer.d.ts +33 -0
- package/dist/projected-presentation-flow-layer.d.ts.map +1 -0
- package/dist/projected-presentation-flow-layer.js +71 -0
- package/dist/projected-presentation-flow-layer.js.map +1 -0
- package/dist/projected-process-task-notices.d.ts +37 -0
- package/dist/projected-process-task-notices.d.ts.map +1 -0
- package/dist/projected-process-task-notices.js +225 -0
- package/dist/projected-process-task-notices.js.map +1 -0
- package/dist/projected-prompt-child-view-renderer.d.ts +101 -0
- package/dist/projected-prompt-child-view-renderer.d.ts.map +1 -0
- package/dist/projected-prompt-child-view-renderer.js +442 -0
- package/dist/projected-prompt-child-view-renderer.js.map +1 -0
- package/dist/projected-prompt-document-preview.d.ts +39 -0
- package/dist/projected-prompt-document-preview.d.ts.map +1 -0
- package/dist/projected-prompt-document-preview.js +50 -0
- package/dist/projected-prompt-document-preview.js.map +1 -0
- package/dist/projected-prompt-view.d.ts +35 -0
- package/dist/projected-prompt-view.d.ts.map +1 -0
- package/dist/projected-prompt-view.js +292 -0
- package/dist/projected-prompt-view.js.map +1 -0
- package/dist/projected-query-form.d.ts +56 -0
- package/dist/projected-query-form.d.ts.map +1 -0
- package/dist/projected-query-form.js +100 -0
- package/dist/projected-query-form.js.map +1 -0
- package/dist/projected-record-details.d.ts +20 -0
- package/dist/projected-record-details.d.ts.map +1 -0
- package/dist/projected-record-details.js +60 -0
- package/dist/projected-record-details.js.map +1 -0
- package/dist/projected-routed-surface-runtime.d.ts +86 -0
- package/dist/projected-routed-surface-runtime.d.ts.map +1 -0
- package/dist/projected-routed-surface-runtime.js +332 -0
- package/dist/projected-routed-surface-runtime.js.map +1 -0
- package/dist/projected-tabs-view.d.ts +21 -0
- package/dist/projected-tabs-view.d.ts.map +1 -0
- package/dist/projected-tabs-view.js +140 -0
- package/dist/projected-tabs-view.js.map +1 -0
- package/dist/projected-view-chrome.d.ts +15 -0
- package/dist/projected-view-chrome.d.ts.map +1 -0
- package/dist/projected-view-chrome.js +67 -0
- package/dist/projected-view-chrome.js.map +1 -0
- package/dist/projected-view-surface.d.ts +34 -0
- package/dist/projected-view-surface.d.ts.map +1 -0
- package/dist/projected-view-surface.js +40 -0
- package/dist/projected-view-surface.js.map +1 -0
- package/dist/standard-collection-chrome-slot-renderers.d.ts +26 -0
- package/dist/standard-collection-chrome-slot-renderers.d.ts.map +1 -0
- package/dist/standard-collection-chrome-slot-renderers.js +250 -0
- package/dist/standard-collection-chrome-slot-renderers.js.map +1 -0
- package/dist/standard-view-chrome-slot-renderers.d.ts +57 -0
- package/dist/standard-view-chrome-slot-renderers.d.ts.map +1 -0
- package/dist/standard-view-chrome-slot-renderers.js +614 -0
- package/dist/standard-view-chrome-slot-renderers.js.map +1 -0
- package/package.json +68 -0
- package/src/document-workspace-surface-slot-renderers.tsx +395 -0
- package/src/index.ts +53 -0
- package/src/navigation-shell-frame-renderer-registry.ts +29 -0
- package/src/navigation-shell-slot-renderer-registry.ts +46 -0
- package/src/page-host-unavailable-renderer.tsx +79 -0
- package/src/presentation-action-group.tsx +475 -0
- package/src/presentation-badge-target-interpreter.ts +54 -0
- package/src/presentation-component-groups.ts +2505 -0
- package/src/presentation-component-system-diagnostics.ts +848 -0
- package/src/presentation-component-system.ts +365 -0
- package/src/presentation-icon-diagnostics.ts +53 -0
- package/src/presentation-icon-registry.tsx +181 -0
- package/src/presentation-projection-trace-panel.tsx +140 -0
- package/src/presentation-routed-surface-host.tsx +48 -0
- package/src/presentation-shadcn-component-system.ts +102 -0
- package/src/presentation-standard-renderers.tsx +1290 -0
- package/src/presentation-surface-renderer.tsx +263 -0
- package/src/presentation-value-renderers.tsx +40 -0
- package/src/process-task-icons.tsx +258 -0
- package/src/projected-activity-state.tsx +63 -0
- package/src/projected-collection-action-runtime-diagnostics.ts +22 -0
- package/src/projected-collection-view.tsx +1273 -0
- package/src/projected-document-action-status-notices.tsx +66 -0
- package/src/projected-document-badges.tsx +134 -0
- package/src/projected-document-editor-surface.tsx +808 -0
- package/src/projected-document-workspace-notices.tsx +77 -0
- package/src/projected-document-workspace-prompt-child-view-registry.ts +99 -0
- package/src/projected-document-workspace-prompt-child-view-renderers.tsx +205 -0
- package/src/projected-document-workspace-shell.tsx +427 -0
- package/src/projected-document-workspace.tsx +216 -0
- package/src/projected-field-value-rendering.tsx +704 -0
- package/src/projected-inline-list.tsx +434 -0
- package/src/projected-input-form.tsx +1218 -0
- package/src/projected-metric-dashboard.tsx +106 -0
- package/src/projected-metric-strip.tsx +244 -0
- package/src/projected-navigation-shell-view-host.tsx +177 -0
- package/src/projected-navigation-shell.tsx +219 -0
- package/src/projected-presentation-badges.tsx +95 -0
- package/src/projected-presentation-diagnostics.tsx +120 -0
- package/src/projected-presentation-flow-layer.tsx +186 -0
- package/src/projected-process-task-notices.tsx +501 -0
- package/src/projected-prompt-child-view-renderer.tsx +698 -0
- package/src/projected-prompt-document-preview.tsx +197 -0
- package/src/projected-prompt-view.tsx +592 -0
- package/src/projected-query-form.tsx +286 -0
- package/src/projected-record-details.tsx +133 -0
- package/src/projected-routed-surface-runtime.tsx +713 -0
- package/src/projected-tabs-view.tsx +308 -0
- package/src/projected-view-chrome.tsx +148 -0
- package/src/projected-view-surface.tsx +131 -0
- package/src/standard-collection-chrome-slot-renderers.tsx +391 -0
- package/src/standard-view-chrome-slot-renderers.tsx +1064 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createPresentationEnumDiscriminator, createPresentationProjectionDiagnostic, defaultPresentationComponentSet, findPresentationView, getPresentationViewSemanticRole, resolvePresentationComponentBinding, } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import { ProjectedStatusBlock } from './projected-activity-state.js';
|
|
4
|
+
import { presentationBindingKinds, presentationTargetKinds, viewKindLabels, } from '@cohesivesystems/presentation-contracts';
|
|
5
|
+
/**
|
|
6
|
+
* Semantic roles that prompt child views can expose through view contracts.
|
|
7
|
+
* These roles are target-independent; frontend registries attach local React
|
|
8
|
+
* interpretations to them.
|
|
9
|
+
*/
|
|
10
|
+
export const promptChildViewSemanticRoles = {
|
|
11
|
+
jsonDocumentDiff: 'json-document-diff',
|
|
12
|
+
promptDocumentPreview: 'prompt-document-preview',
|
|
13
|
+
};
|
|
14
|
+
export function createProjectedPromptChildViewRenderer({ componentSet = defaultPresentationComponentSet, componentSystem, context, dataSourceResolver, designSystem, module, promptView, registry, renderUnknownView = renderDefaultUnknownPromptChildView, }) {
|
|
15
|
+
const renderView = (viewId) => {
|
|
16
|
+
const view = findPresentationView(module, viewId);
|
|
17
|
+
if (!view) {
|
|
18
|
+
return renderUnknownView({
|
|
19
|
+
componentKey: null,
|
|
20
|
+
componentRole: null,
|
|
21
|
+
context,
|
|
22
|
+
dataSourceResolver,
|
|
23
|
+
module,
|
|
24
|
+
promptView,
|
|
25
|
+
reason: 'missing-view',
|
|
26
|
+
resolutionSource: null,
|
|
27
|
+
semanticRole: null,
|
|
28
|
+
view: null,
|
|
29
|
+
viewId,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const { componentKey, componentRole, renderer, resolutionSource, semanticRole } = resolvePromptChildViewRenderer({
|
|
33
|
+
componentSet,
|
|
34
|
+
module,
|
|
35
|
+
registry,
|
|
36
|
+
view,
|
|
37
|
+
});
|
|
38
|
+
if (!renderer) {
|
|
39
|
+
return renderUnknownView({
|
|
40
|
+
componentKey,
|
|
41
|
+
componentRole,
|
|
42
|
+
context,
|
|
43
|
+
dataSourceResolver,
|
|
44
|
+
module,
|
|
45
|
+
promptView,
|
|
46
|
+
reason: 'missing-renderer',
|
|
47
|
+
resolutionSource,
|
|
48
|
+
semanticRole,
|
|
49
|
+
view,
|
|
50
|
+
viewId,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return renderer({
|
|
54
|
+
componentKey,
|
|
55
|
+
componentRole,
|
|
56
|
+
componentSystem,
|
|
57
|
+
context,
|
|
58
|
+
dataSourceResolver,
|
|
59
|
+
designSystem,
|
|
60
|
+
module,
|
|
61
|
+
promptView,
|
|
62
|
+
renderView,
|
|
63
|
+
resolutionSource,
|
|
64
|
+
view,
|
|
65
|
+
viewId,
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return renderView;
|
|
69
|
+
}
|
|
70
|
+
export function mergeProjectedPromptChildViewRendererRegistries(...registries) {
|
|
71
|
+
return {
|
|
72
|
+
byComponentRole: mergeRendererMaps(registries.map((registry) => registry.byComponentRole)),
|
|
73
|
+
byComponentKey: mergeRendererMaps(registries.map((registry) => registry.byComponentKey)),
|
|
74
|
+
bySemanticRole: mergeRendererMaps(registries.map((registry) => registry.bySemanticRole)),
|
|
75
|
+
byViewId: mergeRendererMaps(registries.map((registry) => registry.byViewId)),
|
|
76
|
+
byViewKind: mergeRendererMaps(registries.map((registry) => registry.byViewKind)),
|
|
77
|
+
fallback: [...registries].reverse().find((registry) => registry.fallback)?.fallback,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function mergeRendererMaps(maps) {
|
|
81
|
+
const merged = {};
|
|
82
|
+
for (const map of maps) {
|
|
83
|
+
if (map) {
|
|
84
|
+
Object.assign(merged, map);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
88
|
+
}
|
|
89
|
+
export function resolvePromptChildViewRenderer({ componentSet, module, registry, view, }) {
|
|
90
|
+
const componentBinding = resolvePromptChildViewComponentBinding({
|
|
91
|
+
componentSet,
|
|
92
|
+
module,
|
|
93
|
+
view,
|
|
94
|
+
});
|
|
95
|
+
const componentKey = componentBinding.componentKey;
|
|
96
|
+
const componentRole = componentBinding.componentRole;
|
|
97
|
+
const semanticRole = getPromptChildViewSemanticRole(view);
|
|
98
|
+
const semanticRoleRenderer = registry.bySemanticRole?.[semanticRole];
|
|
99
|
+
if (semanticRoleRenderer) {
|
|
100
|
+
return {
|
|
101
|
+
componentKey,
|
|
102
|
+
componentRole,
|
|
103
|
+
renderer: semanticRoleRenderer,
|
|
104
|
+
resolutionSource: 'semantic-role',
|
|
105
|
+
semanticRole,
|
|
106
|
+
targetBinding: componentBinding.binding,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const viewKindRenderer = findViewKindRenderer(registry, view);
|
|
110
|
+
if (viewKindRenderer) {
|
|
111
|
+
return {
|
|
112
|
+
componentKey,
|
|
113
|
+
componentRole,
|
|
114
|
+
renderer: viewKindRenderer,
|
|
115
|
+
resolutionSource: 'view-kind',
|
|
116
|
+
semanticRole,
|
|
117
|
+
targetBinding: componentBinding.binding,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const componentRoleRenderer = componentRole
|
|
121
|
+
? registry.byComponentRole?.[componentRole]
|
|
122
|
+
: undefined;
|
|
123
|
+
if (componentRoleRenderer) {
|
|
124
|
+
return {
|
|
125
|
+
componentKey,
|
|
126
|
+
componentRole,
|
|
127
|
+
renderer: componentRoleRenderer,
|
|
128
|
+
resolutionSource: 'component-role',
|
|
129
|
+
semanticRole,
|
|
130
|
+
targetBinding: componentBinding.binding,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const componentRenderer = componentKey
|
|
134
|
+
? registry.byComponentKey?.[componentKey]
|
|
135
|
+
: undefined;
|
|
136
|
+
if (componentRenderer) {
|
|
137
|
+
return {
|
|
138
|
+
componentKey,
|
|
139
|
+
componentRole,
|
|
140
|
+
renderer: componentRenderer,
|
|
141
|
+
resolutionSource: 'component-key',
|
|
142
|
+
semanticRole,
|
|
143
|
+
targetBinding: componentBinding.binding,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const viewIdRenderer = registry.byViewId?.[view.Id];
|
|
147
|
+
if (viewIdRenderer) {
|
|
148
|
+
return {
|
|
149
|
+
componentKey,
|
|
150
|
+
componentRole,
|
|
151
|
+
renderer: viewIdRenderer,
|
|
152
|
+
resolutionSource: 'view-id',
|
|
153
|
+
semanticRole,
|
|
154
|
+
targetBinding: componentBinding.binding,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (registry.fallback) {
|
|
158
|
+
return {
|
|
159
|
+
componentKey,
|
|
160
|
+
componentRole,
|
|
161
|
+
renderer: registry.fallback,
|
|
162
|
+
resolutionSource: 'fallback',
|
|
163
|
+
semanticRole,
|
|
164
|
+
targetBinding: componentBinding.binding,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
componentKey,
|
|
169
|
+
componentRole,
|
|
170
|
+
renderer: null,
|
|
171
|
+
resolutionSource: null,
|
|
172
|
+
semanticRole,
|
|
173
|
+
targetBinding: componentBinding.binding,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function resolvePromptChildViewComponentBinding({ componentSet, module, view, }) {
|
|
177
|
+
return resolvePresentationComponentBinding(module, {
|
|
178
|
+
bindingKind: createPresentationEnumDiscriminator(presentationBindingKinds, 'viewComponent', 'ViewComponent'),
|
|
179
|
+
componentSet,
|
|
180
|
+
id: view.Id,
|
|
181
|
+
targetKind: createPresentationEnumDiscriminator(presentationTargetKinds, 'react', 'React'),
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
export function projectPromptChildViewRendererDiagnostics({ componentSet = defaultPresentationComponentSet, module, promptView, registry, sourceId = `prompt-child-view-renderers.${promptView.Id}`, }) {
|
|
185
|
+
return promptView.Regions.flatMap((region) => region.ViewIds.flatMap((viewId) => {
|
|
186
|
+
const view = findPresentationView(module, viewId);
|
|
187
|
+
if (!view) {
|
|
188
|
+
return [
|
|
189
|
+
createPresentationProjectionDiagnostic({
|
|
190
|
+
category: 'missing-definition',
|
|
191
|
+
details: {
|
|
192
|
+
promptViewId: promptView.Id,
|
|
193
|
+
regionId: region.Id,
|
|
194
|
+
viewId,
|
|
195
|
+
},
|
|
196
|
+
id: `prompt-child-view.${promptView.Id}.${viewId}.missing-view`,
|
|
197
|
+
interpretation: {
|
|
198
|
+
status: 'unbound',
|
|
199
|
+
target: 'prompt-child-view-renderer',
|
|
200
|
+
},
|
|
201
|
+
message: `Prompt '${promptView.Name}' references child view '${viewId}', ` +
|
|
202
|
+
'but that view is not present in the presentation module.',
|
|
203
|
+
severity: 'warning',
|
|
204
|
+
source: sourceId,
|
|
205
|
+
subject: {
|
|
206
|
+
id: viewId,
|
|
207
|
+
kind: 'prompt-child-view',
|
|
208
|
+
},
|
|
209
|
+
}),
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
const resolution = resolvePromptChildViewRenderer({
|
|
213
|
+
componentSet,
|
|
214
|
+
module,
|
|
215
|
+
registry,
|
|
216
|
+
view,
|
|
217
|
+
});
|
|
218
|
+
const diagnostics = [];
|
|
219
|
+
const componentRoleBound = resolution.componentRole
|
|
220
|
+
? Boolean(registry.byComponentRole?.[resolution.componentRole])
|
|
221
|
+
: false;
|
|
222
|
+
if (!resolution.targetBinding) {
|
|
223
|
+
diagnostics.push(createPresentationProjectionDiagnostic({
|
|
224
|
+
category: 'missing-binding',
|
|
225
|
+
details: {
|
|
226
|
+
promptViewId: promptView.Id,
|
|
227
|
+
regionId: region.Id,
|
|
228
|
+
semanticRole: resolution.semanticRole,
|
|
229
|
+
viewId,
|
|
230
|
+
viewKind: view.Kind,
|
|
231
|
+
},
|
|
232
|
+
id: `prompt-child-view.${promptView.Id}.${viewId}.missing-target-binding`,
|
|
233
|
+
interpretation: {
|
|
234
|
+
status: 'unbound',
|
|
235
|
+
target: 'prompt-child-view-component-role',
|
|
236
|
+
},
|
|
237
|
+
message: `Prompt child view '${view.Name}' has no ViewComponent target ` +
|
|
238
|
+
'binding for the active frontend target.',
|
|
239
|
+
severity: 'warning',
|
|
240
|
+
source: sourceId,
|
|
241
|
+
subject: {
|
|
242
|
+
id: view.Id,
|
|
243
|
+
kind: 'prompt-child-view',
|
|
244
|
+
name: view.Name,
|
|
245
|
+
},
|
|
246
|
+
suggestedNextStep: 'Declare a ViewComponent target binding with ComponentRole for this prompt child view.',
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
if (resolution.componentKey) {
|
|
250
|
+
diagnostics.push(createPresentationProjectionDiagnostic({
|
|
251
|
+
category: 'escape-hatch',
|
|
252
|
+
details: createPromptChildViewDiagnosticDetails({
|
|
253
|
+
promptViewId: promptView.Id,
|
|
254
|
+
regionId: region.Id,
|
|
255
|
+
resolution,
|
|
256
|
+
view,
|
|
257
|
+
viewId,
|
|
258
|
+
}),
|
|
259
|
+
id: `prompt-child-view.${promptView.Id}.${viewId}.component-key-escape-hatch`,
|
|
260
|
+
interpretation: {
|
|
261
|
+
status: 'escape-hatch',
|
|
262
|
+
target: 'prompt-child-view-component-key',
|
|
263
|
+
},
|
|
264
|
+
message: `Prompt child view '${view.Name}' declares concrete component ` +
|
|
265
|
+
`key '${resolution.componentKey}'.`,
|
|
266
|
+
severity: 'warning',
|
|
267
|
+
source: sourceId,
|
|
268
|
+
subject: {
|
|
269
|
+
id: view.Id,
|
|
270
|
+
kind: 'prompt-child-view',
|
|
271
|
+
name: view.Name,
|
|
272
|
+
},
|
|
273
|
+
suggestedNextStep: 'Prefer ViewComponent ComponentRole for prompt child views and reserve ComponentKey for adapter-specific overrides.',
|
|
274
|
+
}));
|
|
275
|
+
}
|
|
276
|
+
if (resolution.targetBinding && !resolution.componentRole) {
|
|
277
|
+
diagnostics.push(createPresentationProjectionDiagnostic({
|
|
278
|
+
category: 'missing-binding',
|
|
279
|
+
details: createPromptChildViewDiagnosticDetails({
|
|
280
|
+
promptViewId: promptView.Id,
|
|
281
|
+
regionId: region.Id,
|
|
282
|
+
resolution,
|
|
283
|
+
view,
|
|
284
|
+
viewId,
|
|
285
|
+
}),
|
|
286
|
+
id: `prompt-child-view.${promptView.Id}.${viewId}.missing-component-role`,
|
|
287
|
+
interpretation: {
|
|
288
|
+
status: 'unbound',
|
|
289
|
+
target: 'prompt-child-view-component-role',
|
|
290
|
+
},
|
|
291
|
+
message: `Prompt child view '${view.Name}' ViewComponent target binding ` +
|
|
292
|
+
'does not declare a component role.',
|
|
293
|
+
severity: 'warning',
|
|
294
|
+
source: sourceId,
|
|
295
|
+
subject: {
|
|
296
|
+
id: view.Id,
|
|
297
|
+
kind: 'prompt-child-view',
|
|
298
|
+
name: view.Name,
|
|
299
|
+
},
|
|
300
|
+
suggestedNextStep: 'Set ComponentRole on the prompt child ViewComponent target binding.',
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
if (resolution.componentRole) {
|
|
304
|
+
diagnostics.push(createPresentationProjectionDiagnostic({
|
|
305
|
+
category: componentRoleBound ? 'local-interpretation' : 'missing-binding',
|
|
306
|
+
details: {
|
|
307
|
+
...createPromptChildViewDiagnosticDetails({
|
|
308
|
+
promptViewId: promptView.Id,
|
|
309
|
+
regionId: region.Id,
|
|
310
|
+
resolution,
|
|
311
|
+
view,
|
|
312
|
+
viewId,
|
|
313
|
+
}),
|
|
314
|
+
componentRoleBound,
|
|
315
|
+
},
|
|
316
|
+
id: `prompt-child-view.${promptView.Id}.${viewId}.component-role-coverage`,
|
|
317
|
+
interpretation: {
|
|
318
|
+
status: componentRoleBound ? 'locally-interpreted' : 'unbound',
|
|
319
|
+
target: 'prompt-child-view-component-role',
|
|
320
|
+
},
|
|
321
|
+
message: componentRoleBound
|
|
322
|
+
? `Prompt child view '${view.Name}' component role ` +
|
|
323
|
+
`'${resolution.componentRole}' is interpreted by the local prompt child renderer registry.`
|
|
324
|
+
: `Prompt child view '${view.Name}' component role ` +
|
|
325
|
+
`'${resolution.componentRole}' is not interpreted by the local prompt child renderer registry.`,
|
|
326
|
+
severity: componentRoleBound ? 'info' : 'warning',
|
|
327
|
+
source: sourceId,
|
|
328
|
+
subject: {
|
|
329
|
+
id: view.Id,
|
|
330
|
+
kind: 'prompt-child-view',
|
|
331
|
+
name: view.Name,
|
|
332
|
+
},
|
|
333
|
+
suggestedNextStep: componentRoleBound
|
|
334
|
+
? undefined
|
|
335
|
+
: `Bind prompt child component role '${resolution.componentRole}' in the frontend registry.`,
|
|
336
|
+
}));
|
|
337
|
+
}
|
|
338
|
+
if (!resolution.renderer) {
|
|
339
|
+
diagnostics.push(createPresentationProjectionDiagnostic({
|
|
340
|
+
category: 'missing-binding',
|
|
341
|
+
details: createPromptChildViewDiagnosticDetails({
|
|
342
|
+
promptViewId: promptView.Id,
|
|
343
|
+
regionId: region.Id,
|
|
344
|
+
resolution,
|
|
345
|
+
view,
|
|
346
|
+
viewId,
|
|
347
|
+
}),
|
|
348
|
+
id: `prompt-child-view.${promptView.Id}.${viewId}.missing-renderer`,
|
|
349
|
+
interpretation: {
|
|
350
|
+
status: 'unbound',
|
|
351
|
+
target: 'prompt-child-view-renderer',
|
|
352
|
+
},
|
|
353
|
+
message: `Prompt child view '${view.Name}' has no frontend renderer binding.`,
|
|
354
|
+
severity: 'warning',
|
|
355
|
+
source: sourceId,
|
|
356
|
+
subject: {
|
|
357
|
+
id: view.Id,
|
|
358
|
+
kind: 'prompt-child-view',
|
|
359
|
+
name: view.Name,
|
|
360
|
+
},
|
|
361
|
+
suggestedNextStep: 'Declare a semantic prompt child-view role or bind a standard view-kind renderer.',
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
if (resolution.renderer &&
|
|
365
|
+
resolution.resolutionSource === 'view-id') {
|
|
366
|
+
diagnostics.push(createPresentationProjectionDiagnostic({
|
|
367
|
+
category: 'escape-hatch',
|
|
368
|
+
details: createPromptChildViewDiagnosticDetails({
|
|
369
|
+
promptViewId: promptView.Id,
|
|
370
|
+
regionId: region.Id,
|
|
371
|
+
resolution,
|
|
372
|
+
view,
|
|
373
|
+
viewId,
|
|
374
|
+
}),
|
|
375
|
+
id: `prompt-child-view.${promptView.Id}.${viewId}.view-id-escape-hatch`,
|
|
376
|
+
interpretation: {
|
|
377
|
+
status: 'escape-hatch',
|
|
378
|
+
target: 'prompt-child-view-renderer',
|
|
379
|
+
},
|
|
380
|
+
message: `Prompt child view '${view.Name}' rendered through ` +
|
|
381
|
+
'view-id as an escape hatch.',
|
|
382
|
+
severity: 'warning',
|
|
383
|
+
source: sourceId,
|
|
384
|
+
subject: {
|
|
385
|
+
id: view.Id,
|
|
386
|
+
kind: 'prompt-child-view',
|
|
387
|
+
name: view.Name,
|
|
388
|
+
},
|
|
389
|
+
suggestedNextStep: 'Move this prompt child view onto semantic-role, component-role, or view-kind renderer resolution.',
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
return diagnostics;
|
|
393
|
+
}));
|
|
394
|
+
}
|
|
395
|
+
function createPromptChildViewDiagnosticDetails({ promptViewId, regionId, resolution, view, viewId, }) {
|
|
396
|
+
return {
|
|
397
|
+
componentKey: resolution.componentKey,
|
|
398
|
+
componentRole: resolution.componentRole,
|
|
399
|
+
hasTargetBinding: Boolean(resolution.targetBinding),
|
|
400
|
+
promptViewId,
|
|
401
|
+
regionId,
|
|
402
|
+
resolutionSource: resolution.resolutionSource,
|
|
403
|
+
semanticRole: resolution.semanticRole,
|
|
404
|
+
viewId,
|
|
405
|
+
viewKind: view.Kind,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
export function getPromptChildViewSemanticRole(view) {
|
|
409
|
+
if (view.PromptDocumentPreview) {
|
|
410
|
+
return promptChildViewSemanticRoles.promptDocumentPreview;
|
|
411
|
+
}
|
|
412
|
+
const designRole = view.Design?.Role;
|
|
413
|
+
if (designRole === 'diff' && view.Design?.Variant === 'json-document') {
|
|
414
|
+
return promptChildViewSemanticRoles.jsonDocumentDiff;
|
|
415
|
+
}
|
|
416
|
+
return designRole ?? getPresentationViewSemanticRole(view);
|
|
417
|
+
}
|
|
418
|
+
function findViewKindRenderer(registry, view) {
|
|
419
|
+
for (const key of getViewKindKeys(view.Kind)) {
|
|
420
|
+
const renderer = registry.byViewKind?.[key];
|
|
421
|
+
if (renderer) {
|
|
422
|
+
return renderer;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return undefined;
|
|
426
|
+
}
|
|
427
|
+
function getViewKindKeys(kind) {
|
|
428
|
+
const keys = [String(kind)];
|
|
429
|
+
const label = viewKindLabels[kind];
|
|
430
|
+
if (label) {
|
|
431
|
+
keys.push(label);
|
|
432
|
+
keys.push(label.charAt(0).toLowerCase() + label.slice(1));
|
|
433
|
+
}
|
|
434
|
+
return keys;
|
|
435
|
+
}
|
|
436
|
+
function renderDefaultUnknownPromptChildView({ componentKey, componentRole, reason, resolutionSource, semanticRole, view, viewId, }) {
|
|
437
|
+
if (reason === 'missing-view') {
|
|
438
|
+
return _jsx(ProjectedStatusBlock, { label: `Prompt child view '${viewId}' is not available.` });
|
|
439
|
+
}
|
|
440
|
+
return (_jsx(ProjectedStatusBlock, { label: `Prompt child view '${view?.Name ?? viewId}' has no renderer for component role '${componentRole ?? 'none'}', component key '${componentKey ?? 'none'}', role '${semanticRole ?? 'unknown'}', and source '${resolutionSource ?? 'none'}'.` }));
|
|
441
|
+
}
|
|
442
|
+
//# sourceMappingURL=projected-prompt-child-view-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-prompt-child-view-renderer.js","sourceRoot":"","sources":["../src/projected-prompt-child-view-renderer.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,mCAAmC,EACnC,sCAAsC,EACtC,+BAA+B,EAC/B,oBAAoB,EACpB,+BAA+B,EAC/B,mCAAmC,GAMpC,MAAM,oCAAoC,CAAA;AAO3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EAEvB,cAAc,GACf,MAAM,yCAAyC,CAAA;AAyBhD;;;;GAIG;AACH,MAAM,CAAC,MAA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QAAQ,CAAA;QACjB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,IAA4B;IACnD,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3B,MAAM,KAAK,GAAG,cAAc,CAAC,IAAgB,CAAC,CAAA;IAC9C,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAS,mCAAmC,CAAW,EACrD,YAAY,EACZ,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,MAAM,GACiD;IACvD,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;QAC9B,OAAO,KAAC,oBAAoB,IAAC,KAAK,EAAE,sBAAsB,MAAM,qBAAqB,GAAI,CAAA;IAC3F,CAAC;IAED,OAAO,CACL,KAAC,oBAAoB,IACnB,KAAK,EAAE,sBAAsB,IAAI,EAAE,IAAI,IAAI,MAAM,yCAAyC,aAAa,IAAI,MAAM,qBAAqB,YAAY,IAAI,MAAM,YAAY,YAAY,IAAI,SAAS,kBAAkB,gBAAgB,IAAI,MAAM,IAAI,GACjP,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type DocumentWorkspaceProjectionRendererRegistry } from '@cohesivesystems/presentation-react';
|
|
3
|
+
import type { PresentationShadcnComponentSystem as PresentationComponentSystem } from './presentation-shadcn-component-system.js';
|
|
4
|
+
import type { PresentationDesignSystem } from '@cohesivesystems/presentation-tailwind';
|
|
5
|
+
import { type PromptDocumentPreviewDefinition } from '@cohesivesystems/presentation-core';
|
|
6
|
+
export interface ProjectedPromptDocumentPreviewBadge {
|
|
7
|
+
readonly className?: string;
|
|
8
|
+
readonly id?: string;
|
|
9
|
+
readonly label: ReactNode;
|
|
10
|
+
readonly tone?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface ProjectedPromptDocumentPreviewProps<TProjectionContext> {
|
|
13
|
+
readonly badges?: readonly ProjectedPromptDocumentPreviewBadge[];
|
|
14
|
+
readonly className?: string;
|
|
15
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
16
|
+
readonly definition?: PromptDocumentPreviewDefinition | null;
|
|
17
|
+
readonly designSystem: PresentationDesignSystem;
|
|
18
|
+
readonly documentInstanceId?: string | null;
|
|
19
|
+
readonly error?: string | null;
|
|
20
|
+
readonly fallback?: ReactNode;
|
|
21
|
+
readonly path?: ReactNode;
|
|
22
|
+
readonly previewData?: unknown;
|
|
23
|
+
readonly previewViewId?: string | null;
|
|
24
|
+
readonly projectionRenderContext: TProjectionContext;
|
|
25
|
+
readonly projectionRenderers: DocumentWorkspaceProjectionRendererRegistry<TProjectionContext, PresentationComponentSystem, PresentationDesignSystem>;
|
|
26
|
+
readonly renderUnavailableProjection?: (viewId: string) => ReactNode;
|
|
27
|
+
readonly statusClassName?: string;
|
|
28
|
+
readonly statusLabel?: ReactNode;
|
|
29
|
+
readonly title?: ReactNode;
|
|
30
|
+
readonly viewId: string;
|
|
31
|
+
readonly workspacePageViewId?: string | null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Projects a transient document preview inside a prompt. The caller supplies
|
|
35
|
+
* the document render context while this component owns workspace resolution,
|
|
36
|
+
* child projection rendering, tab chrome, and unavailable-view fallback.
|
|
37
|
+
*/
|
|
38
|
+
export declare function ProjectedPromptDocumentPreview<TProjectionContext>({ badges, className, componentSystem, definition, designSystem, documentInstanceId, error, fallback, path, previewData, previewViewId, projectionRenderContext, projectionRenderers, renderUnavailableProjection, statusClassName, statusLabel, title, viewId, workspacePageViewId, }: ProjectedPromptDocumentPreviewProps<TProjectionContext>): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=projected-prompt-document-preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-prompt-document-preview.d.ts","sourceRoot":"","sources":["../src/projected-prompt-document-preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAGL,KAAK,2CAA2C,EAEjD,MAAM,qCAAqC,CAAA;AAC5C,OAAO,KAAK,EACV,iCAAiC,IAAI,2BAA2B,EACjE,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EACL,KAAK,+BAA+B,EAIrC,MAAM,oCAAoC,CAAA;AAS3C,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,mCAAmC,CAAC,kBAAkB;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,mCAAmC,EAAE,CAAA;IAChE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,eAAe,EAAE,2BAA2B,CAAA;IACrD,QAAQ,CAAC,UAAU,CAAC,EAAE,+BAA+B,GAAG,IAAI,CAAA;IAC5D,QAAQ,CAAC,YAAY,EAAE,wBAAwB,CAAA;IAC/C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,uBAAuB,EAAE,kBAAkB,CAAA;IACpD,QAAQ,CAAC,mBAAmB,EAAE,2CAA2C,CACvE,kBAAkB,EAClB,2BAA2B,EAC3B,wBAAwB,CACzB,CAAA;IACD,QAAQ,CAAC,2BAA2B,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,CAAA;IACpE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,kBAAkB,EAAE,EACjE,MAAW,EACX,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,KAAK,EACL,QAAwF,EACxF,IAAI,EACJ,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,2BAAgE,EAChE,eAAe,EACf,WAAW,EACX,KAAK,EACL,MAAM,EACN,mBAAmB,GACpB,EAAE,mCAAmC,CAAC,kBAAkB,CAAC,2CAsGzD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DocumentWorkspaceRuntime, renderDocumentWorkspaceProjection, usePresentationModule, } from '@cohesivesystems/presentation-react';
|
|
3
|
+
import { resolvePresentationTemplate, resolvePresentationBadges, resolvePromptDocumentPreviewTitle, } from '@cohesivesystems/presentation-core';
|
|
4
|
+
import { ProjectedPresentationBadge, ProjectedPresentationBadges, } from './projected-presentation-badges.js';
|
|
5
|
+
import { ProjectedStatusBlock } from './projected-activity-state.js';
|
|
6
|
+
import { ProjectedTabsView } from './projected-tabs-view.js';
|
|
7
|
+
/**
|
|
8
|
+
* Projects a transient document preview inside a prompt. The caller supplies
|
|
9
|
+
* the document render context while this component owns workspace resolution,
|
|
10
|
+
* child projection rendering, tab chrome, and unavailable-view fallback.
|
|
11
|
+
*/
|
|
12
|
+
export function ProjectedPromptDocumentPreview({ badges = [], className, componentSystem, definition, designSystem, documentInstanceId, error, fallback = _jsx(ProjectedStatusBlock, { label: "Document preview workspace is not available." }), path, previewData, previewViewId, projectionRenderContext, projectionRenderers, renderUnavailableProjection = renderDefaultUnavailableProjection, statusClassName, statusLabel, title, viewId, workspacePageViewId, }) {
|
|
13
|
+
const module = usePresentationModule();
|
|
14
|
+
const resolvedPreviewViewId = definition?.PreviewViewId ?? previewViewId;
|
|
15
|
+
const resolvedWorkspacePageViewId = definition?.WorkspacePageViewId ?? workspacePageViewId;
|
|
16
|
+
const resolvedDocumentInstanceId = documentInstanceId ??
|
|
17
|
+
resolvePresentationTemplate(definition?.DocumentInstanceIdTemplate, previewData) ??
|
|
18
|
+
definition?.DataSourceId ??
|
|
19
|
+
viewId;
|
|
20
|
+
const resolvedTitle = title ??
|
|
21
|
+
resolvePromptDocumentPreviewTitle(definition, previewData);
|
|
22
|
+
const resolvedPath = path ??
|
|
23
|
+
resolvePresentationTemplate(definition?.DocumentPathTemplate, previewData) ??
|
|
24
|
+
null;
|
|
25
|
+
const resolvedBadges = [
|
|
26
|
+
...resolvePresentationBadges(definition?.Badges, previewData, module),
|
|
27
|
+
...badges,
|
|
28
|
+
];
|
|
29
|
+
if (!resolvedPreviewViewId || !resolvedWorkspacePageViewId) {
|
|
30
|
+
return _jsx(_Fragment, { children: fallback });
|
|
31
|
+
}
|
|
32
|
+
return (_jsx(DocumentWorkspaceRuntime, { documentInstanceId: resolvedDocumentInstanceId, fallback: fallback, pageViewId: resolvedWorkspacePageViewId, children: (runtime) => {
|
|
33
|
+
const renderPreviewView = (childViewId) => renderDocumentWorkspaceProjection(runtime, projectionRenderers, projectionRenderContext, childViewId, { componentSystem, designSystem, module }) ?? renderUnavailableProjection(childViewId);
|
|
34
|
+
if (viewId !== resolvedPreviewViewId) {
|
|
35
|
+
return renderPreviewView(viewId);
|
|
36
|
+
}
|
|
37
|
+
return (_jsxs("section", { className: cn('flex min-h-0 flex-1 flex-col gap-3 overflow-hidden rounded-lg border border-slate-950/10 bg-slate-50/80 p-3', className), children: [_jsxs("header", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [_jsx("h3", { className: "text-sm font-semibold text-slate-950", children: resolvedTitle }), _jsx(ProjectedPresentationBadges, { badges: resolvedBadges, className: "contents", componentSystem: componentSystem, designSystem: designSystem, variant: "outline" })] }), resolvedPath ? (_jsx("p", { className: "mt-1 break-all text-xs text-slate-500", children: resolvedPath })) : null] }), statusLabel ? (_jsx(ProjectedPresentationBadge, { badge: {
|
|
38
|
+
className: statusClassName,
|
|
39
|
+
label: statusLabel,
|
|
40
|
+
tone: 'info',
|
|
41
|
+
}, componentSystem: componentSystem, designSystem: designSystem, variant: "outline" })) : null] }), error ? (_jsx(ProjectedStatusBlock, { label: error, tone: "error" })) : null, _jsx(ProjectedTabsView, { className: "min-h-0 flex-1 overflow-hidden", componentSystem: componentSystem, renderView: renderPreviewView, viewId: resolvedPreviewViewId })] }));
|
|
42
|
+
} }));
|
|
43
|
+
}
|
|
44
|
+
function renderDefaultUnavailableProjection(viewId) {
|
|
45
|
+
return _jsx(ProjectedStatusBlock, { label: `Document preview view '${viewId}' is not available.` });
|
|
46
|
+
}
|
|
47
|
+
function cn(...values) {
|
|
48
|
+
return values.filter(Boolean).join(' ');
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=projected-prompt-document-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-prompt-document-preview.js","sourceRoot":"","sources":["../src/projected-prompt-document-preview.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EAEjC,qBAAqB,GACtB,MAAM,qCAAqC,CAAA;AAO5C,OAAO,EAEL,2BAA2B,EAC3B,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAE5B,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAmCzD;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAqB,EACjE,MAAM,GAAG,EAAE,EACX,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,KAAK,EACL,QAAQ,GAAG,KAAC,oBAAoB,IAAC,KAAK,EAAC,8CAA8C,GAAG,EACxF,IAAI,EACJ,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,2BAA2B,GAAG,kCAAkC,EAChE,eAAe,EACf,WAAW,EACX,KAAK,EACL,MAAM,EACN,mBAAmB,GACqC;IACxD,MAAM,MAAM,GAAG,qBAAqB,EAAE,CAAA;IACtC,MAAM,qBAAqB,GAAG,UAAU,EAAE,aAAa,IAAI,aAAa,CAAA;IACxE,MAAM,2BAA2B,GAC/B,UAAU,EAAE,mBAAmB,IAAI,mBAAmB,CAAA;IACxD,MAAM,0BAA0B,GAC9B,kBAAkB;QAClB,2BAA2B,CAAC,UAAU,EAAE,0BAA0B,EAAE,WAAW,CAAC;QAChF,UAAU,EAAE,YAAY;QACxB,MAAM,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OAAO,EAAC,SAAS,GACjB,IACE,EACL,YAAY,CAAC,CAAC,CAAC,CACd,YAAG,SAAS,EAAC,uCAAuC,YACjD,YAAY,GACX,CACL,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,0BAA0B,IACzB,KAAK,EAAE;oCACL,SAAS,EAAE,eAAe;oCAC1B,KAAK,EAAE,WAAW;oCAClB,IAAI,EAAE,MAAM;iCACb,EACD,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAC,SAAS,GACjB,CACH,CAAC,CAAC,CAAC,IAAI,IACD,EAER,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAC,OAAO,GAAG,CACpD,CAAC,CAAC,CAAC,IAAI,EAER,KAAC,iBAAiB,IAChB,SAAS,EAAC,gCAAgC,EAC1C,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,iBAAiB,EAC7B,MAAM,EAAE,qBAAqB,GAC7B,IACM,CACX,CAAA;QACH,CAAC,GACwB,CAC5B,CAAA;AACH,CAAC;AAED,SAAS,kCAAkC,CAAC,MAAc;IACxD,OAAO,KAAC,oBAAoB,IAAC,KAAK,EAAE,0BAA0B,MAAM,qBAAqB,GAAI,CAAA;AAC/F,CAAC;AAED,SAAS,EAAE,CAAC,GAAG,MAAsD;IACnE,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type PresentationDataSourceResolver, type PresentationModuleDefinition, type ViewDefinition, type ViewRegionDefinition } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import { type PresentationActionGroupOptions } from './presentation-action-group.js';
|
|
4
|
+
import type { PresentationShadcnComponentSystem as PresentationComponentSystem } from './presentation-shadcn-component-system.js';
|
|
5
|
+
import type { PresentationDesignSystem } from '@cohesivesystems/presentation-tailwind';
|
|
6
|
+
import type { ProjectedViewSurfaceChromeSlotRenderer } from './projected-view-surface.js';
|
|
7
|
+
export interface ProjectedPromptViewProps<TContext> {
|
|
8
|
+
readonly actionGroupOptions?: PresentationActionGroupOptions<TContext>;
|
|
9
|
+
readonly actionRegionId?: string;
|
|
10
|
+
readonly className?: string;
|
|
11
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
12
|
+
readonly contentClassName?: string;
|
|
13
|
+
readonly context: TContext;
|
|
14
|
+
readonly dataSourceResolver: PresentationDataSourceResolver;
|
|
15
|
+
readonly designSystem: PresentationDesignSystem;
|
|
16
|
+
readonly description?: ReactNode;
|
|
17
|
+
readonly module: PresentationModuleDefinition;
|
|
18
|
+
readonly regionRenderers?: Readonly<Record<string, ProjectedPromptRegionRenderer<TContext>>>;
|
|
19
|
+
readonly renderChromeSlot?: ProjectedViewSurfaceChromeSlotRenderer;
|
|
20
|
+
readonly renderRegion?: ProjectedPromptRegionRenderer<TContext>;
|
|
21
|
+
readonly renderView?: (viewId: string) => ReactNode;
|
|
22
|
+
readonly title?: ReactNode;
|
|
23
|
+
readonly view: ViewDefinition;
|
|
24
|
+
}
|
|
25
|
+
export interface ProjectedPromptRegionRenderContext<TContext> {
|
|
26
|
+
readonly context: TContext;
|
|
27
|
+
readonly dataSourceResolver: PresentationDataSourceResolver;
|
|
28
|
+
readonly module: PresentationModuleDefinition;
|
|
29
|
+
readonly region: ViewRegionDefinition;
|
|
30
|
+
readonly renderView?: (viewId: string) => ReactNode;
|
|
31
|
+
readonly view: ViewDefinition;
|
|
32
|
+
}
|
|
33
|
+
export type ProjectedPromptRegionRenderer<TContext> = (context: ProjectedPromptRegionRenderContext<TContext>) => ReactNode | undefined;
|
|
34
|
+
export declare function ProjectedPromptView<TContext>({ actionGroupOptions, actionRegionId, className, componentSystem, contentClassName, context, dataSourceResolver, designSystem, description, module, regionRenderers, renderChromeSlot, renderRegion, renderView, title, view, }: ProjectedPromptViewProps<TContext>): ReactNode;
|
|
35
|
+
//# sourceMappingURL=projected-prompt-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-prompt-view.d.ts","sourceRoot":"","sources":["../src/projected-prompt-view.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAErF,OAAO,EAUL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAEjC,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAEL,KAAK,8BAA8B,EAEpC,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EACV,iCAAiC,IAAI,2BAA2B,EACjE,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAA;AActF,OAAO,KAAK,EACV,sCAAsC,EACvC,MAAM,0BAA0B,CAAA;AAOjC,MAAM,WAAW,wBAAwB,CAAC,QAAQ;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,8BAA8B,CAAC,QAAQ,CAAC,CAAA;IACtE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,eAAe,EAAE,2BAA2B,CAAA;IACrD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;IAC1B,QAAQ,CAAC,kBAAkB,EAAE,8BAA8B,CAAA;IAC3D,QAAQ,CAAC,YAAY,EAAE,wBAAwB,CAAA;IAC/C,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAA;IAC7C,QAAQ,CAAC,eAAe,CAAC,EAAE,Q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