@assistant-ui/react-o11y 0.0.13 → 0.0.15

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 (51) hide show
  1. package/README.md +36 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/context/SpanByIndexProvider.d.ts +7 -3
  4. package/dist/context/SpanByIndexProvider.d.ts.map +1 -1
  5. package/dist/context/SpanByIndexProvider.js +16 -12
  6. package/dist/context/SpanByIndexProvider.js.map +1 -1
  7. package/dist/index.d.ts +5 -6
  8. package/dist/index.js +4 -4
  9. package/dist/o11y-scope.d.ts +36 -35
  10. package/dist/o11y-scope.d.ts.map +1 -1
  11. package/dist/o11y-scope.js +0 -1
  12. package/dist/primitives/span/SpanChildren.d.ts +24 -22
  13. package/dist/primitives/span/SpanChildren.d.ts.map +1 -1
  14. package/dist/primitives/span/SpanChildren.js +32 -27
  15. package/dist/primitives/span/SpanChildren.js.map +1 -1
  16. package/dist/primitives/span/SpanCollapseToggle.d.ts +10 -6
  17. package/dist/primitives/span/SpanCollapseToggle.d.ts.map +1 -1
  18. package/dist/primitives/span/SpanCollapseToggle.js +22 -13
  19. package/dist/primitives/span/SpanCollapseToggle.js.map +1 -1
  20. package/dist/primitives/span/SpanIndent.d.ts +15 -11
  21. package/dist/primitives/span/SpanIndent.d.ts.map +1 -1
  22. package/dist/primitives/span/SpanIndent.js +23 -9
  23. package/dist/primitives/span/SpanIndent.js.map +1 -1
  24. package/dist/primitives/span/SpanName.d.ts +10 -6
  25. package/dist/primitives/span/SpanName.d.ts.map +1 -1
  26. package/dist/primitives/span/SpanName.js +13 -5
  27. package/dist/primitives/span/SpanName.js.map +1 -1
  28. package/dist/primitives/span/SpanRoot.d.ts +10 -6
  29. package/dist/primitives/span/SpanRoot.d.ts.map +1 -1
  30. package/dist/primitives/span/SpanRoot.js +21 -9
  31. package/dist/primitives/span/SpanRoot.js.map +1 -1
  32. package/dist/primitives/span/SpanStatusIndicator.d.ts +10 -6
  33. package/dist/primitives/span/SpanStatusIndicator.d.ts.map +1 -1
  34. package/dist/primitives/span/SpanStatusIndicator.js +13 -5
  35. package/dist/primitives/span/SpanStatusIndicator.js.map +1 -1
  36. package/dist/primitives/span/SpanTypeBadge.d.ts +10 -6
  37. package/dist/primitives/span/SpanTypeBadge.d.ts.map +1 -1
  38. package/dist/primitives/span/SpanTypeBadge.js +14 -5
  39. package/dist/primitives/span/SpanTypeBadge.js.map +1 -1
  40. package/dist/primitives/span.d.ts +14 -7
  41. package/dist/primitives/span.d.ts.map +1 -1
  42. package/dist/primitives/span.js +21 -7
  43. package/dist/primitives/span.js.map +1 -1
  44. package/dist/resources/SpanResource.d.ts +17 -14
  45. package/dist/resources/SpanResource.d.ts.map +1 -1
  46. package/dist/resources/SpanResource.js +127 -129
  47. package/dist/resources/SpanResource.js.map +1 -1
  48. package/package.json +6 -6
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/index.js.map +0 -1
  51. package/dist/o11y-scope.js.map +0 -1
@@ -1,10 +1,18 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, } from "react";
1
+ import { forwardRef } from "react";
3
2
  import { Primitive } from "@radix-ui/react-primitive";
4
3
  import { useAuiState } from "@assistant-ui/store";
5
- export const SpanPrimitiveName = forwardRef((props, ref) => {
6
- const name = useAuiState((s) => s.span.name);
7
- return (_jsx(Primitive.span, { ...props, ref: ref, children: props.children ?? name }));
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/primitives/span/SpanName.tsx
6
+ const SpanPrimitiveName = forwardRef((props, ref) => {
7
+ const name = useAuiState((s) => s.span.name);
8
+ return /* @__PURE__ */ jsx(Primitive.span, {
9
+ ...props,
10
+ ref,
11
+ children: props.children ?? name
12
+ });
8
13
  });
9
14
  SpanPrimitiveName.displayName = "SpanPrimitive.Name";
15
+ //#endregion
16
+ export { SpanPrimitiveName };
17
+
10
18
  //# sourceMappingURL=SpanName.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanName.js","sourceRoot":"","sources":["../../../src/primitives/span/SpanName.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAGzC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7C,OAAO,CACL,KAAC,SAAS,CAAC,IAAI,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,YAChC,KAAK,CAAC,QAAQ,IAAI,IAAI,GACR,CAClB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC"}
1
+ {"version":3,"file":"SpanName.js","names":[],"sources":["../../../src/primitives/span/SpanName.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SpanPrimitiveName {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const SpanPrimitiveName = forwardRef<\n SpanPrimitiveName.Element,\n SpanPrimitiveName.Props\n>((props, ref) => {\n const name = useAuiState((s) => s.span.name);\n\n return (\n <Primitive.span {...props} ref={ref}>\n {props.children ?? name}\n </Primitive.span>\n );\n});\n\nSpanPrimitiveName.displayName = \"SpanPrimitive.Name\";\n"],"mappings":";;;;;AAaA,MAAa,oBAAoB,YAG9B,OAAO,QAAQ;CAChB,MAAM,OAAO,aAAa,MAAM,EAAE,KAAK,IAAI;CAE3C,OACE,oBAAC,UAAU,MAAX;EAAgB,GAAI;EAAY;YAC7B,MAAM,YAAY;CACL,CAAA;AAEpB,CAAC;AAED,kBAAkB,cAAc"}
@@ -1,10 +1,14 @@
1
- import { type ComponentPropsWithoutRef, type ComponentRef } from "react";
1
+ import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
- export declare namespace SpanPrimitiveRoot {
4
- type Element = ComponentRef<typeof Primitive.div>;
5
- type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
3
+
4
+ //#region src/primitives/span/SpanRoot.d.ts
5
+ declare namespace SpanPrimitiveRoot {
6
+ type Element = ComponentRef<typeof Primitive.div>;
7
+ type Props = ComponentPropsWithoutRef<typeof Primitive.div>;
6
8
  }
7
- export declare const SpanPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
8
- asChild?: boolean;
9
+ declare const SpanPrimitiveRoot: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
10
+ asChild?: boolean;
9
11
  }, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
12
+ //#endregion
13
+ export { SpanPrimitiveRoot };
10
14
  //# sourceMappingURL=SpanRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/span/SpanRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtD,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED,eAAO,MAAM,iBAAiB;;0DAqB5B,CAAC"}
1
+ {"version":3,"file":"SpanRoot.d.ts","names":[],"sources":["../../../src/primitives/span/SpanRoot.tsx"],"mappings":";;;;kBAQiB,iBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,GAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,GAAA;AAAA;AAAA,cAGnD,iBAAA,kBAAiB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,cAAA,oBAAA,cAAA,CAAA,cAAA"}
@@ -1,14 +1,26 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, } from "react";
1
+ import { forwardRef } from "react";
3
2
  import { Primitive } from "@radix-ui/react-primitive";
4
3
  import { useAuiState } from "@assistant-ui/store";
5
- export const SpanPrimitiveRoot = forwardRef((props, ref) => {
6
- const spanId = useAuiState((s) => s.span.id);
7
- const status = useAuiState((s) => s.span.status);
8
- const type = useAuiState((s) => s.span.type);
9
- const depth = useAuiState((s) => s.span.depth);
10
- const isCollapsed = useAuiState((s) => s.span.isCollapsed);
11
- return (_jsx(Primitive.div, { ...props, ref: ref, "data-span-id": spanId, "data-span-status": status, "data-span-type": type, "data-span-depth": depth, "data-collapsed": isCollapsed }));
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/primitives/span/SpanRoot.tsx
6
+ const SpanPrimitiveRoot = forwardRef((props, ref) => {
7
+ const spanId = useAuiState((s) => s.span.id);
8
+ const status = useAuiState((s) => s.span.status);
9
+ const type = useAuiState((s) => s.span.type);
10
+ const depth = useAuiState((s) => s.span.depth);
11
+ const isCollapsed = useAuiState((s) => s.span.isCollapsed);
12
+ return /* @__PURE__ */ jsx(Primitive.div, {
13
+ ...props,
14
+ ref,
15
+ "data-span-id": spanId,
16
+ "data-span-status": status,
17
+ "data-span-type": type,
18
+ "data-span-depth": depth,
19
+ "data-collapsed": isCollapsed
20
+ });
12
21
  });
13
22
  SpanPrimitiveRoot.displayName = "SpanPrimitive.Root";
23
+ //#endregion
24
+ export { SpanPrimitiveRoot };
25
+
14
26
  //# sourceMappingURL=SpanRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanRoot.js","sourceRoot":"","sources":["../../../src/primitives/span/SpanRoot.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAGzC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAE3D,OAAO,CACL,KAAC,SAAS,CAAC,GAAG,OACR,KAAK,EACT,GAAG,EAAE,GAAG,kBACM,MAAM,sBACF,MAAM,oBACR,IAAI,qBACH,KAAK,oBACN,WAAW,GAC3B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC"}
1
+ {"version":3,"file":"SpanRoot.js","names":[],"sources":["../../../src/primitives/span/SpanRoot.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SpanPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\nexport const SpanPrimitiveRoot = forwardRef<\n SpanPrimitiveRoot.Element,\n SpanPrimitiveRoot.Props\n>((props, ref) => {\n const spanId = useAuiState((s) => s.span.id);\n const status = useAuiState((s) => s.span.status);\n const type = useAuiState((s) => s.span.type);\n const depth = useAuiState((s) => s.span.depth);\n const isCollapsed = useAuiState((s) => s.span.isCollapsed);\n\n return (\n <Primitive.div\n {...props}\n ref={ref}\n data-span-id={spanId}\n data-span-status={status}\n data-span-type={type}\n data-span-depth={depth}\n data-collapsed={isCollapsed}\n />\n );\n});\n\nSpanPrimitiveRoot.displayName = \"SpanPrimitive.Root\";\n"],"mappings":";;;;;AAaA,MAAa,oBAAoB,YAG9B,OAAO,QAAQ;CAChB,MAAM,SAAS,aAAa,MAAM,EAAE,KAAK,EAAE;CAC3C,MAAM,SAAS,aAAa,MAAM,EAAE,KAAK,MAAM;CAC/C,MAAM,OAAO,aAAa,MAAM,EAAE,KAAK,IAAI;CAC3C,MAAM,QAAQ,aAAa,MAAM,EAAE,KAAK,KAAK;CAC7C,MAAM,cAAc,aAAa,MAAM,EAAE,KAAK,WAAW;CAEzD,OACE,oBAAC,UAAU,KAAX;EACE,GAAI;EACC;EACL,gBAAc;EACd,oBAAkB;EAClB,kBAAgB;EAChB,mBAAiB;EACjB,kBAAgB;CACjB,CAAA;AAEL,CAAC;AAED,kBAAkB,cAAc"}
@@ -1,10 +1,14 @@
1
- import { type ComponentPropsWithoutRef, type ComponentRef } from "react";
1
+ import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
- export declare namespace SpanPrimitiveStatusIndicator {
4
- type Element = ComponentRef<typeof Primitive.span>;
5
- type Props = ComponentPropsWithoutRef<typeof Primitive.span>;
3
+
4
+ //#region src/primitives/span/SpanStatusIndicator.d.ts
5
+ declare namespace SpanPrimitiveStatusIndicator {
6
+ type Element = ComponentRef<typeof Primitive.span>;
7
+ type Props = ComponentPropsWithoutRef<typeof Primitive.span>;
6
8
  }
7
- export declare const SpanPrimitiveStatusIndicator: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
8
- asChild?: boolean;
9
+ declare const SpanPrimitiveStatusIndicator: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
10
+ asChild?: boolean;
9
11
  }, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
12
+ //#endregion
13
+ export { SpanPrimitiveStatusIndicator };
10
14
  //# sourceMappingURL=SpanStatusIndicator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanStatusIndicator.d.ts","sourceRoot":"","sources":["../../../src/primitives/span/SpanStatusIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtD,yBAAiB,4BAA4B,CAAC;IAC5C,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;CACrE;AAED,eAAO,MAAM,4BAA4B;;2DAOvC,CAAC"}
1
+ {"version":3,"file":"SpanStatusIndicator.d.ts","names":[],"sources":["../../../src/primitives/span/SpanStatusIndicator.tsx"],"mappings":";;;;kBAQiB,4BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,IAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,IAAA;AAAA;AAAA,cAGnD,4BAAA,kBAA4B,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,eAAA,oBAAA,cAAA,CAAA,eAAA"}
@@ -1,10 +1,18 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, } from "react";
1
+ import { forwardRef } from "react";
3
2
  import { Primitive } from "@radix-ui/react-primitive";
4
3
  import { useAuiState } from "@assistant-ui/store";
5
- export const SpanPrimitiveStatusIndicator = forwardRef((props, ref) => {
6
- const status = useAuiState((s) => s.span.status);
7
- return _jsx(Primitive.span, { ...props, ref: ref, "data-span-status": status });
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/primitives/span/SpanStatusIndicator.tsx
6
+ const SpanPrimitiveStatusIndicator = forwardRef((props, ref) => {
7
+ const status = useAuiState((s) => s.span.status);
8
+ return /* @__PURE__ */ jsx(Primitive.span, {
9
+ ...props,
10
+ ref,
11
+ "data-span-status": status
12
+ });
8
13
  });
9
14
  SpanPrimitiveStatusIndicator.displayName = "SpanPrimitive.StatusIndicator";
15
+ //#endregion
16
+ export { SpanPrimitiveStatusIndicator };
17
+
10
18
  //# sourceMappingURL=SpanStatusIndicator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanStatusIndicator.js","sourceRoot":"","sources":["../../../src/primitives/span/SpanStatusIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAGpD,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEjD,OAAO,KAAC,SAAS,CAAC,IAAI,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,sBAAoB,MAAM,GAAI,CAAC;AAC3E,CAAC,CAAC,CAAC;AAEH,4BAA4B,CAAC,WAAW,GAAG,+BAA+B,CAAC"}
1
+ {"version":3,"file":"SpanStatusIndicator.js","names":[],"sources":["../../../src/primitives/span/SpanStatusIndicator.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SpanPrimitiveStatusIndicator {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const SpanPrimitiveStatusIndicator = forwardRef<\n SpanPrimitiveStatusIndicator.Element,\n SpanPrimitiveStatusIndicator.Props\n>((props, ref) => {\n const status = useAuiState((s) => s.span.status);\n\n return <Primitive.span {...props} ref={ref} data-span-status={status} />;\n});\n\nSpanPrimitiveStatusIndicator.displayName = \"SpanPrimitive.StatusIndicator\";\n"],"mappings":";;;;;AAaA,MAAa,+BAA+B,YAGzC,OAAO,QAAQ;CAChB,MAAM,SAAS,aAAa,MAAM,EAAE,KAAK,MAAM;CAE/C,OAAO,oBAAC,UAAU,MAAX;EAAgB,GAAI;EAAY;EAAK,oBAAkB;CAAS,CAAA;AACzE,CAAC;AAED,6BAA6B,cAAc"}
@@ -1,10 +1,14 @@
1
- import { type ComponentPropsWithoutRef, type ComponentRef } from "react";
1
+ import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
- export declare namespace SpanPrimitiveTypeBadge {
4
- type Element = ComponentRef<typeof Primitive.span>;
5
- type Props = ComponentPropsWithoutRef<typeof Primitive.span>;
3
+
4
+ //#region src/primitives/span/SpanTypeBadge.d.ts
5
+ declare namespace SpanPrimitiveTypeBadge {
6
+ type Element = ComponentRef<typeof Primitive.span>;
7
+ type Props = ComponentPropsWithoutRef<typeof Primitive.span>;
6
8
  }
7
- export declare const SpanPrimitiveTypeBadge: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
8
- asChild?: boolean;
9
+ declare const SpanPrimitiveTypeBadge: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
10
+ asChild?: boolean;
9
11
  }, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
12
+ //#endregion
13
+ export { SpanPrimitiveTypeBadge };
10
14
  //# sourceMappingURL=SpanTypeBadge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanTypeBadge.d.ts","sourceRoot":"","sources":["../../../src/primitives/span/SpanTypeBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAElB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtD,yBAAiB,sBAAsB,CAAC;IACtC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1D,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;CACrE;AAED,eAAO,MAAM,sBAAsB;;2DAWjC,CAAC"}
1
+ {"version":3,"file":"SpanTypeBadge.d.ts","names":[],"sources":["../../../src/primitives/span/SpanTypeBadge.tsx"],"mappings":";;;;kBAQiB,sBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,IAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,IAAA;AAAA;AAAA,cAGnD,sBAAA,kBAAsB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,eAAA,oBAAA,cAAA,CAAA,eAAA"}
@@ -1,10 +1,19 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, } from "react";
1
+ import { forwardRef } from "react";
3
2
  import { Primitive } from "@radix-ui/react-primitive";
4
3
  import { useAuiState } from "@assistant-ui/store";
5
- export const SpanPrimitiveTypeBadge = forwardRef((props, ref) => {
6
- const type = useAuiState((s) => s.span.type);
7
- return (_jsx(Primitive.span, { ...props, ref: ref, "data-span-type": type, children: props.children ?? type }));
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/primitives/span/SpanTypeBadge.tsx
6
+ const SpanPrimitiveTypeBadge = forwardRef((props, ref) => {
7
+ const type = useAuiState((s) => s.span.type);
8
+ return /* @__PURE__ */ jsx(Primitive.span, {
9
+ ...props,
10
+ ref,
11
+ "data-span-type": type,
12
+ children: props.children ?? type
13
+ });
8
14
  });
9
15
  SpanPrimitiveTypeBadge.displayName = "SpanPrimitive.TypeBadge";
16
+ //#endregion
17
+ export { SpanPrimitiveTypeBadge };
18
+
10
19
  //# sourceMappingURL=SpanTypeBadge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanTypeBadge.js","sourceRoot":"","sources":["../../../src/primitives/span/SpanTypeBadge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,UAAU,GACX,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAG9C,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7C,OAAO,CACL,KAAC,SAAS,CAAC,IAAI,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,oBAAkB,IAAI,YACtD,KAAK,CAAC,QAAQ,IAAI,IAAI,GACR,CAClB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,sBAAsB,CAAC,WAAW,GAAG,yBAAyB,CAAC"}
1
+ {"version":3,"file":"SpanTypeBadge.js","names":[],"sources":["../../../src/primitives/span/SpanTypeBadge.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport namespace SpanPrimitiveTypeBadge {\n export type Element = ComponentRef<typeof Primitive.span>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.span>;\n}\n\nexport const SpanPrimitiveTypeBadge = forwardRef<\n SpanPrimitiveTypeBadge.Element,\n SpanPrimitiveTypeBadge.Props\n>((props, ref) => {\n const type = useAuiState((s) => s.span.type);\n\n return (\n <Primitive.span {...props} ref={ref} data-span-type={type}>\n {props.children ?? type}\n </Primitive.span>\n );\n});\n\nSpanPrimitiveTypeBadge.displayName = \"SpanPrimitive.TypeBadge\";\n"],"mappings":";;;;;AAaA,MAAa,yBAAyB,YAGnC,OAAO,QAAQ;CAChB,MAAM,OAAO,aAAa,MAAM,EAAE,KAAK,IAAI;CAE3C,OACE,oBAAC,UAAU,MAAX;EAAgB,GAAI;EAAY;EAAK,kBAAgB;YAClD,MAAM,YAAY;CACL,CAAA;AAEpB,CAAC;AAED,uBAAuB,cAAc"}
@@ -1,8 +1,15 @@
1
- export { SpanPrimitiveRoot as Root } from "./span/SpanRoot.js";
2
- export { SpanPrimitiveName as Name } from "./span/SpanName.js";
3
- export { SpanPrimitiveTypeBadge as TypeBadge } from "./span/SpanTypeBadge.js";
4
- export { SpanPrimitiveStatusIndicator as StatusIndicator } from "./span/SpanStatusIndicator.js";
5
- export { SpanPrimitiveCollapseToggle as CollapseToggle } from "./span/SpanCollapseToggle.js";
6
- export { SpanPrimitiveIndent as Indent } from "./span/SpanIndent.js";
7
- export { SpanPrimitiveChildren as Children } from "./span/SpanChildren.js";
1
+ import { SpanPrimitiveRoot } from "./span/SpanRoot.js";
2
+ import { SpanPrimitiveName } from "./span/SpanName.js";
3
+ import { SpanPrimitiveTypeBadge } from "./span/SpanTypeBadge.js";
4
+ import { SpanPrimitiveStatusIndicator } from "./span/SpanStatusIndicator.js";
5
+ import { SpanPrimitiveCollapseToggle } from "./span/SpanCollapseToggle.js";
6
+ import { SpanPrimitiveIndent } from "./span/SpanIndent.js";
7
+ import { SpanPrimitiveChildren } from "./span/SpanChildren.js";
8
+
9
+ //#region src/primitives/span.d.ts
10
+ declare namespace span_d_exports {
11
+ export { SpanPrimitiveChildren as Children, SpanPrimitiveCollapseToggle as CollapseToggle, SpanPrimitiveIndent as Indent, SpanPrimitiveName as Name, SpanPrimitiveRoot as Root, SpanPrimitiveStatusIndicator as StatusIndicator, SpanPrimitiveTypeBadge as TypeBadge };
12
+ }
13
+ //#endregion
14
+ export { SpanPrimitiveChildren as Children, SpanPrimitiveCollapseToggle as CollapseToggle, SpanPrimitiveIndent as Indent, SpanPrimitiveName as Name, SpanPrimitiveRoot as Root, SpanPrimitiveStatusIndicator as StatusIndicator, SpanPrimitiveTypeBadge as TypeBadge, span_d_exports };
8
15
  //# sourceMappingURL=span.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"span.d.ts","sourceRoot":"","sources":["../../src/primitives/span.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,IAAI,EAAE,2BAAwB;AAC5D,OAAO,EAAE,iBAAiB,IAAI,IAAI,EAAE,2BAAwB;AAC5D,OAAO,EAAE,sBAAsB,IAAI,SAAS,EAAE,gCAA6B;AAC3E,OAAO,EAAE,4BAA4B,IAAI,eAAe,EAAE,sCAAmC;AAC7F,OAAO,EAAE,2BAA2B,IAAI,cAAc,EAAE,qCAAkC;AAC1F,OAAO,EAAE,mBAAmB,IAAI,MAAM,EAAE,6BAA0B;AAClE,OAAO,EAAE,qBAAqB,IAAI,QAAQ,EAAE,+BAA4B"}
1
+ {"version":3,"file":"span.d.ts","names":[],"sources":["../../src/primitives/span.ts"],"mappings":""}
@@ -1,8 +1,22 @@
1
- export { SpanPrimitiveRoot as Root } from "./span/SpanRoot.js";
2
- export { SpanPrimitiveName as Name } from "./span/SpanName.js";
3
- export { SpanPrimitiveTypeBadge as TypeBadge } from "./span/SpanTypeBadge.js";
4
- export { SpanPrimitiveStatusIndicator as StatusIndicator } from "./span/SpanStatusIndicator.js";
5
- export { SpanPrimitiveCollapseToggle as CollapseToggle } from "./span/SpanCollapseToggle.js";
6
- export { SpanPrimitiveIndent as Indent } from "./span/SpanIndent.js";
7
- export { SpanPrimitiveChildren as Children } from "./span/SpanChildren.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { SpanPrimitiveRoot } from "./span/SpanRoot.js";
3
+ import { SpanPrimitiveName } from "./span/SpanName.js";
4
+ import { SpanPrimitiveTypeBadge } from "./span/SpanTypeBadge.js";
5
+ import { SpanPrimitiveStatusIndicator } from "./span/SpanStatusIndicator.js";
6
+ import { SpanPrimitiveCollapseToggle } from "./span/SpanCollapseToggle.js";
7
+ import { SpanPrimitiveIndent } from "./span/SpanIndent.js";
8
+ import { SpanPrimitiveChildren } from "./span/SpanChildren.js";
9
+ //#region src/primitives/span.ts
10
+ var span_exports = /* @__PURE__ */ __exportAll({
11
+ Children: () => SpanPrimitiveChildren,
12
+ CollapseToggle: () => SpanPrimitiveCollapseToggle,
13
+ Indent: () => SpanPrimitiveIndent,
14
+ Name: () => SpanPrimitiveName,
15
+ Root: () => SpanPrimitiveRoot,
16
+ StatusIndicator: () => SpanPrimitiveStatusIndicator,
17
+ TypeBadge: () => SpanPrimitiveTypeBadge
18
+ });
19
+ //#endregion
20
+ export { SpanPrimitiveChildren as Children, SpanPrimitiveCollapseToggle as CollapseToggle, SpanPrimitiveIndent as Indent, SpanPrimitiveName as Name, SpanPrimitiveRoot as Root, SpanPrimitiveStatusIndicator as StatusIndicator, SpanPrimitiveTypeBadge as TypeBadge, span_exports };
21
+
8
22
  //# sourceMappingURL=span.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"span.js","sourceRoot":"","sources":["../../src/primitives/span.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,IAAI,IAAI,EAAE,2BAAwB;AAC5D,OAAO,EAAE,iBAAiB,IAAI,IAAI,EAAE,2BAAwB;AAC5D,OAAO,EAAE,sBAAsB,IAAI,SAAS,EAAE,gCAA6B;AAC3E,OAAO,EAAE,4BAA4B,IAAI,eAAe,EAAE,sCAAmC;AAC7F,OAAO,EAAE,2BAA2B,IAAI,cAAc,EAAE,qCAAkC;AAC1F,OAAO,EAAE,mBAAmB,IAAI,MAAM,EAAE,6BAA0B;AAClE,OAAO,EAAE,qBAAqB,IAAI,QAAQ,EAAE,+BAA4B"}
1
+ {"version":3,"file":"span.js","names":[],"sources":["../../src/primitives/span.ts"],"sourcesContent":["export { SpanPrimitiveRoot as Root } from \"./span/SpanRoot\";\nexport { SpanPrimitiveName as Name } from \"./span/SpanName\";\nexport { SpanPrimitiveTypeBadge as TypeBadge } from \"./span/SpanTypeBadge\";\nexport { SpanPrimitiveStatusIndicator as StatusIndicator } from \"./span/SpanStatusIndicator\";\nexport { SpanPrimitiveCollapseToggle as CollapseToggle } from \"./span/SpanCollapseToggle\";\nexport { SpanPrimitiveIndent as Indent } from \"./span/SpanIndent\";\nexport { SpanPrimitiveChildren as Children } from \"./span/SpanChildren\";\n"],"mappings":""}
@@ -1,18 +1,21 @@
1
- import "../o11y-scope.js";
2
- import { type ClientOutput } from "@assistant-ui/store";
3
- export type SpanData = {
4
- id: string;
5
- parentSpanId: string | null;
6
- name: string;
7
- type: string;
8
- status: "running" | "completed" | "failed" | "skipped";
9
- startedAt: number;
10
- endedAt: number | null;
11
- latencyMs: number | null;
1
+ import { ClientOutput } from "@assistant-ui/store";
2
+
3
+ //#region src/resources/SpanResource.d.ts
4
+ type SpanData = {
5
+ id: string;
6
+ parentSpanId: string | null;
7
+ name: string;
8
+ type: string;
9
+ status: "running" | "completed" | "failed" | "skipped";
10
+ startedAt: number;
11
+ endedAt: number | null;
12
+ latencyMs: number | null;
12
13
  };
13
- export declare const SpanResource: (props: {
14
- spans: SpanData[];
14
+ declare const SpanResource: (props: {
15
+ spans: SpanData[];
15
16
  }) => import("@assistant-ui/tap").ResourceElement<ClientOutput<"span">, {
16
- spans: SpanData[];
17
+ spans: SpanData[];
17
18
  }>;
19
+ //#endregion
20
+ export { SpanData, SpanResource };
18
21
  //# sourceMappingURL=SpanResource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpanResource.d.ts","sourceRoot":"","sources":["../../src/resources/SpanResource.tsx"],"names":[],"mappings":"AAAA,0BAAuB;AAGvB,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGzE,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AA2HF,eAAO,MAAM,YAAY;WACF,QAAQ,EAAE;;WAAV,QAAQ,EAAE;EA+DhC,CAAC"}
1
+ {"version":3,"file":"SpanResource.d.ts","names":[],"sources":["../../src/resources/SpanResource.tsx"],"mappings":";;;KAMY,QAAA;EACV,EAAA;EACA,YAAA;EACA,IAAA;EACA,IAAA;EACA,MAAA;EACA,SAAA;EACA,OAAA;EACA,SAAA;AAAA;AAAA,cA4HW,YAAA,GAAY,KAAA;SACF,QAAA;AAAA;SAAA,QAAA;AAAA"}
@@ -1,139 +1,137 @@
1
- import "../o11y-scope.js";
2
- import { resource, tapMemo, tapState, withKey } from "@assistant-ui/tap";
3
1
  import { tapClientLookup } from "@assistant-ui/store";
2
+ import { resource, tapMemo, tapState, withKey } from "@assistant-ui/tap";
3
+ //#region src/resources/SpanResource.tsx
4
4
  function calculateDepth(spanId, spanMap, cache) {
5
- const cached = cache.get(spanId);
6
- if (cached !== undefined)
7
- return cached;
8
- const span = spanMap.get(spanId);
9
- if (!span?.parentSpanId) {
10
- cache.set(spanId, 0);
11
- return 0;
12
- }
13
- const depth = calculateDepth(span.parentSpanId, spanMap, cache) + 1;
14
- cache.set(spanId, depth);
15
- return depth;
5
+ const cached = cache.get(spanId);
6
+ if (cached !== void 0) return cached;
7
+ const span = spanMap.get(spanId);
8
+ if (!span?.parentSpanId) {
9
+ cache.set(spanId, 0);
10
+ return 0;
11
+ }
12
+ const depth = calculateDepth(span.parentSpanId, spanMap, cache) + 1;
13
+ cache.set(spanId, depth);
14
+ return depth;
16
15
  }
17
16
  function enrichSpans(rawSpans) {
18
- const spanMap = new Map();
19
- for (const span of rawSpans) {
20
- spanMap.set(span.id, span);
21
- }
22
- const depthCache = new Map();
23
- const childrenCount = new Map();
24
- for (const span of rawSpans) {
25
- if (span.parentSpanId) {
26
- childrenCount.set(span.parentSpanId, (childrenCount.get(span.parentSpanId) ?? 0) + 1);
27
- }
28
- }
29
- const allSpans = new Map();
30
- let min = Infinity;
31
- let max = -Infinity;
32
- for (const span of rawSpans) {
33
- const depth = calculateDepth(span.id, spanMap, depthCache);
34
- const hasChildren = (childrenCount.get(span.id) ?? 0) > 0;
35
- allSpans.set(span.id, { ...span, depth, hasChildren, isCollapsed: false });
36
- if (span.startedAt < min)
37
- min = span.startedAt;
38
- const end = span.endedAt ?? Date.now();
39
- if (end > max)
40
- max = end;
41
- }
42
- if (min === Infinity)
43
- min = Date.now();
44
- if (max === -Infinity)
45
- max = Date.now();
46
- if (max === min)
47
- max = min + 100;
48
- return { allSpans, timeRange: { min, max } };
17
+ const spanMap = /* @__PURE__ */ new Map();
18
+ for (const span of rawSpans) spanMap.set(span.id, span);
19
+ const depthCache = /* @__PURE__ */ new Map();
20
+ const childrenCount = /* @__PURE__ */ new Map();
21
+ for (const span of rawSpans) if (span.parentSpanId) childrenCount.set(span.parentSpanId, (childrenCount.get(span.parentSpanId) ?? 0) + 1);
22
+ const allSpans = /* @__PURE__ */ new Map();
23
+ let min = Infinity;
24
+ let max = -Infinity;
25
+ for (const span of rawSpans) {
26
+ const depth = calculateDepth(span.id, spanMap, depthCache);
27
+ const hasChildren = (childrenCount.get(span.id) ?? 0) > 0;
28
+ allSpans.set(span.id, {
29
+ ...span,
30
+ depth,
31
+ hasChildren,
32
+ isCollapsed: false
33
+ });
34
+ if (span.startedAt < min) min = span.startedAt;
35
+ const end = span.endedAt ?? Date.now();
36
+ if (end > max) max = end;
37
+ }
38
+ if (min === Infinity) min = Date.now();
39
+ if (max === -Infinity) max = Date.now();
40
+ if (max === min) max = min + 100;
41
+ return {
42
+ allSpans,
43
+ timeRange: {
44
+ min,
45
+ max
46
+ }
47
+ };
49
48
  }
50
49
  function buildFlatList(allSpans, collapsedIds) {
51
- const children = new Map();
52
- for (const span of allSpans.values()) {
53
- const parent = span.parentSpanId ?? null;
54
- let group = children.get(parent);
55
- if (!group) {
56
- group = [];
57
- children.set(parent, group);
58
- }
59
- group.push(span);
60
- }
61
- for (const group of children.values()) {
62
- group.sort((a, b) => a.startedAt - b.startedAt);
63
- }
64
- const result = [];
65
- function dfs(parentId) {
66
- const kids = children.get(parentId);
67
- if (!kids)
68
- return;
69
- for (const span of kids) {
70
- result.push({ ...span, isCollapsed: collapsedIds.has(span.id) });
71
- if (!collapsedIds.has(span.id)) {
72
- dfs(span.id);
73
- }
74
- }
75
- }
76
- dfs(null);
77
- return result;
50
+ const children = /* @__PURE__ */ new Map();
51
+ for (const span of allSpans.values()) {
52
+ const parent = span.parentSpanId ?? null;
53
+ let group = children.get(parent);
54
+ if (!group) {
55
+ group = [];
56
+ children.set(parent, group);
57
+ }
58
+ group.push(span);
59
+ }
60
+ for (const group of children.values()) group.sort((a, b) => a.startedAt - b.startedAt);
61
+ const result = [];
62
+ function dfs(parentId) {
63
+ const kids = children.get(parentId);
64
+ if (!kids) return;
65
+ for (const span of kids) {
66
+ result.push({
67
+ ...span,
68
+ isCollapsed: collapsedIds.has(span.id)
69
+ });
70
+ if (!collapsedIds.has(span.id)) dfs(span.id);
71
+ }
72
+ }
73
+ dfs(null);
74
+ return result;
78
75
  }
79
- const SpanChildResource = resource(({ span, timeRange, onToggleCollapse, }) => {
80
- const state = {
81
- ...span,
82
- children: [],
83
- timeRange,
84
- };
85
- return {
86
- getState: () => state,
87
- child: () => {
88
- throw new Error("child spans do not have children in flat mode");
89
- },
90
- toggleCollapse: () => {
91
- onToggleCollapse(span.id);
92
- },
93
- };
76
+ const SpanChildResource = resource(({ span, timeRange, onToggleCollapse }) => {
77
+ const state = {
78
+ ...span,
79
+ children: [],
80
+ timeRange
81
+ };
82
+ return {
83
+ getState: () => state,
84
+ child: () => {
85
+ throw new Error("child spans do not have children in flat mode");
86
+ },
87
+ toggleCollapse: () => {
88
+ onToggleCollapse(span.id);
89
+ }
90
+ };
94
91
  });
95
- export const SpanResource = resource(({ spans }) => {
96
- const { allSpans, timeRange } = tapMemo(() => enrichSpans(spans), [spans]);
97
- const [collapsedIds, setCollapsedIds] = tapState(() => new Set());
98
- const visibleSpans = tapMemo(() => buildFlatList(allSpans, collapsedIds), [allSpans, collapsedIds]);
99
- const toggleCollapse = (spanId) => {
100
- setCollapsedIds((prev) => {
101
- const next = new Set(prev);
102
- if (next.has(spanId)) {
103
- next.delete(spanId);
104
- }
105
- else {
106
- next.add(spanId);
107
- }
108
- return next;
109
- });
110
- };
111
- const lookup = tapClientLookup(() => visibleSpans.map((span) => withKey(span.id, SpanChildResource({
112
- span,
113
- timeRange,
114
- onToggleCollapse: toggleCollapse,
115
- }))), [visibleSpans, timeRange, toggleCollapse]);
116
- const rootState = {
117
- id: "__root__",
118
- parentSpanId: null,
119
- name: "",
120
- type: "root",
121
- status: "completed",
122
- startedAt: timeRange.min,
123
- endedAt: timeRange.max,
124
- latencyMs: timeRange.max - timeRange.min,
125
- depth: -1,
126
- hasChildren: lookup.state.length > 0,
127
- isCollapsed: false,
128
- children: lookup.state,
129
- timeRange,
130
- };
131
- return {
132
- getState: () => rootState,
133
- child: lookup.get,
134
- toggleCollapse: () => {
135
- // Root span collapse is a no-op
136
- },
137
- };
92
+ const SpanResource = resource(({ spans }) => {
93
+ const { allSpans, timeRange } = tapMemo(() => enrichSpans(spans), [spans]);
94
+ const [collapsedIds, setCollapsedIds] = tapState(() => /* @__PURE__ */ new Set());
95
+ const visibleSpans = tapMemo(() => buildFlatList(allSpans, collapsedIds), [allSpans, collapsedIds]);
96
+ const toggleCollapse = (spanId) => {
97
+ setCollapsedIds((prev) => {
98
+ const next = new Set(prev);
99
+ if (next.has(spanId)) next.delete(spanId);
100
+ else next.add(spanId);
101
+ return next;
102
+ });
103
+ };
104
+ const lookup = tapClientLookup(() => visibleSpans.map((span) => withKey(span.id, SpanChildResource({
105
+ span,
106
+ timeRange,
107
+ onToggleCollapse: toggleCollapse
108
+ }))), [
109
+ visibleSpans,
110
+ timeRange,
111
+ toggleCollapse
112
+ ]);
113
+ const rootState = {
114
+ id: "__root__",
115
+ parentSpanId: null,
116
+ name: "",
117
+ type: "root",
118
+ status: "completed",
119
+ startedAt: timeRange.min,
120
+ endedAt: timeRange.max,
121
+ latencyMs: timeRange.max - timeRange.min,
122
+ depth: -1,
123
+ hasChildren: lookup.state.length > 0,
124
+ isCollapsed: false,
125
+ children: lookup.state,
126
+ timeRange
127
+ };
128
+ return {
129
+ getState: () => rootState,
130
+ child: lookup.get,
131
+ toggleCollapse: () => {}
132
+ };
138
133
  });
134
+ //#endregion
135
+ export { SpanResource };
136
+
139
137
  //# sourceMappingURL=SpanResource.js.map