@xemahq/ui-kernel 0.11.1 → 0.12.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/dist/errors/http-error-status.d.ts +17 -0
- package/dist/errors/http-error-status.d.ts.map +1 -0
- package/dist/errors/http-error-status.js +59 -0
- package/dist/errors/http-error-status.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/biome-host/errors.d.ts.map +1 -1
- package/dist/lib/biome-host/errors.js +1 -19
- package/dist/lib/biome-host/errors.js.map +1 -1
- package/dist/offline/index.d.ts.map +1 -1
- package/dist/offline/index.js.map +1 -1
- package/dist/offline/online-controller.d.ts.map +1 -1
- package/dist/offline/online-controller.js +6 -1
- package/dist/offline/online-controller.js.map +1 -1
- package/dist/offline/outbox.d.ts.map +1 -1
- package/dist/offline/outbox.js +2 -24
- package/dist/offline/outbox.js.map +1 -1
- package/package.json +1 -2
- package/src/index.ts +0 -17
- package/src/lib/biome-host/agent-validation.ts +0 -239
- package/src/lib/biome-host/biome-builders.ts +0 -112
- package/src/lib/biome-host/biome-mode.ts +0 -6
- package/src/lib/biome-host/biome-navigation.ts +0 -37
- package/src/lib/biome-host/biome-registry.ts +0 -299
- package/src/lib/biome-host/biome-scope-hooks.ts +0 -41
- package/src/lib/biome-host/biome-scope.tsx +0 -52
- package/src/lib/biome-host/biome-scoped-query.ts +0 -134
- package/src/lib/biome-host/create-biome-orval-config.ts +0 -82
- package/src/lib/biome-host/define-web-biome.spec.ts +0 -221
- package/src/lib/biome-host/define-web-biome.ts +0 -222
- package/src/lib/biome-host/errors.ts +0 -220
- package/src/lib/biome-host/frontend-biome.ts +0 -256
- package/src/lib/biome-host/host-bridge.ts +0 -281
- package/src/lib/biome-host/host-sources.ts +0 -54
- package/src/lib/biome-host/i18n-hooks.ts +0 -51
- package/src/lib/biome-host/i18n-port.test.ts +0 -50
- package/src/lib/biome-host/i18n-port.ts +0 -96
- package/src/lib/biome-host/index.ts +0 -35
- package/src/lib/biome-host/realtime-hooks.ts +0 -75
- package/src/lib/biome-host/realtime-port.ts +0 -115
- package/src/lib/biome-host/session-contributions.ts +0 -296
- package/src/lib/biome-host/use-mutation-with-error-toast.ts +0 -90
- package/src/lib/biome-host/use-page-state.ts +0 -248
- package/src/lib/capabilities/capability-context.ts +0 -25
- package/src/lib/capabilities/capability-provider.tsx +0 -73
- package/src/lib/capabilities/index.ts +0 -17
- package/src/lib/capabilities/types.ts +0 -69
- package/src/lib/capabilities/use-capability.ts +0 -79
- package/src/lib/contribution-registry/contribution-registry.spec.ts +0 -141
- package/src/lib/contribution-registry/contribution-registry.ts +0 -204
- package/src/lib/contribution-registry/index.ts +0 -9
- package/src/lib/contribution-registry/renderable-registry.ts +0 -142
- package/src/lib/system-bus/capability-invoke.ts +0 -92
- package/src/lib/system-bus/deeplink.ts +0 -210
- package/src/lib/system-bus/enums.ts +0 -86
- package/src/lib/system-bus/host-ports.ts +0 -93
- package/src/lib/system-bus/index.ts +0 -16
- package/src/lib/system-bus/intent-registry.ts +0 -109
- package/src/lib/system-bus/intents.ts +0 -113
- package/src/lib/system-bus/palette.ts +0 -78
- package/src/lib/system-bus/system-bus-builder.ts +0 -159
- package/src/lib/system-bus/system-bus.ts +0 -37
- package/src/lib/system-bus/windows.ts +0 -51
- package/src/offline/id.ts +0 -16
- package/src/offline/index.ts +0 -54
- package/src/offline/mutation.ts +0 -75
- package/src/offline/offline-status-badge.tsx +0 -51
- package/src/offline/online-controller.ts +0 -105
- package/src/offline/outbox.test.ts +0 -172
- package/src/offline/outbox.ts +0 -348
- package/src/offline/react-hooks.ts +0 -40
- package/src/offline/react.tsx +0 -32
- package/src/offline/storage.ts +0 -112
- package/src/offline/types.ts +0 -77
- package/src/org-db/components/DbResultTable.tsx +0 -176
- package/src/org-db/index.ts +0 -1
- package/src/pdf/index.ts +0 -11
- package/src/registry/index.ts +0 -9
- package/src/registry/lib/agent-validation-host.ts +0 -36
- package/src/registry/lib/biome-slot.tsx +0 -50
- package/src/registry/lib/biomes-enabled-context.ts +0 -20
- package/src/registry/lib/extension-points.ts +0 -134
- package/src/registry/lib/primitives/SessionEventCard.tsx +0 -164
- package/src/registry/lib/primitives/SessionEventTimeline.tsx +0 -95
- package/src/registry/lib/primitives/SessionMutationBar.tsx +0 -76
- package/src/registry/lib/primitives/SessionTabbedDrawer.tsx +0 -165
- package/src/registry/lib/primitives/index.ts +0 -18
- package/src/registry/lib/session-context-builder.ts +0 -84
- package/src/registry/lib/session-context-provider.tsx +0 -33
- package/src/registry/lib/session-context.ts +0 -21
- package/src/registry/lib/session-selectors.ts +0 -272
- package/src/session/comments/CommentRail.tsx +0 -164
- package/src/session/index.ts +0 -3
- package/src/session/lib/cn.ts +0 -11
- package/src/session/shell/SessionWorkspaceShell.tsx +0 -147
- package/src/session-kit/approvals/ApprovalButton.tsx +0 -89
- package/src/session-kit/approvals/ApprovalCard.tsx +0 -341
- package/src/session-kit/approvals/ApprovalsCenter.tsx +0 -336
- package/src/session-kit/approvals/CapabilityApprovalStickyBar.tsx +0 -118
- package/src/session-kit/approvals/Obligation.tsx +0 -111
- package/src/session-kit/approvals/ScopedBody.tsx +0 -392
- package/src/session-kit/approvals/approval-icons.ts +0 -31
- package/src/session-kit/approvals/approval-model.ts +0 -204
- package/src/session-kit/approvals/index.ts +0 -22
- package/src/session-kit/approvals/obligation-display.ts +0 -100
- package/src/session-kit/approvals/risk-accent.ts +0 -47
- package/src/session-kit/approvals/scope-icons.ts +0 -19
- package/src/session-kit/combobox/Combobox.tsx +0 -358
- package/src/session-kit/combobox/use-click-outside.ts +0 -21
- package/src/session-kit/display/ContextHeader.tsx +0 -148
- package/src/session-kit/display/FileDiffCard.tsx +0 -140
- package/src/session-kit/display/MD.tsx +0 -162
- package/src/session-kit/display/MessageTurn.tsx +0 -157
- package/src/session-kit/display/ThinkingPanel.tsx +0 -81
- package/src/session-kit/display/TodoChecklist.tsx +0 -120
- package/src/session-kit/display/TokenMeter.tsx +0 -89
- package/src/session-kit/display/ToolStrip.tsx +0 -278
- package/src/session-kit/display/TypingDots.tsx +0 -24
- package/src/session-kit/index.ts +0 -44
- package/src/session-kit/lib/enums.ts +0 -66
- package/src/session-kit/lib/portal-accent.ts +0 -30
- package/src/session-kit/lib/status-dot.ts +0 -68
- package/src/session-kit/primitives/Avatar.tsx +0 -44
- package/src/session-kit/primitives/PortalGlyph.tsx +0 -51
- package/src/session-kit/primitives/RiskPill.tsx +0 -95
- package/src/session-kit/primitives/ScopeDot.tsx +0 -47
- package/src/session-kit/primitives/Segmented.tsx +0 -71
- package/src/ui/branding/app-branding-context.ts +0 -20
- package/src/ui/branding/app-branding-provider.tsx +0 -123
- package/src/ui/branding/sanitize.ts +0 -89
- package/src/ui/breakpoints.ts +0 -14
- package/src/ui/capture/document-preview.tsx +0 -166
- package/src/ui/capture/field-spec-to-zod.test.ts +0 -81
- package/src/ui/capture/field-spec-to-zod.ts +0 -174
- package/src/ui/capture/field-spec-validate.ts +0 -236
- package/src/ui/capture/field-spec.test.ts +0 -49
- package/src/ui/capture/field-spec.ts +0 -274
- package/src/ui/capture/index.ts +0 -51
- package/src/ui/capture/schema-field-input.tsx +0 -620
- package/src/ui/capture/schema-form.tsx +0 -149
- package/src/ui/capture/submit-values.test.ts +0 -70
- package/src/ui/capture/submit-values.ts +0 -63
- package/src/ui/capture/use-prefill.ts +0 -186
- package/src/ui/capture/use-schema-validation.ts +0 -145
- package/src/ui/capture/use-wizard.ts +0 -180
- package/src/ui/capture/value-format.ts +0 -32
- package/src/ui/capture/wizard.tsx +0 -105
- package/src/ui/charts/bar-chart.tsx +0 -139
- package/src/ui/charts/chart-frame.tsx +0 -125
- package/src/ui/charts/chart-types.ts +0 -52
- package/src/ui/charts/chart-utils.ts +0 -190
- package/src/ui/charts/charts.test.tsx +0 -204
- package/src/ui/charts/donut-chart.tsx +0 -129
- package/src/ui/charts/index.ts +0 -27
- package/src/ui/charts/line-chart.tsx +0 -202
- package/src/ui/charts/sparkline.tsx +0 -109
- package/src/ui/chrome/AsyncBoundary.tsx +0 -74
- package/src/ui/chrome/EmptyState.tsx +0 -257
- package/src/ui/chrome/ErrorCard.tsx +0 -63
- package/src/ui/chrome/LoadingState.tsx +0 -61
- package/src/ui/chrome/PageHeader.tsx +0 -137
- package/src/ui/chrome/RecordCardList.tsx +0 -98
- package/src/ui/chrome/StateCard.tsx +0 -150
- package/src/ui/chrome/confirm-delete-dialog.tsx +0 -59
- package/src/ui/chrome/page-shell.spec.tsx +0 -117
- package/src/ui/chrome/page-shell.tsx +0 -221
- package/src/ui/chrome/scope-badge.tsx +0 -40
- package/src/ui/chrome/status-badge.tsx +0 -79
- package/src/ui/cn.ts +0 -32
- package/src/ui/design-tokens.ts +0 -372
- package/src/ui/hooks/use-debounced-value.ts +0 -16
- package/src/ui/hooks/use-is-mobile.ts +0 -28
- package/src/ui/index.ts +0 -110
- package/src/ui/pdf/pdf-preview.tsx +0 -122
- package/src/ui/primitives/alert-dialog.tsx +0 -104
- package/src/ui/primitives/async-combobox.tsx +0 -182
- package/src/ui/primitives/badge-variants.ts +0 -21
- package/src/ui/primitives/badge.tsx +0 -25
- package/src/ui/primitives/button-variants.ts +0 -31
- package/src/ui/primitives/button.tsx +0 -29
- package/src/ui/primitives/card.tsx +0 -43
- package/src/ui/primitives/checkbox.tsx +0 -26
- package/src/ui/primitives/collapsible.tsx +0 -9
- package/src/ui/primitives/dialog.tsx +0 -103
- package/src/ui/primitives/dropdown-menu.tsx +0 -179
- package/src/ui/primitives/form-stepper.tsx +0 -94
- package/src/ui/primitives/form-stepper.types.ts +0 -15
- package/src/ui/primitives/input.tsx +0 -22
- package/src/ui/primitives/label.tsx +0 -17
- package/src/ui/primitives/overflow-tabs.tsx +0 -331
- package/src/ui/primitives/popover.tsx +0 -33
- package/src/ui/primitives/preview-device-frame.tsx +0 -213
- package/src/ui/primitives/radio-group.tsx +0 -36
- package/src/ui/primitives/resizable.tsx +0 -67
- package/src/ui/primitives/scroll-area.tsx +0 -38
- package/src/ui/primitives/select.tsx +0 -143
- package/src/ui/primitives/separator.tsx +0 -20
- package/src/ui/primitives/sheet.tsx +0 -107
- package/src/ui/primitives/skeleton.tsx +0 -99
- package/src/ui/primitives/switch.tsx +0 -27
- package/src/ui/primitives/table.tsx +0 -72
- package/src/ui/primitives/tabs.tsx +0 -53
- package/src/ui/primitives/tag-multi-select.tsx +0 -261
- package/src/ui/primitives/textarea.tsx +0 -21
- package/src/ui/primitives/tooltip.tsx +0 -30
- package/src/ui/primitives/url-preview-chrome.tsx +0 -103
- package/src/vista/GenericCatalogueSurface.tsx +0 -179
- package/src/vista/SurfaceFallbackCard.tsx +0 -109
- package/src/vista/VistaPanel.tsx +0 -163
- package/src/vista/form-payload.spec.ts +0 -139
- package/src/vista/html/CustomUiFrame.spec.tsx +0 -127
- package/src/vista/html/CustomUiFrame.tsx +0 -206
- package/src/vista/html/custom-ui-frame-bridge.spec.ts +0 -191
- package/src/vista/html/custom-ui-frame-bridge.ts +0 -98
- package/src/vista/html/custom-ui-frame-contract.ts +0 -88
- package/src/vista/html/custom-ui-intents.spec.ts +0 -135
- package/src/vista/html/custom-ui-intents.ts +0 -155
- package/src/vista/html/custom-ui-srcdoc.spec.ts +0 -151
- package/src/vista/html/custom-ui-srcdoc.ts +0 -193
- package/src/vista/html/index.ts +0 -13
- package/src/vista/index.ts +0 -52
- package/src/vista/surface-catalogue.spec.ts +0 -140
- package/src/vista/surface-catalogue.ts +0 -90
- package/src/vista/surface-icons.ts +0 -57
- package/src/vista/surface-registry.ts +0 -56
- package/src/vista/surfaces/ChartSurface.tsx +0 -34
- package/src/vista/surfaces/FilesSurface.tsx +0 -202
- package/src/vista/surfaces/FormSurface.tsx +0 -380
- package/src/vista/surfaces/HtmlSurface.tsx +0 -43
- package/src/vista/surfaces/TableSurface.tsx +0 -100
- package/src/vista/surfaces/UrlSurface.tsx +0 -40
- package/src/vista/surfaces/blob-surfaces.tsx +0 -139
- package/src/vista/surfaces/elicitation-transport.spec.ts +0 -369
- package/src/vista/surfaces/elicitation-transport.ts +0 -367
- package/src/vista/surfaces/file-surface-utils.ts +0 -69
- package/src/vista/surfaces/index.ts +0 -24
- package/src/vista/surfaces/register-surfaces.tsx +0 -139
- package/src/vista/surfaces/text-surfaces.tsx +0 -132
- package/src/vista/use-vista-tabs.ts +0 -196
- package/src/vista/vista-code-renderer-context.ts +0 -16
- package/src/vista/vista-code-renderer.tsx +0 -35
- package/src/vista/vista-file-context.ts +0 -14
- package/src/vista/vista-file-source.tsx +0 -141
- package/src/vista/vista-form-context.ts +0 -20
- package/src/vista/vista-form-host.tsx +0 -48
- package/src/vista/vista-model.ts +0 -137
- package/src/vista/vista-open-context.tsx +0 -27
- package/src/vista/vista-open-state.ts +0 -11
- package/src/vista/vista-payloads.ts +0 -635
- package/src/vista/vista-tabs-manifest.ts +0 -138
- package/src/vista/vista-tools.ts +0 -232
package/src/vista/vista-model.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Vista tab model — ONE tab vocabulary for every preview plane.
|
|
3
|
-
*
|
|
4
|
-
* Before this module the frontend carried THREE overlapping tab models with no
|
|
5
|
-
* shared code:
|
|
6
|
-
* • `WorkspaceTabKind` (`files|code|md|diff|tests|url`) in the thin session
|
|
7
|
-
* workspace;
|
|
8
|
-
* • `PreviewTabKind` (`files|html|markdown|pdf|image|plain`) buried inside the
|
|
9
|
-
* Design-System-Builder page;
|
|
10
|
-
* • the App-Forge preview.
|
|
11
|
-
* All three collapse onto the kernel {@link SurfaceKind} (Canopy §8.5). A tab is
|
|
12
|
-
* just a {@link VistaSurface} envelope; the Vista registry resolves its `kind`
|
|
13
|
-
* to a renderer.
|
|
14
|
-
*
|
|
15
|
-
* Collapse notes (deliberate, documented decisions):
|
|
16
|
-
* • `md` → {@link SurfaceKind.Markdown}.
|
|
17
|
-
* • `plain` → {@link SurfaceKind.Code}. `Code` is "a source file", and the
|
|
18
|
-
* code renderer is a mono pane; a separate "plain text" kind would be the
|
|
19
|
-
* same renderer under a second name.
|
|
20
|
-
* • `tests` had no kernel equivalent and was never a *render* kind — a test
|
|
21
|
-
* report is a biome-owned surface, so it becomes a biome-contributed
|
|
22
|
-
* `<biomeId>:tests` kind rather than a first-party one. Nothing in the tree
|
|
23
|
-
* rendered it (the thin workspace's `renderTests` slot was never supplied).
|
|
24
|
-
*/
|
|
25
|
-
import {
|
|
26
|
-
SurfaceKind,
|
|
27
|
-
type VistaSurface,
|
|
28
|
-
} from '@xemahq/kernel-contracts/surface';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Id of the pinned, UI-owned file-browser tab. It is owned by the panel, never
|
|
32
|
-
* declared by an agent, and never closeable.
|
|
33
|
-
*/
|
|
34
|
-
export const VISTA_FILES_TAB_ID = 'files';
|
|
35
|
-
|
|
36
|
-
/** Current payload schema version of every first-party surface kind. */
|
|
37
|
-
export const VISTA_SURFACE_VERSION = 1;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* A Vista tab. Structurally a {@link VistaSurface} — the tab model and the
|
|
41
|
-
* agent-facing envelope are the SAME shape on purpose, so `vista_open` needs no
|
|
42
|
-
* translation layer.
|
|
43
|
-
*/
|
|
44
|
-
export type VistaTab = VistaSurface;
|
|
45
|
-
|
|
46
|
-
/** Extension → first-party surface kind. Closed, deterministic mapping. */
|
|
47
|
-
const EXTENSION_KIND: Readonly<Record<string, SurfaceKind>> = {
|
|
48
|
-
html: SurfaceKind.Html,
|
|
49
|
-
htm: SurfaceKind.Html,
|
|
50
|
-
md: SurfaceKind.Markdown,
|
|
51
|
-
mdx: SurfaceKind.Markdown,
|
|
52
|
-
markdown: SurfaceKind.Markdown,
|
|
53
|
-
pdf: SurfaceKind.Pdf,
|
|
54
|
-
png: SurfaceKind.Image,
|
|
55
|
-
jpg: SurfaceKind.Image,
|
|
56
|
-
jpeg: SurfaceKind.Image,
|
|
57
|
-
gif: SurfaceKind.Image,
|
|
58
|
-
webp: SurfaceKind.Image,
|
|
59
|
-
svg: SurfaceKind.Image,
|
|
60
|
-
avif: SurfaceKind.Image,
|
|
61
|
-
mp4: SurfaceKind.Media,
|
|
62
|
-
webm: SurfaceKind.Media,
|
|
63
|
-
mov: SurfaceKind.Media,
|
|
64
|
-
mp3: SurfaceKind.Media,
|
|
65
|
-
wav: SurfaceKind.Media,
|
|
66
|
-
ogg: SurfaceKind.Media,
|
|
67
|
-
m4a: SurfaceKind.Media,
|
|
68
|
-
json: SurfaceKind.Json,
|
|
69
|
-
diff: SurfaceKind.Diff,
|
|
70
|
-
patch: SurfaceKind.Diff,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Resolve the surface kind a file path renders as. Deterministic and total:
|
|
75
|
-
* anything unrecognised is {@link SurfaceKind.Code} (a mono text pane), which is
|
|
76
|
-
* always a correct — if plain — rendering of a file's bytes.
|
|
77
|
-
*/
|
|
78
|
-
export function surfaceKindForPath(path: string): SurfaceKind {
|
|
79
|
-
const dot = path.lastIndexOf('.');
|
|
80
|
-
if (dot === -1) {
|
|
81
|
-
return SurfaceKind.Code;
|
|
82
|
-
}
|
|
83
|
-
const ext = path.slice(dot + 1).toLowerCase();
|
|
84
|
-
return EXTENSION_KIND[ext] ?? SurfaceKind.Code;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** The `content-type` a media/blob surface reports for a path, when derivable. */
|
|
88
|
-
const EXTENSION_CONTENT_TYPE: Readonly<Record<string, string>> = {
|
|
89
|
-
png: 'image/png',
|
|
90
|
-
jpg: 'image/jpeg',
|
|
91
|
-
jpeg: 'image/jpeg',
|
|
92
|
-
gif: 'image/gif',
|
|
93
|
-
webp: 'image/webp',
|
|
94
|
-
svg: 'image/svg+xml',
|
|
95
|
-
avif: 'image/avif',
|
|
96
|
-
pdf: 'application/pdf',
|
|
97
|
-
mp4: 'video/mp4',
|
|
98
|
-
webm: 'video/webm',
|
|
99
|
-
mov: 'video/quicktime',
|
|
100
|
-
mp3: 'audio/mpeg',
|
|
101
|
-
wav: 'audio/wav',
|
|
102
|
-
ogg: 'audio/ogg',
|
|
103
|
-
m4a: 'audio/mp4',
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/** Content type for a path, or `null` when the extension is unknown. */
|
|
107
|
-
export function contentTypeForPath(path: string): string | null {
|
|
108
|
-
const dot = path.lastIndexOf('.');
|
|
109
|
-
if (dot === -1) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return EXTENSION_CONTENT_TYPE[path.slice(dot + 1).toLowerCase()] ?? null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/** The last path segment — the default tab label for a file-backed surface. */
|
|
116
|
-
export function labelForPath(path: string): string {
|
|
117
|
-
const segments = path.split('/');
|
|
118
|
-
return segments[segments.length - 1] || path;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Build a file-backed surface envelope for a path. One seam so every caller
|
|
123
|
-
* (the `.tabs.json` parser, the file browser, `vista_open`) derives kind + label
|
|
124
|
-
* + tab id identically.
|
|
125
|
-
*/
|
|
126
|
-
export function fileSurface(
|
|
127
|
-
path: string,
|
|
128
|
-
overrides?: Readonly<{ title?: string; kind?: SurfaceKind }>,
|
|
129
|
-
): VistaTab {
|
|
130
|
-
return {
|
|
131
|
-
tabId: `file:${path}`,
|
|
132
|
-
kind: overrides?.kind ?? surfaceKindForPath(path),
|
|
133
|
-
version: VISTA_SURFACE_VERSION,
|
|
134
|
-
title: overrides?.title ?? labelForPath(path),
|
|
135
|
-
payload: { path },
|
|
136
|
-
};
|
|
137
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `VistaOpenContext` — how a surface asks the panel to open ANOTHER surface.
|
|
3
|
-
*
|
|
4
|
-
* The registry's `render(payload)` is a pure function, so a renderer cannot
|
|
5
|
-
* receive an `onOpen` prop. The panel publishes its `open` through this context
|
|
6
|
-
* instead: the file browser opens a file tab, an object view opens a related
|
|
7
|
-
* object, and so on — all through the SAME `vista_open` semantics the agent
|
|
8
|
-
* uses, never a second code path.
|
|
9
|
-
*
|
|
10
|
-
* A surface mounted without a provider simply renders non-interactive rows
|
|
11
|
-
* (`useVistaOpen()` returns `null`) — an inert list, never a dead click that
|
|
12
|
-
* silently does nothing.
|
|
13
|
-
*/
|
|
14
|
-
import { type ReactElement, type ReactNode } from 'react';
|
|
15
|
-
|
|
16
|
-
import { VistaOpenContext, type VistaOpenFn } from './vista-open-state';
|
|
17
|
-
|
|
18
|
-
export function VistaOpenProvider({
|
|
19
|
-
open,
|
|
20
|
-
children,
|
|
21
|
-
}: Readonly<{ open: VistaOpenFn; children: ReactNode }>): ReactElement {
|
|
22
|
-
return (
|
|
23
|
-
<VistaOpenContext.Provider value={open}>
|
|
24
|
-
{children}
|
|
25
|
-
</VistaOpenContext.Provider>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { VistaTab } from './vista-model';
|
|
4
|
-
|
|
5
|
-
export type VistaOpenFn = (surface: VistaTab) => string;
|
|
6
|
-
|
|
7
|
-
export const VistaOpenContext = createContext<VistaOpenFn | null>(null);
|
|
8
|
-
|
|
9
|
-
export function useVistaOpen(): VistaOpenFn | null {
|
|
10
|
-
return useContext(VistaOpenContext);
|
|
11
|
-
}
|