@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.
@@ -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
- <Modal
446
- title={options.modalTitle ?? options.title}
447
- icon={modalIconElement}
448
- open={centeredOpen}
449
- onOpenChange={(nextOpen: boolean) => setCenteredOpen(agentId, nextOpen)}
463
+ <View
464
+ onStartShouldSetResponder={() => true}
465
+ onTouchEnd={stopBubbling}
466
+ {...(eventBoundaryProps as any)}
450
467
  >
451
- <Modal.Content scrollable={resolvePillModalScrollable(options.hostScroll)}>
452
- {centeredOpen ? (
453
- <PluginThemeProvider theme={theme} layout={layout} flair={options.flair}>
454
- {options.renderModal({
455
- agentId,
456
- workspaceId: props.workspaceId ?? "",
457
- theme,
458
- layout,
459
- host: props.host ?? { id: "", label: "" },
460
- close: () => setCenteredOpen(agentId, false),
461
- })}
462
- </PluginThemeProvider>
463
- ) : null}
464
- </Modal.Content>
465
- </Modal>
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 style={[styles.popoverContainer, frameWidth ? { width: frameWidth } : null]}>
512
- <ModalBodyScrollOwnerContext.Provider value="host">
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
- {options.renderModal?.({
593
- ...props,
594
- close: () => setOpen(false),
595
- payload,
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";