@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.
- package/README.md +36 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/context/SpanByIndexProvider.d.ts +7 -3
- package/dist/context/SpanByIndexProvider.d.ts.map +1 -1
- package/dist/context/SpanByIndexProvider.js +16 -12
- package/dist/context/SpanByIndexProvider.js.map +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/index.js +4 -4
- package/dist/o11y-scope.d.ts +36 -35
- package/dist/o11y-scope.d.ts.map +1 -1
- package/dist/o11y-scope.js +0 -1
- package/dist/primitives/span/SpanChildren.d.ts +24 -22
- package/dist/primitives/span/SpanChildren.d.ts.map +1 -1
- package/dist/primitives/span/SpanChildren.js +32 -27
- package/dist/primitives/span/SpanChildren.js.map +1 -1
- package/dist/primitives/span/SpanCollapseToggle.d.ts +10 -6
- package/dist/primitives/span/SpanCollapseToggle.d.ts.map +1 -1
- package/dist/primitives/span/SpanCollapseToggle.js +22 -13
- package/dist/primitives/span/SpanCollapseToggle.js.map +1 -1
- package/dist/primitives/span/SpanIndent.d.ts +15 -11
- package/dist/primitives/span/SpanIndent.d.ts.map +1 -1
- package/dist/primitives/span/SpanIndent.js +23 -9
- package/dist/primitives/span/SpanIndent.js.map +1 -1
- package/dist/primitives/span/SpanName.d.ts +10 -6
- package/dist/primitives/span/SpanName.d.ts.map +1 -1
- package/dist/primitives/span/SpanName.js +13 -5
- package/dist/primitives/span/SpanName.js.map +1 -1
- package/dist/primitives/span/SpanRoot.d.ts +10 -6
- package/dist/primitives/span/SpanRoot.d.ts.map +1 -1
- package/dist/primitives/span/SpanRoot.js +21 -9
- package/dist/primitives/span/SpanRoot.js.map +1 -1
- package/dist/primitives/span/SpanStatusIndicator.d.ts +10 -6
- package/dist/primitives/span/SpanStatusIndicator.d.ts.map +1 -1
- package/dist/primitives/span/SpanStatusIndicator.js +13 -5
- package/dist/primitives/span/SpanStatusIndicator.js.map +1 -1
- package/dist/primitives/span/SpanTypeBadge.d.ts +10 -6
- package/dist/primitives/span/SpanTypeBadge.d.ts.map +1 -1
- package/dist/primitives/span/SpanTypeBadge.js +14 -5
- package/dist/primitives/span/SpanTypeBadge.js.map +1 -1
- package/dist/primitives/span.d.ts +14 -7
- package/dist/primitives/span.d.ts.map +1 -1
- package/dist/primitives/span.js +21 -7
- package/dist/primitives/span.js.map +1 -1
- package/dist/resources/SpanResource.d.ts +17 -14
- package/dist/resources/SpanResource.d.ts.map +1 -1
- package/dist/resources/SpanResource.js +127 -129
- package/dist/resources/SpanResource.js.map +1 -1
- package/package.json +6 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/o11y-scope.js.map +0 -1
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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","
|
|
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 {
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef } from "react";
|
|
2
2
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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","
|
|
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 {
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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","
|
|
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 {
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef } from "react";
|
|
2
2
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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","
|
|
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 {
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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","
|
|
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 {
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef } from "react";
|
|
2
2
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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","
|
|
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 {
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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","
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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","
|
|
1
|
+
{"version":3,"file":"span.d.ts","names":[],"sources":["../../src/primitives/span.ts"],"mappings":""}
|
package/dist/primitives/span.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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","
|
|
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 "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
14
|
-
|
|
14
|
+
declare const SpanResource: (props: {
|
|
15
|
+
spans: SpanData[];
|
|
15
16
|
}) => import("@assistant-ui/tap").ResourceElement<ClientOutput<"span">, {
|
|
16
|
-
|
|
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","
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|