@industry-theme/principal-view-panels 0.12.69 → 0.12.70

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":"TraceListPanel.d.ts","sourceRoot":"","sources":["../../src/panels/TraceListPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,wBAAwB,EAAwB,MAAM,UAAU,CAAC;AAsB/E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA2nD7D,CAAC"}
1
+ {"version":3,"file":"TraceListPanel.d.ts","sourceRoot":"","sources":["../../src/panels/TraceListPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,wBAAwB,EAAwB,MAAM,UAAU,CAAC;AA+C/E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAu2D7D,CAAC"}
@@ -99273,7 +99273,7 @@ const SavePatternModal = ({
99273
99273
  color: theme2.colors.text,
99274
99274
  fontFamily: theme2.fonts.monospace
99275
99275
  }, children: pattern.name }),
99276
- (_a = pattern.children) == null ? void 0 : _a.map((child, i) => renderSpanPattern(child, depth + 1))
99276
+ (_a = pattern.children) == null ? void 0 : _a.map((child) => renderSpanPattern(child, depth + 1))
99277
99277
  ] }, `${pattern.name}-${depth}`);
99278
99278
  };
99279
99279
  return /* @__PURE__ */ jsx(
@@ -99393,7 +99393,7 @@ const SavePatternModal = ({
99393
99393
  borderRadius: "4px",
99394
99394
  maxHeight: "150px",
99395
99395
  overflow: "auto"
99396
- }, children: fingerprint.length > 0 ? fingerprint.map((pattern, i) => renderSpanPattern(pattern, 0)) : /* @__PURE__ */ jsx("span", { style: { color: theme2.colors.textMuted, fontSize: theme2.fontSizes[1] }, children: "No spans to capture" }) })
99396
+ }, children: fingerprint.length > 0 ? fingerprint.map((pattern) => renderSpanPattern(pattern, 0)) : /* @__PURE__ */ jsx("span", { style: { color: theme2.colors.textMuted, fontSize: theme2.fontSizes[1] }, children: "No spans to capture" }) })
99397
99397
  ] }),
99398
99398
  /* @__PURE__ */ jsxs("div", { style: { marginBottom: "20px" }, children: [
99399
99399
  /* @__PURE__ */ jsxs("label", { style: {
@@ -101021,6 +101021,24 @@ function useTracePatterns({
101021
101021
  patternsFilePath
101022
101022
  };
101023
101023
  }
101024
+ const SpanPatternTree = ({ pattern, theme: theme2, depth }) => {
101025
+ var _a;
101026
+ return /* @__PURE__ */ jsxs("div", { style: { marginLeft: depth * 16 }, children: [
101027
+ /* @__PURE__ */ jsxs("code", { style: {
101028
+ fontFamily: theme2.fonts.monospace,
101029
+ fontSize: theme2.fontSizes[0],
101030
+ color: theme2.colors.text
101031
+ }, children: [
101032
+ pattern.name,
101033
+ pattern.nameMatch && pattern.nameMatch !== "exact" && /* @__PURE__ */ jsxs("span", { style: { color: theme2.colors.textMuted }, children: [
101034
+ " (",
101035
+ pattern.nameMatch,
101036
+ ")"
101037
+ ] })
101038
+ ] }),
101039
+ (_a = pattern.children) == null ? void 0 : _a.map((child, i) => /* @__PURE__ */ jsx(SpanPatternTree, { pattern: child, theme: theme2, depth: depth + 1 }, i))
101040
+ ] });
101041
+ };
101024
101042
  const TraceListPanel = ({
101025
101043
  context: context2,
101026
101044
  actions,
@@ -101128,12 +101146,14 @@ const TraceListPanel = ({
101128
101146
  }, [versionSnapshots, scenarioTraceSet]);
101129
101147
  const [scenarioVisibilityMap, setScenarioVisibilityMap] = useState({});
101130
101148
  const [patternVisibilityMap, setPatternVisibilityMap] = useState({});
101149
+ const [expandedPatternIds, setExpandedPatternIds] = useState(/* @__PURE__ */ new Set());
101131
101150
  const repositoryPath = (_b = (_a = context2.currentScope) == null ? void 0 : _a.repository) == null ? void 0 : _b.path;
101132
101151
  const readFile = actions.readFile;
101133
101152
  const writeFile = (_d = (_c = context2.adapters) == null ? void 0 : _c.fileSystem) == null ? void 0 : _d.writeFile;
101134
101153
  const {
101135
101154
  patterns: tracePatterns,
101136
- savePattern
101155
+ savePattern,
101156
+ removePattern
101137
101157
  } = useTracePatterns({
101138
101158
  repositoryPath,
101139
101159
  readFile,
@@ -101210,6 +101230,60 @@ const TraceListPanel = ({
101210
101230
  },
101211
101231
  [actions, versionSnapshots]
101212
101232
  );
101233
+ const handlePatternVisibilityToggle = React__default.useCallback(
101234
+ async (patternId, isVisible) => {
101235
+ setPatternVisibilityMap((prev) => ({
101236
+ ...prev,
101237
+ [patternId]: isVisible
101238
+ }));
101239
+ const pattern = tracePatterns.find((p2) => p2.id === patternId);
101240
+ if (pattern && savePattern) {
101241
+ try {
101242
+ await savePattern({
101243
+ ...pattern,
101244
+ filterDefault: !isVisible
101245
+ // filterDefault is inverse of visibility
101246
+ });
101247
+ } catch (error) {
101248
+ console.error("[TraceListPanel] Failed to update pattern filterDefault:", error);
101249
+ setPatternVisibilityMap((prev) => ({
101250
+ ...prev,
101251
+ [patternId]: !isVisible
101252
+ }));
101253
+ }
101254
+ }
101255
+ },
101256
+ [tracePatterns, savePattern]
101257
+ );
101258
+ const handlePatternClick = React__default.useCallback((patternId) => {
101259
+ setExpandedPatternIds((prev) => {
101260
+ const newSet = new Set(prev);
101261
+ if (newSet.has(patternId)) {
101262
+ newSet.delete(patternId);
101263
+ } else {
101264
+ newSet.add(patternId);
101265
+ }
101266
+ return newSet;
101267
+ });
101268
+ }, []);
101269
+ const handlePatternDelete = React__default.useCallback(
101270
+ async (patternId) => {
101271
+ if (!removePattern) return;
101272
+ try {
101273
+ await removePattern(patternId);
101274
+ } catch (error) {
101275
+ console.error("[TraceListPanel] Failed to delete pattern:", error);
101276
+ }
101277
+ },
101278
+ [removePattern]
101279
+ );
101280
+ const patternTraceCounts = useMemo(() => {
101281
+ const counts = {};
101282
+ patternMatches.forEach((match) => {
101283
+ counts[match.patternId] = (counts[match.patternId] || 0) + 1;
101284
+ });
101285
+ return counts;
101286
+ }, [patternMatches]);
101213
101287
  const filteredTraces = React__default.useMemo(() => {
101214
101288
  return traces.filter((trace2) => {
101215
101289
  const hasScenarioMatches = trace2.scenarioMatches && trace2.scenarioMatches.length > 0;
@@ -102364,6 +102438,163 @@ const TraceListPanel = ({
102364
102438
  })
102365
102439
  }
102366
102440
  ),
102441
+ tracePatterns.length > 0 && /* @__PURE__ */ jsxs("div", { style: { borderBottom: `1px solid ${theme2.colors.border}` }, children: [
102442
+ /* @__PURE__ */ jsxs(
102443
+ "div",
102444
+ {
102445
+ style: {
102446
+ padding: "12px 16px",
102447
+ display: "flex",
102448
+ alignItems: "center",
102449
+ gap: "8px",
102450
+ backgroundColor: theme2.colors.backgroundSecondary
102451
+ },
102452
+ children: [
102453
+ /* @__PURE__ */ jsx(Bookmark, { size: 16, color: "#06b6d4" }),
102454
+ /* @__PURE__ */ jsxs("span", { style: {
102455
+ fontFamily: theme2.fonts.body,
102456
+ fontSize: theme2.fontSizes[2],
102457
+ fontWeight: theme2.fontWeights.medium,
102458
+ color: theme2.colors.text
102459
+ }, children: [
102460
+ "Patterns (",
102461
+ tracePatterns.length,
102462
+ ")"
102463
+ ] })
102464
+ ]
102465
+ }
102466
+ ),
102467
+ tracePatterns.map((pattern) => {
102468
+ const isExpanded = expandedPatternIds.has(pattern.id);
102469
+ const isVisible = patternVisibilityMap[pattern.id] !== false;
102470
+ const traceCount = patternTraceCounts[pattern.id] || 0;
102471
+ return /* @__PURE__ */ jsxs("div", { children: [
102472
+ /* @__PURE__ */ jsxs(
102473
+ "div",
102474
+ {
102475
+ onClick: () => handlePatternClick(pattern.id),
102476
+ style: {
102477
+ padding: "10px 16px",
102478
+ display: "flex",
102479
+ alignItems: "center",
102480
+ gap: "8px",
102481
+ cursor: "pointer",
102482
+ backgroundColor: isExpanded ? `${theme2.colors.primary}10` : "transparent",
102483
+ borderLeft: isExpanded ? `2px solid ${theme2.colors.primary}` : "2px solid transparent",
102484
+ transition: "background-color 0.15s"
102485
+ },
102486
+ onMouseEnter: (e) => {
102487
+ if (!isExpanded) e.currentTarget.style.backgroundColor = `${theme2.colors.primary}05`;
102488
+ },
102489
+ onMouseLeave: (e) => {
102490
+ if (!isExpanded) e.currentTarget.style.backgroundColor = "transparent";
102491
+ },
102492
+ children: [
102493
+ isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { size: 14, color: theme2.colors.textSecondary }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14, color: theme2.colors.textSecondary }),
102494
+ /* @__PURE__ */ jsx("span", { style: {
102495
+ flex: 1,
102496
+ fontFamily: theme2.fonts.body,
102497
+ fontSize: theme2.fontSizes[1],
102498
+ color: theme2.colors.text
102499
+ }, children: pattern.name }),
102500
+ traceCount > 0 && /* @__PURE__ */ jsxs("span", { style: {
102501
+ padding: "2px 6px",
102502
+ fontSize: theme2.fontSizes[0],
102503
+ fontFamily: theme2.fonts.body,
102504
+ backgroundColor: `#06b6d415`,
102505
+ color: "#06b6d4",
102506
+ borderRadius: "3px"
102507
+ }, children: [
102508
+ traceCount,
102509
+ " ",
102510
+ traceCount === 1 ? "trace" : "traces"
102511
+ ] }),
102512
+ /* @__PURE__ */ jsx(
102513
+ "button",
102514
+ {
102515
+ onClick: (e) => {
102516
+ e.stopPropagation();
102517
+ handlePatternVisibilityToggle(pattern.id, !isVisible);
102518
+ },
102519
+ title: isVisible ? "Hide matching traces" : "Show matching traces",
102520
+ style: {
102521
+ padding: "4px",
102522
+ background: "transparent",
102523
+ border: "none",
102524
+ cursor: "pointer",
102525
+ display: "flex",
102526
+ alignItems: "center",
102527
+ opacity: 0.6,
102528
+ transition: "opacity 0.15s"
102529
+ },
102530
+ onMouseEnter: (e) => {
102531
+ e.currentTarget.style.opacity = "1";
102532
+ },
102533
+ onMouseLeave: (e) => {
102534
+ e.currentTarget.style.opacity = "0.6";
102535
+ },
102536
+ children: isVisible ? /* @__PURE__ */ jsx(Eye, { size: 14, color: theme2.colors.textSecondary }) : /* @__PURE__ */ jsx(EyeOff, { size: 14, color: theme2.colors.textMuted })
102537
+ }
102538
+ ),
102539
+ /* @__PURE__ */ jsx(
102540
+ "button",
102541
+ {
102542
+ onClick: (e) => {
102543
+ e.stopPropagation();
102544
+ if (confirm(`Delete pattern "${pattern.name}"?`)) {
102545
+ handlePatternDelete(pattern.id);
102546
+ }
102547
+ },
102548
+ title: "Delete pattern",
102549
+ style: {
102550
+ padding: "4px",
102551
+ background: "transparent",
102552
+ border: "none",
102553
+ cursor: "pointer",
102554
+ display: "flex",
102555
+ alignItems: "center",
102556
+ opacity: 0.6,
102557
+ transition: "opacity 0.15s"
102558
+ },
102559
+ onMouseEnter: (e) => {
102560
+ e.currentTarget.style.opacity = "1";
102561
+ },
102562
+ onMouseLeave: (e) => {
102563
+ e.currentTarget.style.opacity = "0.6";
102564
+ },
102565
+ children: /* @__PURE__ */ jsx(Trash2, { size: 14, color: theme2.colors.error })
102566
+ }
102567
+ )
102568
+ ]
102569
+ }
102570
+ ),
102571
+ isExpanded && /* @__PURE__ */ jsxs("div", { style: {
102572
+ padding: "12px 16px 12px 40px",
102573
+ backgroundColor: theme2.colors.backgroundSecondary,
102574
+ borderTop: `1px solid ${theme2.colors.border}`
102575
+ }, children: [
102576
+ pattern.description && /* @__PURE__ */ jsx("div", { style: {
102577
+ marginBottom: "12px",
102578
+ fontFamily: theme2.fonts.body,
102579
+ fontSize: theme2.fontSizes[1],
102580
+ color: theme2.colors.textSecondary
102581
+ }, children: pattern.description }),
102582
+ /* @__PURE__ */ jsx("div", { style: {
102583
+ fontFamily: theme2.fonts.body,
102584
+ fontSize: theme2.fontSizes[0],
102585
+ color: theme2.colors.textMuted,
102586
+ marginBottom: "8px"
102587
+ }, children: "Span Structure:" }),
102588
+ /* @__PURE__ */ jsx("div", { style: {
102589
+ padding: "8px 12px",
102590
+ backgroundColor: theme2.colors.background,
102591
+ borderRadius: "4px",
102592
+ border: `1px solid ${theme2.colors.border}`
102593
+ }, children: pattern.rootSpans.map((spanPattern, i) => /* @__PURE__ */ jsx(SpanPatternTree, { pattern: spanPattern, theme: theme2, depth: 0 }, i)) })
102594
+ ] })
102595
+ ] }, pattern.id);
102596
+ })
102597
+ ] }),
102367
102598
  /* @__PURE__ */ jsx("div", { style: { flex: 1, overflow: "auto" }, children: /* @__PURE__ */ jsx(
102368
102599
  StoryboardWorkflowsTreeCore,
102369
102600
  {