@xpufx/paseo-top 0.4.1 → 0.4.3
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 +11 -12
- package/client/multi-host-view.tsx +177 -0
- package/client/multi-host.ts +98 -0
- package/client/pill-labels.ts +1 -1
- package/client/pill.tsx +4 -2
- package/client/resources-query.ts +1 -1
- package/client/settings-ui.tsx +1 -1
- package/client/surface.tsx +7 -10
- package/client/telemetry-copy.ts +1 -1
- package/client/telemetry.tsx +2 -2
- package/client/turn-panel.tsx +1 -1
- package/client/vendor/paseo-plugin-helper/components/Button.tsx +7 -1
- package/client/vendor/paseo-plugin-helper/components/InlineButton.tsx +3 -1
- package/client/vendor/paseo-plugin-helper/index.ts +1 -0
- package/client/vendor/paseo-plugin-helper/layout/ModalBody.tsx +3 -3
- package/client/vendor/paseo-plugin-helper/layout/ModalContent.tsx +24 -22
- package/client/vendor/paseo-plugin-helper/panel.tsx +11 -3
- package/client/vendor/paseo-plugin-helper/pill.tsx +77 -28
- package/client/vendor/paseo-plugin-helper/styles/index.ts +1 -0
- package/client/vendor/paseo-plugin-helper/styles/recipes.ts +550 -0
- package/client/vendor/paseo-plugin-helper/theme/provider.tsx +3 -39
- package/client/vendor/paseo-plugin-helper/theme/tokens.ts +40 -1
- package/index.client.tsx +1 -1
- package/index.server.ts +1 -1
- package/package.json +3 -3
- package/paseo-plugin.json +1 -1
- package/server/resources.ts +1 -1
- package/shared/multi-host.ts +341 -0
- package/shared/resources.ts +1 -1
|
@@ -20,6 +20,8 @@ export interface RegisterWorkspacePanelOptions {
|
|
|
20
20
|
icon: string;
|
|
21
21
|
Component: ComponentType<PluginWorkspacePanelProps>;
|
|
22
22
|
flair?: VisualFlair;
|
|
23
|
+
/** Host locations in which the panel should be available. */
|
|
24
|
+
locations?: string[];
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export interface RegisterAgentPanelOptions {
|
|
@@ -37,8 +39,8 @@ export interface RegisterAgentPanelOptions {
|
|
|
37
39
|
export function registerWorkspacePanel(
|
|
38
40
|
plugin: WorkspacePanelRegistrar,
|
|
39
41
|
options: RegisterWorkspacePanelOptions,
|
|
40
|
-
): void {
|
|
41
|
-
const { id, title, icon, Component, flair } = options;
|
|
42
|
+
): () => void {
|
|
43
|
+
const { id, title, icon, Component, flair, locations } = options;
|
|
42
44
|
|
|
43
45
|
const WrappedComponent: ComponentType<PluginWorkspacePanelProps> = (props) => (
|
|
44
46
|
<PluginThemeProvider theme={props.theme} layout={props.layout} flair={flair}>
|
|
@@ -46,13 +48,19 @@ export function registerWorkspacePanel(
|
|
|
46
48
|
</PluginThemeProvider>
|
|
47
49
|
);
|
|
48
50
|
|
|
49
|
-
plugin.addWorkspacePanel({
|
|
51
|
+
const registration = plugin.addWorkspacePanel({
|
|
50
52
|
id,
|
|
51
53
|
title,
|
|
52
54
|
icon,
|
|
53
55
|
context: "workspace",
|
|
56
|
+
locations,
|
|
54
57
|
Component: WrappedComponent,
|
|
55
58
|
});
|
|
59
|
+
|
|
60
|
+
return () => {
|
|
61
|
+
if (typeof registration === "function") registration();
|
|
62
|
+
else registration?.remove?.();
|
|
63
|
+
};
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
/**
|
|
@@ -439,30 +439,64 @@ export function registerComposerPill<TPayload = any>(
|
|
|
439
439
|
color={theme.colors.foreground}
|
|
440
440
|
/>
|
|
441
441
|
);
|
|
442
|
+
const stopBubbling = (e: any) => {
|
|
443
|
+
if (e && typeof e.stopPropagation === "function") {
|
|
444
|
+
e.stopPropagation();
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const eventBoundaryProps = {
|
|
449
|
+
onClick: stopBubbling,
|
|
450
|
+
onMouseDown: stopBubbling,
|
|
451
|
+
onMouseUp: stopBubbling,
|
|
452
|
+
onPointerDown: stopBubbling,
|
|
453
|
+
onPointerUp: stopBubbling,
|
|
454
|
+
onTouchStart: stopBubbling,
|
|
455
|
+
onTouchEnd: stopBubbling,
|
|
456
|
+
onKeyDown: stopBubbling,
|
|
457
|
+
onKeyUp: stopBubbling,
|
|
458
|
+
};
|
|
459
|
+
|
|
442
460
|
return (
|
|
443
461
|
<>
|
|
444
462
|
{icon}
|
|
445
|
-
<
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
onOpenChange={(nextOpen: boolean) => setCenteredOpen(agentId, nextOpen)}
|
|
463
|
+
<View
|
|
464
|
+
onStartShouldSetResponder={() => true}
|
|
465
|
+
onTouchEnd={stopBubbling}
|
|
466
|
+
{...(eventBoundaryProps as any)}
|
|
450
467
|
>
|
|
451
|
-
<Modal
|
|
452
|
-
{
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
468
|
+
<Modal
|
|
469
|
+
title={options.modalTitle ?? options.title}
|
|
470
|
+
icon={modalIconElement}
|
|
471
|
+
open={centeredOpen}
|
|
472
|
+
onOpenChange={(nextOpen: boolean) => setCenteredOpen(agentId, nextOpen)}
|
|
473
|
+
>
|
|
474
|
+
<Modal.Content scrollable={resolvePillModalScrollable(options.hostScroll)}>
|
|
475
|
+
{centeredOpen ? (
|
|
476
|
+
<View
|
|
477
|
+
onStartShouldSetResponder={() => true}
|
|
478
|
+
onTouchEnd={stopBubbling}
|
|
479
|
+
{...(eventBoundaryProps as any)}
|
|
480
|
+
>
|
|
481
|
+
<PluginThemeProvider theme={theme} layout={layout} flair={options.flair}>
|
|
482
|
+
<ModalBodyScrollOwnerContext.Provider
|
|
483
|
+
value={resolvePillModalScrollable(options.hostScroll) ? "host" : "required"}
|
|
484
|
+
>
|
|
485
|
+
{options.renderModal({
|
|
486
|
+
agentId,
|
|
487
|
+
workspaceId: props.workspaceId ?? "",
|
|
488
|
+
theme,
|
|
489
|
+
layout,
|
|
490
|
+
host: props.host ?? { id: "", label: "" },
|
|
491
|
+
close: () => setCenteredOpen(agentId, false),
|
|
492
|
+
})}
|
|
493
|
+
</ModalBodyScrollOwnerContext.Provider>
|
|
494
|
+
</PluginThemeProvider>
|
|
495
|
+
</View>
|
|
496
|
+
) : null}
|
|
497
|
+
</Modal.Content>
|
|
498
|
+
</Modal>
|
|
499
|
+
</View>
|
|
466
500
|
</>
|
|
467
501
|
);
|
|
468
502
|
};
|
|
@@ -480,7 +514,7 @@ export function registerComposerPill<TPayload = any>(
|
|
|
480
514
|
host?: { id: string; label: string };
|
|
481
515
|
close: () => void;
|
|
482
516
|
}) {
|
|
483
|
-
const { width: windowWidth } = useWindowDimensions();
|
|
517
|
+
const { width: windowWidth, height: windowHeight } = useWindowDimensions();
|
|
484
518
|
// The anchored popover is otherwise sized from its content, so reflowing
|
|
485
519
|
// content can move the frame under the pointer. Pin it to an explicit width
|
|
486
520
|
// (clamped to the viewport) and let children overflow into their own
|
|
@@ -489,6 +523,11 @@ export function registerComposerPill<TPayload = any>(
|
|
|
489
523
|
!props.layout.compact && options.popoverWidth
|
|
490
524
|
? Math.max(0, Math.min(options.popoverWidth, windowWidth - 24))
|
|
491
525
|
: undefined;
|
|
526
|
+
// The host remains the scroll owner, but it needs a finite child extent to
|
|
527
|
+
// establish the popover viewport. Do not add overflow clipping or an inner
|
|
528
|
+
// ScrollView here: either would compete with the host's popover/sheet
|
|
529
|
+
// scroller.
|
|
530
|
+
const frameMaxHeight = Math.max(1, Math.min(560, windowHeight * 0.8));
|
|
492
531
|
// Layout effect, not effect: the flag must be set in the same commit the
|
|
493
532
|
// popover mounts, before any label timer can interleave. An effect runs
|
|
494
533
|
// after paint, leaving a window where one tick can still publish and
|
|
@@ -508,8 +547,14 @@ export function registerComposerPill<TPayload = any>(
|
|
|
508
547
|
};
|
|
509
548
|
return (
|
|
510
549
|
<PluginThemeProvider theme={props.theme} layout={props.layout} flair={options.flair}>
|
|
511
|
-
<View
|
|
512
|
-
|
|
550
|
+
<View
|
|
551
|
+
style={{
|
|
552
|
+
...styles.popoverContainer,
|
|
553
|
+
maxHeight: frameMaxHeight,
|
|
554
|
+
...(frameWidth ? { width: frameWidth } : null),
|
|
555
|
+
}}
|
|
556
|
+
>
|
|
557
|
+
<ModalBodyScrollOwnerContext.Provider value="popover">
|
|
513
558
|
{options.renderModal?.({ ...pillProps, close: props.close })}
|
|
514
559
|
</ModalBodyScrollOwnerContext.Provider>
|
|
515
560
|
</View>
|
|
@@ -589,11 +634,15 @@ export function registerComposerPill<TPayload = any>(
|
|
|
589
634
|
<Modal.Content scrollable={resolvePillModalScrollable(options.hostScroll)}>
|
|
590
635
|
{open ? (
|
|
591
636
|
<PluginThemeProvider theme={props.theme} layout={props.layout} flair={options.flair}>
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
637
|
+
<ModalBodyScrollOwnerContext.Provider
|
|
638
|
+
value={resolvePillModalScrollable(options.hostScroll) ? "host" : "required"}
|
|
639
|
+
>
|
|
640
|
+
{options.renderModal?.({
|
|
641
|
+
...props,
|
|
642
|
+
close: () => setOpen(false),
|
|
643
|
+
payload,
|
|
644
|
+
})}
|
|
645
|
+
</ModalBodyScrollOwnerContext.Provider>
|
|
597
646
|
</PluginThemeProvider>
|
|
598
647
|
) : null}
|
|
599
648
|
</Modal.Content>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./recipes";
|