@buoy-gg/events 2.1.9 → 2.1.12

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.
Files changed (88) hide show
  1. package/lib/commonjs/components/EventsCopySettingsView.js +3 -1
  2. package/lib/commonjs/components/EventsCopySettingsView.js.map +1 -0
  3. package/lib/commonjs/components/EventsModal.js.map +1 -0
  4. package/lib/commonjs/components/ReactQueryEventDetail.js +7 -3
  5. package/lib/commonjs/components/ReactQueryEventDetail.js.map +1 -0
  6. package/lib/commonjs/components/UnifiedEventDetail.js +68 -2
  7. package/lib/commonjs/components/UnifiedEventDetail.js.map +1 -0
  8. package/lib/commonjs/components/UnifiedEventFilters.js.map +1 -0
  9. package/lib/commonjs/components/UnifiedEventItem.js +59 -1
  10. package/lib/commonjs/components/UnifiedEventItem.js.map +1 -0
  11. package/lib/commonjs/components/UnifiedEventList.js.map +1 -0
  12. package/lib/commonjs/components/UnifiedEventViewer.js.map +1 -0
  13. package/lib/commonjs/hooks/useUnifiedEvents.js +23 -1
  14. package/lib/commonjs/hooks/useUnifiedEvents.js.map +1 -0
  15. package/lib/commonjs/index.js.map +1 -0
  16. package/lib/commonjs/preset.js.map +1 -0
  17. package/lib/commonjs/stores/unifiedEventStore.js +59 -1
  18. package/lib/commonjs/stores/unifiedEventStore.js.map +1 -0
  19. package/lib/commonjs/types/copySettings.js.map +1 -0
  20. package/lib/commonjs/types/index.js.map +1 -0
  21. package/lib/commonjs/utils/autoDiscoverEventSources.js +146 -1
  22. package/lib/commonjs/utils/autoDiscoverEventSources.js.map +1 -0
  23. package/lib/commonjs/utils/badgeSelectionStorage.js.map +1 -0
  24. package/lib/commonjs/utils/copySettingsStorage.js.map +1 -0
  25. package/lib/commonjs/utils/correlationUtils.js.map +1 -0
  26. package/lib/commonjs/utils/eventExportFormatter.js +2 -0
  27. package/lib/commonjs/utils/eventExportFormatter.js.map +1 -0
  28. package/lib/commonjs/utils/eventTransformers.js.map +1 -0
  29. package/lib/module/components/EventsCopySettingsView.js +3 -1
  30. package/lib/module/components/EventsCopySettingsView.js.map +1 -0
  31. package/lib/module/components/EventsModal.js.map +1 -0
  32. package/lib/module/components/ReactQueryEventDetail.js +7 -3
  33. package/lib/module/components/ReactQueryEventDetail.js.map +1 -0
  34. package/lib/module/components/UnifiedEventDetail.js +68 -2
  35. package/lib/module/components/UnifiedEventDetail.js.map +1 -0
  36. package/lib/module/components/UnifiedEventFilters.js.map +1 -0
  37. package/lib/module/components/UnifiedEventItem.js +59 -1
  38. package/lib/module/components/UnifiedEventItem.js.map +1 -0
  39. package/lib/module/components/UnifiedEventList.js.map +1 -0
  40. package/lib/module/components/UnifiedEventViewer.js.map +1 -0
  41. package/lib/module/hooks/useUnifiedEvents.js +24 -2
  42. package/lib/module/hooks/useUnifiedEvents.js.map +1 -0
  43. package/lib/module/index.js.map +1 -0
  44. package/lib/module/preset.js.map +1 -0
  45. package/lib/module/stores/unifiedEventStore.js +54 -0
  46. package/lib/module/stores/unifiedEventStore.js.map +1 -0
  47. package/lib/module/types/copySettings.js.map +1 -0
  48. package/lib/module/types/index.js.map +1 -0
  49. package/lib/module/utils/autoDiscoverEventSources.js +146 -1
  50. package/lib/module/utils/autoDiscoverEventSources.js.map +1 -0
  51. package/lib/module/utils/badgeSelectionStorage.js.map +1 -0
  52. package/lib/module/utils/copySettingsStorage.js.map +1 -0
  53. package/lib/module/utils/correlationUtils.js.map +1 -0
  54. package/lib/module/utils/eventExportFormatter.js +2 -0
  55. package/lib/module/utils/eventExportFormatter.js.map +1 -0
  56. package/lib/module/utils/eventTransformers.js.map +1 -0
  57. package/lib/typescript/components/EventsCopySettingsView.d.ts.map +1 -0
  58. package/lib/typescript/components/EventsModal.d.ts.map +1 -0
  59. package/lib/typescript/components/ReactQueryEventDetail.d.ts.map +1 -0
  60. package/lib/typescript/components/UnifiedEventDetail.d.ts.map +1 -0
  61. package/lib/typescript/components/UnifiedEventFilters.d.ts.map +1 -0
  62. package/lib/typescript/components/UnifiedEventItem.d.ts.map +1 -0
  63. package/lib/typescript/components/UnifiedEventList.d.ts.map +1 -0
  64. package/lib/typescript/components/UnifiedEventViewer.d.ts.map +1 -0
  65. package/lib/typescript/hooks/useUnifiedEvents.d.ts.map +1 -0
  66. package/lib/typescript/index.d.ts.map +1 -0
  67. package/lib/typescript/preset.d.ts.map +1 -0
  68. package/lib/typescript/stores/unifiedEventStore.d.ts +20 -0
  69. package/lib/typescript/stores/unifiedEventStore.d.ts.map +1 -0
  70. package/lib/typescript/types/copySettings.d.ts.map +1 -0
  71. package/lib/typescript/types/index.d.ts +1 -1
  72. package/lib/typescript/types/index.d.ts.map +1 -0
  73. package/lib/typescript/utils/autoDiscoverEventSources.d.ts.map +1 -0
  74. package/lib/typescript/utils/badgeSelectionStorage.d.ts.map +1 -0
  75. package/lib/typescript/utils/copySettingsStorage.d.ts.map +1 -0
  76. package/lib/typescript/utils/correlationUtils.d.ts.map +1 -0
  77. package/lib/typescript/utils/eventExportFormatter.d.ts.map +1 -0
  78. package/lib/typescript/utils/eventTransformers.d.ts.map +1 -0
  79. package/package.json +3 -3
  80. package/src/components/EventsCopySettingsView.tsx +3 -1
  81. package/src/components/ReactQueryEventDetail.tsx +7 -3
  82. package/src/components/UnifiedEventDetail.tsx +79 -1
  83. package/src/components/UnifiedEventItem.tsx +66 -0
  84. package/src/hooks/useUnifiedEvents.ts +28 -0
  85. package/src/stores/unifiedEventStore.ts +54 -0
  86. package/src/types/index.ts +3 -1
  87. package/src/utils/autoDiscoverEventSources.ts +165 -0
  88. package/src/utils/eventExportFormatter.ts +2 -0
@@ -596,6 +596,167 @@ function transformRouteEvent(event: unknown): UnifiedEvent {
596
596
  };
597
597
  }
598
598
 
599
+ // ============================================================================
600
+ // Zustand Event Source Discovery
601
+ // ============================================================================
602
+
603
+ function tryLoadZustandSource(): DiscoveredEventSource | null {
604
+ try {
605
+ // @ts-ignore - Dynamic import that may not exist
606
+ const { zustandStateStore } = require("@buoy-gg/zustand");
607
+
608
+ let lastChangeId: string | null = null;
609
+
610
+ return {
611
+ id: "zustand",
612
+ name: "Zustand",
613
+ eventSources: ["zustand"],
614
+ available: true,
615
+ subscribe: (onEvent) => {
616
+ return zustandStateStore.subscribe((changes: unknown[]) => {
617
+ if (changes.length > 0) {
618
+ const latestChange = changes[0] as { id: string };
619
+ if (latestChange.id !== lastChangeId) {
620
+ lastChangeId = latestChange.id;
621
+ const unifiedEvent = transformZustandChange(latestChange);
622
+ onEvent(unifiedEvent);
623
+ }
624
+ }
625
+ });
626
+ },
627
+ };
628
+ } catch {
629
+ return null;
630
+ }
631
+ }
632
+
633
+ function transformZustandChange(change: unknown): UnifiedEvent {
634
+ const c = change as {
635
+ id: string;
636
+ storeName: string;
637
+ timestamp: number;
638
+ hasStateChange?: boolean;
639
+ category?: "setState" | "replace";
640
+ changedKeys?: string[];
641
+ changedKeysCount?: number;
642
+ diffSummary?: string;
643
+ partialPreview?: string;
644
+ duration?: number;
645
+ isSlowUpdate?: boolean;
646
+ };
647
+
648
+ // Get status
649
+ let status: "success" | "error" | "pending" | "neutral" = "neutral";
650
+ if (c.isSlowUpdate) {
651
+ status = "pending"; // Yellow for slow updates
652
+ } else if (c.hasStateChange) {
653
+ status = "success";
654
+ }
655
+
656
+ // Get subtitle
657
+ const parts: string[] = [];
658
+ if (c.changedKeys && c.changedKeys.length > 0) {
659
+ const keys = c.changedKeys.slice(0, 3).join(", ");
660
+ const more = c.changedKeys.length > 3 ? ` +${c.changedKeys.length - 3}` : "";
661
+ parts.push(`${keys}${more}`);
662
+ } else if (c.diffSummary) {
663
+ parts.push(c.diffSummary);
664
+ }
665
+ if (c.duration !== undefined) {
666
+ parts.push(`${c.duration.toFixed(1)}ms`);
667
+ }
668
+ if (c.category === "replace") {
669
+ parts.push("replace");
670
+ }
671
+
672
+ return {
673
+ id: generateEventId("zustand"),
674
+ source: "zustand",
675
+ timestamp: c.timestamp,
676
+ title: c.storeName,
677
+ subtitle: parts.join(" · ") || (c.hasStateChange ? "state changed" : "no change"),
678
+ status,
679
+ originalEvent: change,
680
+ };
681
+ }
682
+
683
+ // ============================================================================
684
+ // Jotai Event Source Discovery
685
+ // ============================================================================
686
+
687
+ function tryLoadJotaiSource(): DiscoveredEventSource | null {
688
+ try {
689
+ // @ts-ignore - Dynamic import that may not exist
690
+ const { jotaiStateStore } = require("@buoy-gg/jotai");
691
+
692
+ let lastChangeId: string | null = null;
693
+
694
+ return {
695
+ id: "jotai",
696
+ name: "Jotai",
697
+ eventSources: ["jotai"],
698
+ available: true,
699
+ subscribe: (onEvent) => {
700
+ return jotaiStateStore.subscribe((changes: unknown[]) => {
701
+ if (changes.length > 0) {
702
+ const latestChange = changes[0] as { id: string };
703
+ if (latestChange.id !== lastChangeId) {
704
+ lastChangeId = latestChange.id;
705
+ const unifiedEvent = transformJotaiChange(latestChange);
706
+ onEvent(unifiedEvent);
707
+ }
708
+ }
709
+ });
710
+ },
711
+ };
712
+ } catch {
713
+ return null;
714
+ }
715
+ }
716
+
717
+ function transformJotaiChange(change: unknown): UnifiedEvent {
718
+ const c = change as {
719
+ id: string;
720
+ atomLabel: string;
721
+ timestamp: number;
722
+ hasValueChange?: boolean;
723
+ category?: "write" | "read";
724
+ changedKeys?: string[];
725
+ changedKeysCount?: number;
726
+ diffSummary?: string;
727
+ valuePreview?: string;
728
+ };
729
+
730
+ // Get status
731
+ let status: "success" | "error" | "pending" | "neutral" = "neutral";
732
+ if (c.category === "write" && c.hasValueChange) {
733
+ status = "success";
734
+ } else if (c.category === "read") {
735
+ status = "neutral";
736
+ }
737
+
738
+ // Get subtitle
739
+ const parts: string[] = [];
740
+ if (c.valuePreview) {
741
+ parts.push(c.valuePreview);
742
+ } else if (c.diffSummary) {
743
+ parts.push(c.diffSummary);
744
+ }
745
+ if (c.category) {
746
+ parts.push(c.category);
747
+ }
748
+
749
+ return {
750
+ id: generateEventId("jotai"),
751
+ source: "jotai",
752
+ timestamp: c.timestamp,
753
+ title: c.atomLabel,
754
+ subtitle: parts.join(" · ") || (c.hasValueChange ? "value changed" : "no change"),
755
+ status,
756
+ originalEvent: change,
757
+ };
758
+ }
759
+
599
760
  // ============================================================================
600
761
  // Render Events Source Discovery (Highlight Updates)
601
762
  // ============================================================================
@@ -776,6 +937,8 @@ export function autoDiscoverEventSources(): DiscoveryResult {
776
937
  tryLoadNetworkSource,
777
938
  tryLoadReactQuerySource,
778
939
  tryLoadRouteEventsSource,
940
+ tryLoadZustandSource,
941
+ tryLoadJotaiSource,
779
942
  tryLoadHighlightUpdatesSource,
780
943
  ];
781
944
 
@@ -808,6 +971,8 @@ export function getSourceDisplayConfig(source: EventSource): {
808
971
  "react-query-query": { label: "Query", color: "#EC4899", icon: "sync-outline" },
809
972
  "react-query-mutation": { label: "Mutation", color: "#F97316", icon: "flash-outline" },
810
973
  route: { label: "Route", color: "#06B6D4", icon: "navigate-outline" },
974
+ zustand: { label: "Zustand", color: "#764ABC", icon: "cube-outline" },
975
+ jotai: { label: "Jotai", color: "#14B8A6", icon: "ellipse-outline" },
811
976
  render: { label: "Render", color: "#F472B6", icon: "layers-outline" },
812
977
  };
813
978
 
@@ -53,6 +53,8 @@ const SOURCE_LABELS: Record<EventSource, string> = {
53
53
  "react-query-query": "Query",
54
54
  "react-query-mutation": "Mutation",
55
55
  route: "Route",
56
+ zustand: "Zustand",
57
+ jotai: "Jotai",
56
58
  render: "Render",
57
59
  };
58
60