@industry-theme/principal-view-panels 0.12.56 → 0.12.58

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.
@@ -1 +1 @@
1
- {"version":3,"file":"StoryboardListPanel.d.ts","sourceRoot":"","sources":["../../src/panels/StoryboardListPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAsE9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CA4yCvE,CAAC"}
1
+ {"version":3,"file":"StoryboardListPanel.d.ts","sourceRoot":"","sources":["../../src/panels/StoryboardListPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AA2K9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAk1CvE,CAAC"}
@@ -86713,18 +86713,40 @@ const CustomNode = ({ data, selected: selected2, dragging }) => {
86713
86713
  const color2 = fillColor;
86714
86714
  const displayName = nodeProps.name;
86715
86715
  const eventData = nodeData == null ? void 0 : nodeData.event;
86716
- const eventName = eventData == null ? void 0 : eventData.name;
86717
- const showEventName = eventName && eventName !== displayName;
86716
+ const otelData = nodeData == null ? void 0 : nodeData.otel;
86717
+ const boundaryData = nodeData == null ? void 0 : nodeData.boundary;
86718
+ const getNodeIdentifier = () => {
86719
+ if (eventData == null ? void 0 : eventData.name)
86720
+ return eventData.name;
86721
+ if (nodeData == null ? void 0 : nodeData.eventRef)
86722
+ return nodeData.eventRef;
86723
+ if (otelData == null ? void 0 : otelData.spanPattern)
86724
+ return otelData.spanPattern;
86725
+ if (otelData == null ? void 0 : otelData.scope)
86726
+ return otelData.scope;
86727
+ if (otelData == null ? void 0 : otelData.resourceMatch) {
86728
+ const entries = Object.entries(otelData.resourceMatch);
86729
+ if (entries.length > 0) {
86730
+ const [key, value] = entries[0];
86731
+ return `${key}: ${Array.isArray(value) ? value[0] : value}`;
86732
+ }
86733
+ }
86734
+ if (boundaryData == null ? void 0 : boundaryData.direction)
86735
+ return boundaryData.direction;
86736
+ return void 0;
86737
+ };
86738
+ const identifier2 = getNodeIdentifier();
86739
+ const showIdentifier = identifier2 && identifier2 !== displayName;
86718
86740
  const renderWithDotBreaks = (text2) => {
86719
86741
  const parts = text2.split(".");
86720
86742
  return parts.map((part, i) => jsxs("span", { children: [part, i < parts.length - 1 && jsxs(Fragment, { children: [".", jsx("wbr", {})] })] }, i));
86721
86743
  };
86722
- const renderNameWithEvent = (centered = true) => jsxs("div", { style: { textAlign: centered ? "center" : "left", wordBreak: "break-word" }, children: [jsx("div", { children: displayName }), showEventName && jsx("div", { style: {
86744
+ const renderNameWithIdentifier = (centered = true) => jsxs("div", { style: { textAlign: centered ? "center" : "left", wordBreak: "break-word" }, children: [jsx("div", { children: displayName }), showIdentifier && jsx("div", { style: {
86723
86745
  fontSize: theme2.fontSizes[0] * 0.75,
86724
86746
  color: "rgba(0, 0, 0, 0.5)",
86725
86747
  marginTop: "2px",
86726
86748
  fontFamily: theme2.fonts.monospace
86727
- }, children: renderWithDotBreaks(eventName) })] });
86749
+ }, children: renderWithDotBreaks(identifier2) })] });
86728
86750
  const icon = nodeData.icon || state && (((_d = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _d.icon) || ((_f = (_e2 = typeDefinition.states) == null ? void 0 : _e2[state]) == null ? void 0 : _f.icon)) || typeDefinition.icon;
86729
86751
  const getAnimationClass = () => {
86730
86752
  switch (animationType) {
@@ -86922,7 +86944,7 @@ const CustomNode = ({ data, selected: selected2, dragging }) => {
86922
86944
  height: "100%",
86923
86945
  boxShadow: isHighlighted ? `0 0 0 3px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.5)` : selected2 ? `0 0 0 2px ${strokeColor}` : "none",
86924
86946
  transition: "box-shadow 0.2s ease"
86925
- }, onMouseDown: handleMouseDown, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [renderStatusBadge(), isBoundaryNode ? renderBoundaryBadge() : jsxs(Fragment, { children: [renderSourcesBadge(), renderReferencesBadge()] }), jsx("div", { style: hexagonBorderStyle, className: animationClass, children: jsxs("div", { style: hexagonInnerStyle, children: [icon && jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: resolveIcon(icon, 20) }), renderNameWithEvent(), state && jsx("div", { style: {
86947
+ }, onMouseDown: handleMouseDown, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [renderStatusBadge(), isBoundaryNode ? renderBoundaryBadge() : jsxs(Fragment, { children: [renderSourcesBadge(), renderReferencesBadge()] }), jsx("div", { style: hexagonBorderStyle, className: animationClass, children: jsxs("div", { style: hexagonInnerStyle, children: [icon && jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: resolveIcon(icon, 20) }), renderNameWithIdentifier(), state && jsx("div", { style: {
86926
86948
  fontSize: theme2.fontSizes[0],
86927
86949
  fontFamily: theme2.fonts.body,
86928
86950
  backgroundColor: color2,
@@ -86941,7 +86963,7 @@ const CustomNode = ({ data, selected: selected2, dragging }) => {
86941
86963
  height: "100%",
86942
86964
  boxShadow: isHighlighted ? `0 0 0 3px #3b82f6, 0 0 20px rgba(59, 130, 246, 0.5)` : selected2 ? `0 0 0 2px ${strokeColor}` : "none",
86943
86965
  transition: "box-shadow 0.2s ease"
86944
- }, onMouseDown: handleMouseDown, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [renderStatusBadge(), isBoundaryNode ? renderBoundaryBadge() : jsxs(Fragment, { children: [renderSourcesBadge(), renderReferencesBadge()] }), jsx("div", { style: diamondBorderStyle, className: animationClass, children: jsxs("div", { style: diamondInnerStyle, children: [icon && jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: resolveIcon(icon, 20) }), renderNameWithEvent(), state && jsx("div", { style: {
86966
+ }, onMouseDown: handleMouseDown, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [renderStatusBadge(), isBoundaryNode ? renderBoundaryBadge() : jsxs(Fragment, { children: [renderSourcesBadge(), renderReferencesBadge()] }), jsx("div", { style: diamondBorderStyle, className: animationClass, children: jsxs("div", { style: diamondInnerStyle, children: [icon && jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: resolveIcon(icon, 20) }), renderNameWithIdentifier(), state && jsx("div", { style: {
86945
86967
  fontSize: theme2.fontSizes[0],
86946
86968
  fontFamily: theme2.fonts.body,
86947
86969
  backgroundColor: color2,
@@ -86962,7 +86984,7 @@ const CustomNode = ({ data, selected: selected2, dragging }) => {
86962
86984
  justifyContent: "center",
86963
86985
  gap: "6px",
86964
86986
  width: "100%"
86965
- }, children: [icon && resolveIcon(icon, 18), renderNameWithEvent(false)] }) : jsxs(Fragment, { children: [icon && jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: resolveIcon(icon, 20) }), renderNameWithEvent()] }), state && jsx("div", { style: {
86987
+ }, children: [icon && resolveIcon(icon, 18), renderNameWithIdentifier(false)] }) : jsxs(Fragment, { children: [icon && jsx("div", { style: { display: "flex", justifyContent: "center", alignItems: "center" }, children: resolveIcon(icon, 20) }), renderNameWithIdentifier()] }), state && jsx("div", { style: {
86966
86988
  fontSize: theme2.fontSizes[0],
86967
86989
  fontFamily: theme2.fonts.body,
86968
86990
  backgroundColor: color2,
@@ -88512,7 +88534,7 @@ function useCanvasToLegacy(canvas, library, spansCanvas, workflowSpanPattern) {
88512
88534
  if (!canvas)
88513
88535
  return null;
88514
88536
  const { nodes, edges } = CanvasConverter.canvasToGraph(canvas);
88515
- const scopeColorMap = buildScopeColorMap(library == null ? void 0 : library.resources);
88537
+ const scopeColorMap = buildScopeColorMap(library);
88516
88538
  const spanColorMap = buildSpanColorMap(spansCanvas);
88517
88539
  const spanColor = resolveEventSpanColor(workflowSpanPattern, spanColorMap);
88518
88540
  for (const node2 of nodes) {
@@ -99611,6 +99633,60 @@ const StoryboardLoadingGraph = () => {
99611
99633
  }
99612
99634
  );
99613
99635
  };
99636
+ const TRACER_NAME = "@industry-theme/principal-view-panels";
99637
+ const TRACER_VERSION = "0.11.40";
99638
+ function getTracer() {
99639
+ return trace.getTracer(TRACER_NAME, TRACER_VERSION);
99640
+ }
99641
+ function getActiveSpan() {
99642
+ return trace.getActiveSpan();
99643
+ }
99644
+ async function withSpan(span, fn) {
99645
+ return context.with(trace.setSpan(context.active(), span), fn);
99646
+ }
99647
+ async function traced(name2, fn, options) {
99648
+ const tracer = getTracer();
99649
+ const span = tracer.startSpan(name2, options);
99650
+ try {
99651
+ const result = await context.with(
99652
+ trace.setSpan(context.active(), span),
99653
+ () => fn(span)
99654
+ );
99655
+ span.setStatus({ code: SpanStatusCode.OK });
99656
+ return result;
99657
+ } catch (error) {
99658
+ span.setStatus({
99659
+ code: SpanStatusCode.ERROR,
99660
+ message: error instanceof Error ? error.message : String(error)
99661
+ });
99662
+ span.recordException(
99663
+ error instanceof Error ? error : new Error(String(error))
99664
+ );
99665
+ throw error;
99666
+ } finally {
99667
+ span.end();
99668
+ }
99669
+ }
99670
+ function tracedSync(name2, fn, options) {
99671
+ const tracer = getTracer();
99672
+ const span = tracer.startSpan(name2, options);
99673
+ try {
99674
+ const result = fn(span);
99675
+ span.setStatus({ code: SpanStatusCode.OK });
99676
+ return result;
99677
+ } catch (error) {
99678
+ span.setStatus({
99679
+ code: SpanStatusCode.ERROR,
99680
+ message: error instanceof Error ? error.message : String(error)
99681
+ });
99682
+ span.recordException(
99683
+ error instanceof Error ? error : new Error(String(error))
99684
+ );
99685
+ throw error;
99686
+ } finally {
99687
+ span.end();
99688
+ }
99689
+ }
99614
99690
  function convertGitStatusToFileStatus(gitStatus) {
99615
99691
  if (!gitStatus) return [];
99616
99692
  const fileStatuses = [];
@@ -99648,6 +99724,94 @@ function convertGitStatusToFileStatus(gitStatus) {
99648
99724
  });
99649
99725
  return fileStatuses;
99650
99726
  }
99727
+ function useStoryboardListPanelTelemetry(params) {
99728
+ const { isLoading, error, storyboardCount, otelCount, architectureCount } = params;
99729
+ const spanRef = useRef(null);
99730
+ const hasEmittedLoadedRef = useRef(false);
99731
+ const tracer = getTracer();
99732
+ useEffect(() => {
99733
+ spanRef.current = tracer.startSpan("storyboard-list.panel", {
99734
+ attributes: {
99735
+ "panel.id": "storyboard-list-panel"
99736
+ }
99737
+ });
99738
+ spanRef.current.addEvent("panel.loading", {
99739
+ "panel.id": "storyboard-list-panel"
99740
+ });
99741
+ return () => {
99742
+ var _a;
99743
+ (_a = spanRef.current) == null ? void 0 : _a.end();
99744
+ spanRef.current = null;
99745
+ hasEmittedLoadedRef.current = false;
99746
+ };
99747
+ }, [tracer]);
99748
+ useEffect(() => {
99749
+ if (!spanRef.current) return;
99750
+ if (error) {
99751
+ spanRef.current.addEvent("panel.error", {
99752
+ "panel.id": "storyboard-list-panel",
99753
+ "error.type": "discovery_error",
99754
+ "error.message": error
99755
+ });
99756
+ } else if (!isLoading && !hasEmittedLoadedRef.current) {
99757
+ spanRef.current.addEvent("panel.loaded", {
99758
+ "panel.id": "storyboard-list-panel",
99759
+ "storyboard.count": storyboardCount,
99760
+ "otel.count": otelCount,
99761
+ "architecture.count": architectureCount
99762
+ });
99763
+ hasEmittedLoadedRef.current = true;
99764
+ }
99765
+ }, [isLoading, error, storyboardCount, otelCount, architectureCount]);
99766
+ return useMemo(() => ({
99767
+ emitCanvasSelected: (canvasId, canvasName, canvasPath, canvasType) => {
99768
+ var _a;
99769
+ (_a = spanRef.current) == null ? void 0 : _a.addEvent("canvas.selected", {
99770
+ "canvas.id": canvasId,
99771
+ "canvas.name": canvasName,
99772
+ "canvas.path": canvasPath,
99773
+ "canvas.type": canvasType
99774
+ });
99775
+ },
99776
+ emitWorkflowSelected: (workflowId, workflowName, workflowPath, canvasId, scenarioCount) => {
99777
+ var _a;
99778
+ (_a = spanRef.current) == null ? void 0 : _a.addEvent("workflow.selected", {
99779
+ "workflow.id": workflowId,
99780
+ "workflow.name": workflowName,
99781
+ "workflow.path": workflowPath,
99782
+ "canvas.id": canvasId,
99783
+ "scenario.count": scenarioCount
99784
+ });
99785
+ },
99786
+ emitTabSwitched: (previous2, current) => {
99787
+ var _a;
99788
+ (_a = spanRef.current) == null ? void 0 : _a.addEvent("tab.switched", {
99789
+ "tab.previous": previous2 ?? "none",
99790
+ "tab.current": current
99791
+ });
99792
+ },
99793
+ emitSearchChanged: (query, resultCount) => {
99794
+ var _a;
99795
+ (_a = spanRef.current) == null ? void 0 : _a.addEvent("search.changed", {
99796
+ "search.query": query,
99797
+ "result.count": resultCount
99798
+ });
99799
+ },
99800
+ emitRefreshRequested: () => {
99801
+ var _a;
99802
+ (_a = spanRef.current) == null ? void 0 : _a.addEvent("refresh.requested", {
99803
+ "panel.id": "storyboard-list-panel"
99804
+ });
99805
+ },
99806
+ emitNodeToggled: (nodeId, isOpen) => {
99807
+ var _a;
99808
+ (_a = spanRef.current) == null ? void 0 : _a.addEvent("node.toggled", {
99809
+ "node.id": nodeId,
99810
+ "node.open": isOpen
99811
+ });
99812
+ }
99813
+ }), []);
99814
+ }
99651
99815
  const StoryboardListPanel = ({
99652
99816
  context: context2,
99653
99817
  actions,
@@ -99661,8 +99825,11 @@ const StoryboardListPanel = ({
99661
99825
  });
99662
99826
  const [openState, setOpenState] = useState({});
99663
99827
  const handleTreeToggle = useCallback((nodeId, isOpen) => {
99828
+ var _a;
99664
99829
  setOpenState((prev) => ({ ...prev, [nodeId]: isOpen }));
99830
+ (_a = telemetryRef.current) == null ? void 0 : _a.emitNodeToggled(nodeId, isOpen);
99665
99831
  }, []);
99832
+ const telemetryRef = useRef(null);
99666
99833
  const handleTreeNodeClickRef = useRef(null);
99667
99834
  useEffect(() => {
99668
99835
  if (!events) return;
@@ -99766,6 +99933,14 @@ const StoryboardListPanel = ({
99766
99933
  const regular = storyboards.filter((sb) => architectureTypes.includes(sb.canvas.type)).length;
99767
99934
  return { otelCount: otel, staticCount: regular };
99768
99935
  }, [storyboards]);
99936
+ const telemetry = useStoryboardListPanelTelemetry({
99937
+ isLoading,
99938
+ error,
99939
+ storyboardCount: storyboards.length,
99940
+ otelCount,
99941
+ architectureCount: staticCount
99942
+ });
99943
+ telemetryRef.current = telemetry;
99769
99944
  const effectiveCanvasTypeFilter = useMemo(() => {
99770
99945
  if (canvasTypeFilter !== null) {
99771
99946
  return canvasTypeFilter;
@@ -99908,7 +100083,7 @@ const StoryboardListPanel = ({
99908
100083
  return filteredStoryboards.map((storyboard) => storyboard.canvas);
99909
100084
  }, [filteredStoryboards]);
99910
100085
  const handleTreeNodeClick = useCallback((node2, event) => {
99911
- var _a, _b, _c, _d, _e2, _f;
100086
+ var _a, _b, _c, _d, _e2, _f, _g;
99912
100087
  if ((event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey)) {
99913
100088
  let filePath;
99914
100089
  if (node2.type === "canvas" && ((_a = node2.canvas) == null ? void 0 : _a.path)) {
@@ -99941,6 +100116,12 @@ const StoryboardListPanel = ({
99941
100116
  }
99942
100117
  } else if (node2.type === "canvas" && node2.canvas) {
99943
100118
  setSelectedNodeId(`canvas:${node2.canvas.id}`);
100119
+ telemetry.emitCanvasSelected(
100120
+ node2.canvas.id,
100121
+ node2.canvas.name,
100122
+ node2.canvas.path,
100123
+ node2.canvas.type
100124
+ );
99944
100125
  if (events) {
99945
100126
  const canvasFileInfo = getCanvasFileInfo(node2.canvas.path);
99946
100127
  events.emit({
@@ -99970,6 +100151,13 @@ const StoryboardListPanel = ({
99970
100151
  console.warn("[StoryboardListPanel] Workflow template not loaded for:", (_f = node2.workflow) == null ? void 0 : _f.path);
99971
100152
  return;
99972
100153
  }
100154
+ telemetry.emitWorkflowSelected(
100155
+ node2.workflow.id,
100156
+ node2.workflow.name,
100157
+ node2.workflow.path,
100158
+ node2.storyboard.canvas.id,
100159
+ ((_g = fullWorkflow.template.scenarios) == null ? void 0 : _g.length) ?? 0
100160
+ );
99973
100161
  events.emit({
99974
100162
  type: "custom",
99975
100163
  source: "storyboard-list-panel",
@@ -99988,7 +100176,7 @@ const StoryboardListPanel = ({
99988
100176
  });
99989
100177
  }
99990
100178
  }
99991
- }, [events, getCanvasFileInfo, workflows]);
100179
+ }, [events, getCanvasFileInfo, workflows, telemetry]);
99992
100180
  const getNodeFilePath = useCallback((node2) => {
99993
100181
  var _a, _b, _c, _d, _e2;
99994
100182
  if (node2.type === "canvas" && ((_a = node2.canvas) == null ? void 0 : _a.path)) {
@@ -100051,6 +100239,7 @@ const StoryboardListPanel = ({
100051
100239
  }, [handleTreeNodeClick]);
100052
100240
  const handleRefresh = () => {
100053
100241
  setIsRefreshing(true);
100242
+ telemetry.emitRefreshRequested();
100054
100243
  if (events) {
100055
100244
  events.emit({
100056
100245
  type: "canvas:refresh",
@@ -100268,7 +100457,10 @@ const StoryboardListPanel = ({
100268
100457
  /* @__PURE__ */ jsx(
100269
100458
  "button",
100270
100459
  {
100271
- onClick: () => setCanvasTypeFilter("regular"),
100460
+ onClick: () => {
100461
+ telemetry.emitTabSwitched(canvasTypeFilter, "regular");
100462
+ setCanvasTypeFilter("regular");
100463
+ },
100272
100464
  style: {
100273
100465
  flex: 1,
100274
100466
  background: effectiveCanvasTypeFilter === "regular" ? theme2.colors.primary : "transparent",
@@ -100289,7 +100481,10 @@ const StoryboardListPanel = ({
100289
100481
  /* @__PURE__ */ jsx(
100290
100482
  "button",
100291
100483
  {
100292
- onClick: () => setCanvasTypeFilter("otel"),
100484
+ onClick: () => {
100485
+ telemetry.emitTabSwitched(canvasTypeFilter, "otel");
100486
+ setCanvasTypeFilter("otel");
100487
+ },
100293
100488
  style: {
100294
100489
  flex: 1,
100295
100490
  background: effectiveCanvasTypeFilter === "otel" ? theme2.colors.primary : "transparent",
@@ -108620,60 +108815,6 @@ function createMultiCanvasLayout(canvases, options) {
108620
108815
  });
108621
108816
  return { placements };
108622
108817
  }
108623
- const TRACER_NAME = "@industry-theme/principal-view-panels";
108624
- const TRACER_VERSION = "0.11.40";
108625
- function getTracer() {
108626
- return trace.getTracer(TRACER_NAME, TRACER_VERSION);
108627
- }
108628
- function getActiveSpan() {
108629
- return trace.getActiveSpan();
108630
- }
108631
- async function withSpan(span, fn) {
108632
- return context.with(trace.setSpan(context.active(), span), fn);
108633
- }
108634
- async function traced(name2, fn, options) {
108635
- const tracer = getTracer();
108636
- const span = tracer.startSpan(name2, options);
108637
- try {
108638
- const result = await context.with(
108639
- trace.setSpan(context.active(), span),
108640
- () => fn(span)
108641
- );
108642
- span.setStatus({ code: SpanStatusCode.OK });
108643
- return result;
108644
- } catch (error) {
108645
- span.setStatus({
108646
- code: SpanStatusCode.ERROR,
108647
- message: error instanceof Error ? error.message : String(error)
108648
- });
108649
- span.recordException(
108650
- error instanceof Error ? error : new Error(String(error))
108651
- );
108652
- throw error;
108653
- } finally {
108654
- span.end();
108655
- }
108656
- }
108657
- function tracedSync(name2, fn, options) {
108658
- const tracer = getTracer();
108659
- const span = tracer.startSpan(name2, options);
108660
- try {
108661
- const result = fn(span);
108662
- span.setStatus({ code: SpanStatusCode.OK });
108663
- return result;
108664
- } catch (error) {
108665
- span.setStatus({
108666
- code: SpanStatusCode.ERROR,
108667
- message: error instanceof Error ? error.message : String(error)
108668
- });
108669
- span.recordException(
108670
- error instanceof Error ? error : new Error(String(error))
108671
- );
108672
- throw error;
108673
- } finally {
108674
- span.end();
108675
- }
108676
- }
108677
108818
  const panels = [
108678
108819
  {
108679
108820
  metadata: {