@locusgraph/loop 0.1.0 → 0.2.0

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 (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +86 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +46 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +56 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +63 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +31 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +29 -1
  8. package/dist/agent/pulse/pulse.js +150 -35
  9. package/dist/agent/pulse/use-loop-animation.js +36 -17
  10. package/dist/agent/steps/step-icon.js +110 -24
  11. package/dist/agent/steps/steps.js +235 -25
  12. package/dist/agent/thinking/thinking.js +203 -23
  13. package/dist/agent/thinking/thought-duration.js +7 -9
  14. package/dist/agent/tool/json-block.js +38 -11
  15. package/dist/agent/tool/tool-status.js +51 -18
  16. package/dist/agent/tool/tool.js +184 -6
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -2
  18. package/dist/approval/inbox/inbox-row.js +321 -7
  19. package/dist/approval/inbox/inbox-selection.js +7 -13
  20. package/dist/approval/inbox/inbox.d.ts +2 -1
  21. package/dist/approval/inbox/inbox.js +250 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +242 -17
  26. package/dist/approval/memory/memory-row.js +215 -19
  27. package/dist/approval/plan/plan-review.js +279 -28
  28. package/dist/approval/plan/plan-step-row.js +194 -43
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +158 -39
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +223 -26
  33. package/dist/approval/run/run-bar.js +178 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +47 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +23 -6
  38. package/dist/approval/spend/raise-cap-form.js +235 -17
  39. package/dist/approval/spend/spend-gate.js +239 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +362 -34
  42. package/dist/approval/tool/approval.js +272 -27
  43. package/dist/approval/tool/args/args-editor.js +262 -26
  44. package/dist/approval/tool/args/args-field.js +259 -19
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +130 -10
  47. package/dist/approval/tool/tool-inputs.js +127 -38
  48. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  49. package/dist/chat/chat/chat-item-spacing.js +19 -0
  50. package/dist/chat/chat/chat.d.ts +2 -1
  51. package/dist/chat/chat/chat.js +181 -5
  52. package/dist/chat/chat/use-stick-to-bottom.js +123 -47
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +153 -0
  55. package/dist/chat/composer/composer-actions.js +151 -16
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +24 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +316 -28
  60. package/dist/chat/reply/fenced-code.js +45 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +105 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +238 -30
  65. package/dist/cost/context.js +321 -23
  66. package/dist/cost/cost-steps.js +220 -14
  67. package/dist/cost/cost.js +521 -27
  68. package/dist/cost/model-picker.js +181 -6
  69. package/dist/cost/shared/context-breakdown.js +299 -10
  70. package/dist/cost/shared/meter-marks.js +107 -9
  71. package/dist/cost/shared/model-option-row.js +178 -21
  72. package/dist/cost/shared/step-cost-row.js +248 -20
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +182 -11
  75. package/dist/memory/memorized.js +217 -11
  76. package/dist/memory/recall.js +296 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +39 -3
  79. package/dist/memory/sources.js +255 -13
  80. package/dist/shared/decision-summary.js +133 -14
  81. package/dist/shared/panel-empty.js +78 -3
  82. package/dist/shared/panel.js +243 -13
  83. package/dist/shared/status-dot.js +38 -8
  84. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  85. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  86. package/dist/thread/actions/action-button.js +65 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +102 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +149 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +61 -13
  93. package/dist/thread/code/highlight.js +30 -29
  94. package/dist/thread/history/history-rows.d.ts +16 -0
  95. package/dist/thread/history/history-rows.js +23 -0
  96. package/dist/thread/history/history.d.ts +3 -2
  97. package/dist/thread/history/history.js +174 -5
  98. package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
  99. package/dist/thread/history/row/history-row.js +137 -0
  100. package/dist/thread/history/row/thread-item-menu.js +84 -0
  101. package/dist/thread/history/row/thread-title-editor.js +81 -0
  102. package/dist/thread/history/thread-groups.d.ts +1 -1
  103. package/dist/thread/history/thread-groups.js +40 -34
  104. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  105. package/dist/thread/history/virtual-history-list.js +107 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +92 -7
  108. package/dist/thread/use-copied.js +45 -15
  109. package/dist/types.js +1 -1
  110. package/package.json +6 -4
  111. package/dist/thread/history/history-row.js +0 -17
  112. package/dist/thread/history/thread-item-menu.js +0 -6
  113. package/dist/thread/history/thread-title-editor.js +0 -25
  114. /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
  115. /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
@@ -1,25 +1,144 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Checkmark as CheckIcon, Close as XIcon } from "@carbon/icons-react";
3
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
4
  const decisionTimeFormat = new Intl.DateTimeFormat("en-US", {
4
- dateStyle: "medium",
5
- timeStyle: "short",
6
- timeZone: "UTC",
5
+ dateStyle: "medium",
6
+ timeStyle: "short",
7
+ timeZone: "UTC"
7
8
  });
8
9
  export function toDate(value) {
9
- return value instanceof Date ? value : new Date(value);
10
+ return value instanceof Date ? value : new Date(value);
10
11
  }
11
12
  export function isoOf(value) {
12
- const date = toDate(value);
13
- return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
13
+ const date = toDate(value);
14
+ return Number.isNaN(date.getTime()) ? undefined : date.toISOString();
14
15
  }
15
16
  export function formatDecidedAt(value) {
16
- const date = toDate(value);
17
- return Number.isNaN(date.getTime()) ? "" : `${decisionTimeFormat.format(date)} UTC`;
17
+ const date = toDate(value);
18
+ return Number.isNaN(date.getTime()) ? "" : `${decisionTimeFormat.format(date)} UTC`;
18
19
  }
19
- function DecisionMeta({ decision, verb }) {
20
- return (_jsxs("p", { className: "text-xs text-muted-foreground", children: [verb, decision.by && ` by ${decision.by}`, decision.at !== undefined && (_jsxs(_Fragment, { children: [" · ", _jsx("time", { dateTime: isoOf(decision.at), className: "tabular-nums", children: formatDecidedAt(decision.at) })] }))] }));
20
+ function DecisionMeta(t0) {
21
+ const $ = _c(6);
22
+ const {
23
+ decision,
24
+ verb
25
+ } = t0;
26
+ const t1 = decision.by && ` by ${decision.by}`;
27
+ let t2;
28
+ if ($[0] !== decision.at) {
29
+ t2 = decision.at !== undefined && /*#__PURE__*/_jsxs(_Fragment, {
30
+ children: [" \xB7 ", /*#__PURE__*/_jsx("time", {
31
+ dateTime: isoOf(decision.at),
32
+ className: "tabular-nums",
33
+ children: formatDecidedAt(decision.at)
34
+ })]
35
+ });
36
+ $[0] = decision.at;
37
+ $[1] = t2;
38
+ } else {
39
+ t2 = $[1];
40
+ }
41
+ let t3;
42
+ if ($[2] !== t1 || $[3] !== t2 || $[4] !== verb) {
43
+ t3 = /*#__PURE__*/_jsxs("p", {
44
+ className: "text-xs text-muted-foreground",
45
+ children: [verb, t1, t2]
46
+ });
47
+ $[2] = t1;
48
+ $[3] = t2;
49
+ $[4] = verb;
50
+ $[5] = t3;
51
+ } else {
52
+ t3 = $[5];
53
+ }
54
+ return t3;
21
55
  }
22
- export function DecisionSummary({ decision, result, approvedVerb = "Approved", deniedVerb = "Denied", }) {
23
- const Icon = decision.approved ? CheckIcon : XIcon;
24
- return (_jsxs("div", { "data-slot": "decision-summary", "data-approved": decision.approved, className: "flex items-start gap-2.5 text-sm", children: [_jsx(Icon, { "aria-hidden": true, className: `mt-0.5 size-4 shrink-0 ${decision.approved ? "text-good" : "text-destructive"}` }), _jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [_jsx("p", { className: "font-medium", children: result }), _jsx(DecisionMeta, { decision: decision, verb: decision.approved ? approvedVerb : deniedVerb }), decision.reason && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Reason: ", decision.reason] }))] })] }));
56
+ export function DecisionSummary(t0) {
57
+ const $ = _c(18);
58
+ const {
59
+ decision,
60
+ result,
61
+ approvedVerb: t1,
62
+ deniedVerb: t2
63
+ } = t0;
64
+ const approvedVerb = t1 === undefined ? "Approved" : t1;
65
+ const deniedVerb = t2 === undefined ? "Denied" : t2;
66
+ const Icon = decision.approved ? CheckIcon : XIcon;
67
+ const t3 = `mt-0.5 size-4 shrink-0 ${decision.approved ? "text-good" : "text-destructive"}`;
68
+ let t4;
69
+ if ($[0] !== Icon || $[1] !== t3) {
70
+ t4 = /*#__PURE__*/_jsx(Icon, {
71
+ "aria-hidden": true,
72
+ className: t3
73
+ });
74
+ $[0] = Icon;
75
+ $[1] = t3;
76
+ $[2] = t4;
77
+ } else {
78
+ t4 = $[2];
79
+ }
80
+ let t5;
81
+ if ($[3] !== result) {
82
+ t5 = /*#__PURE__*/_jsx("p", {
83
+ className: "font-medium",
84
+ children: result
85
+ });
86
+ $[3] = result;
87
+ $[4] = t5;
88
+ } else {
89
+ t5 = $[4];
90
+ }
91
+ const t6 = decision.approved ? approvedVerb : deniedVerb;
92
+ let t7;
93
+ if ($[5] !== decision || $[6] !== t6) {
94
+ t7 = /*#__PURE__*/_jsx(DecisionMeta, {
95
+ decision: decision,
96
+ verb: t6
97
+ });
98
+ $[5] = decision;
99
+ $[6] = t6;
100
+ $[7] = t7;
101
+ } else {
102
+ t7 = $[7];
103
+ }
104
+ let t8;
105
+ if ($[8] !== decision.reason) {
106
+ t8 = decision.reason && /*#__PURE__*/_jsxs("p", {
107
+ className: "text-xs text-muted-foreground",
108
+ children: ["Reason: ", decision.reason]
109
+ });
110
+ $[8] = decision.reason;
111
+ $[9] = t8;
112
+ } else {
113
+ t8 = $[9];
114
+ }
115
+ let t9;
116
+ if ($[10] !== t5 || $[11] !== t7 || $[12] !== t8) {
117
+ t9 = /*#__PURE__*/_jsxs("div", {
118
+ className: "flex min-w-0 flex-col gap-0.5",
119
+ children: [t5, t7, t8]
120
+ });
121
+ $[10] = t5;
122
+ $[11] = t7;
123
+ $[12] = t8;
124
+ $[13] = t9;
125
+ } else {
126
+ t9 = $[13];
127
+ }
128
+ let t10;
129
+ if ($[14] !== decision.approved || $[15] !== t4 || $[16] !== t9) {
130
+ t10 = /*#__PURE__*/_jsxs("div", {
131
+ "data-slot": "decision-summary",
132
+ "data-approved": decision.approved,
133
+ className: "flex items-start gap-2.5 text-sm",
134
+ children: [t4, t9]
135
+ });
136
+ $[14] = decision.approved;
137
+ $[15] = t4;
138
+ $[16] = t9;
139
+ $[17] = t10;
140
+ } else {
141
+ t10 = $[17];
142
+ }
143
+ return t10;
25
144
  }
@@ -1,5 +1,80 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cn } from "@locusgraph/components";
3
- export function PanelEmpty({ icon, title, description, className, ...props }) {
4
- return (_jsxs("div", { "data-slot": "panel-empty", ...props, className: cn("flex flex-col items-center gap-1 px-6 pt-8 pb-10 text-center [&_svg]:mb-1 [&_svg]:size-5 [&_svg]:text-muted-foreground", className), children: [icon, _jsx("p", { className: "text-sm font-medium", children: title }), description && _jsx("p", { className: "max-w-xs text-xs text-muted-foreground", children: description })] }));
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ export function PanelEmpty(t0) {
5
+ const $ = _c(18);
6
+ let className;
7
+ let description;
8
+ let icon;
9
+ let props;
10
+ let title;
11
+ if ($[0] !== t0) {
12
+ ({
13
+ icon,
14
+ title,
15
+ description,
16
+ className,
17
+ ...props
18
+ } = t0);
19
+ $[0] = t0;
20
+ $[1] = className;
21
+ $[2] = description;
22
+ $[3] = icon;
23
+ $[4] = props;
24
+ $[5] = title;
25
+ } else {
26
+ className = $[1];
27
+ description = $[2];
28
+ icon = $[3];
29
+ props = $[4];
30
+ title = $[5];
31
+ }
32
+ let t1;
33
+ if ($[6] !== className) {
34
+ t1 = cn("flex flex-col items-center gap-1 px-6 pt-8 pb-10 text-center [&_svg]:mb-1 [&_svg]:size-5 [&_svg]:text-muted-foreground", className);
35
+ $[6] = className;
36
+ $[7] = t1;
37
+ } else {
38
+ t1 = $[7];
39
+ }
40
+ let t2;
41
+ if ($[8] !== title) {
42
+ t2 = /*#__PURE__*/_jsx("p", {
43
+ className: "text-sm font-medium",
44
+ children: title
45
+ });
46
+ $[8] = title;
47
+ $[9] = t2;
48
+ } else {
49
+ t2 = $[9];
50
+ }
51
+ let t3;
52
+ if ($[10] !== description) {
53
+ t3 = description && /*#__PURE__*/_jsx("p", {
54
+ className: "max-w-xs text-xs text-muted-foreground",
55
+ children: description
56
+ });
57
+ $[10] = description;
58
+ $[11] = t3;
59
+ } else {
60
+ t3 = $[11];
61
+ }
62
+ let t4;
63
+ if ($[12] !== icon || $[13] !== props || $[14] !== t1 || $[15] !== t2 || $[16] !== t3) {
64
+ t4 = /*#__PURE__*/_jsxs("div", {
65
+ "data-slot": "panel-empty",
66
+ ...props,
67
+ className: t1,
68
+ children: [icon, t2, t3]
69
+ });
70
+ $[12] = icon;
71
+ $[13] = props;
72
+ $[14] = t1;
73
+ $[15] = t2;
74
+ $[16] = t3;
75
+ $[17] = t4;
76
+ } else {
77
+ t4 = $[17];
78
+ }
79
+ return t4;
5
80
  }
@@ -1,21 +1,251 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cn } from "@locusgraph/components";
3
3
  import { StatusDot } from "./status-dot.js";
4
- export function ApprovalPanel({ className, ...props }) {
5
- return (_jsx("section", { className: cn("flex min-w-0 flex-col bg-card text-card-foreground ring-1 ring-border", className), ...props }));
4
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export function ApprovalPanel(t0) {
6
+ const $ = _c(8);
7
+ let className;
8
+ let props;
9
+ if ($[0] !== t0) {
10
+ ({
11
+ className,
12
+ ...props
13
+ } = t0);
14
+ $[0] = t0;
15
+ $[1] = className;
16
+ $[2] = props;
17
+ } else {
18
+ className = $[1];
19
+ props = $[2];
20
+ }
21
+ let t1;
22
+ if ($[3] !== className) {
23
+ t1 = cn("flex min-w-0 flex-col bg-card text-card-foreground ring-1 ring-border", className);
24
+ $[3] = className;
25
+ $[4] = t1;
26
+ } else {
27
+ t1 = $[4];
28
+ }
29
+ let t2;
30
+ if ($[5] !== props || $[6] !== t1) {
31
+ t2 = /*#__PURE__*/_jsx("section", {
32
+ className: t1,
33
+ ...props
34
+ });
35
+ $[5] = props;
36
+ $[6] = t1;
37
+ $[7] = t2;
38
+ } else {
39
+ t2 = $[7];
40
+ }
41
+ return t2;
6
42
  }
7
- export function PanelHeader({ icon, eyebrow, status, tone = "idle", aside }) {
8
- return (_jsxs("header", { "data-slot": "panel-header", className: "eyebrow flex items-center gap-2 px-5 pt-4 [&_svg]:size-3.5 [&_svg]:shrink-0", children: [icon, _jsx("span", { className: "min-w-0 truncate", children: eyebrow }), _jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [aside && _jsx("span", { className: "mr-2 tabular-nums", children: aside }), status && (_jsxs(_Fragment, { children: [_jsx(StatusDot, { tone: tone }), _jsx("span", { children: status })] }))] })] }));
43
+ export function PanelHeader(t0) {
44
+ const $ = _c(14);
45
+ const {
46
+ icon,
47
+ eyebrow,
48
+ status,
49
+ tone: t1,
50
+ aside
51
+ } = t0;
52
+ const tone = t1 === undefined ? "idle" : t1;
53
+ let t2;
54
+ if ($[0] !== eyebrow) {
55
+ t2 = /*#__PURE__*/_jsx("span", {
56
+ className: "min-w-0 truncate",
57
+ children: eyebrow
58
+ });
59
+ $[0] = eyebrow;
60
+ $[1] = t2;
61
+ } else {
62
+ t2 = $[1];
63
+ }
64
+ let t3;
65
+ if ($[2] !== aside) {
66
+ t3 = aside && /*#__PURE__*/_jsx("span", {
67
+ className: "mr-2 tabular-nums",
68
+ children: aside
69
+ });
70
+ $[2] = aside;
71
+ $[3] = t3;
72
+ } else {
73
+ t3 = $[3];
74
+ }
75
+ let t4;
76
+ if ($[4] !== status || $[5] !== tone) {
77
+ t4 = status && /*#__PURE__*/_jsxs(_Fragment, {
78
+ children: [/*#__PURE__*/_jsx(StatusDot, {
79
+ tone: tone
80
+ }), /*#__PURE__*/_jsx("span", {
81
+ children: status
82
+ })]
83
+ });
84
+ $[4] = status;
85
+ $[5] = tone;
86
+ $[6] = t4;
87
+ } else {
88
+ t4 = $[6];
89
+ }
90
+ let t5;
91
+ if ($[7] !== t3 || $[8] !== t4) {
92
+ t5 = /*#__PURE__*/_jsxs("span", {
93
+ className: "ml-auto flex shrink-0 items-center gap-1.5",
94
+ children: [t3, t4]
95
+ });
96
+ $[7] = t3;
97
+ $[8] = t4;
98
+ $[9] = t5;
99
+ } else {
100
+ t5 = $[9];
101
+ }
102
+ let t6;
103
+ if ($[10] !== icon || $[11] !== t2 || $[12] !== t5) {
104
+ t6 = /*#__PURE__*/_jsxs("header", {
105
+ "data-slot": "panel-header",
106
+ className: "eyebrow flex items-center gap-2 px-5 pt-4 [&_svg]:size-3.5 [&_svg]:shrink-0",
107
+ children: [icon, t2, t5]
108
+ });
109
+ $[10] = icon;
110
+ $[11] = t2;
111
+ $[12] = t5;
112
+ $[13] = t6;
113
+ } else {
114
+ t6 = $[13];
115
+ }
116
+ return t6;
9
117
  }
10
- export function PanelTitle({ className, ...props }) {
11
- return (_jsx("h3", { className: cn("px-5 pt-2 font-sans text-base leading-snug font-semibold tracking-tight text-balance", className), ...props }));
118
+ export function PanelTitle(t0) {
119
+ const $ = _c(8);
120
+ let className;
121
+ let props;
122
+ if ($[0] !== t0) {
123
+ ({
124
+ className,
125
+ ...props
126
+ } = t0);
127
+ $[0] = t0;
128
+ $[1] = className;
129
+ $[2] = props;
130
+ } else {
131
+ className = $[1];
132
+ props = $[2];
133
+ }
134
+ let t1;
135
+ if ($[3] !== className) {
136
+ t1 = cn("px-5 pt-2 font-sans text-base leading-snug font-semibold tracking-tight text-balance", className);
137
+ $[3] = className;
138
+ $[4] = t1;
139
+ } else {
140
+ t1 = $[4];
141
+ }
142
+ let t2;
143
+ if ($[5] !== props || $[6] !== t1) {
144
+ t2 = /*#__PURE__*/_jsx("h3", {
145
+ className: t1,
146
+ ...props
147
+ });
148
+ $[5] = props;
149
+ $[6] = t1;
150
+ $[7] = t2;
151
+ } else {
152
+ t2 = $[7];
153
+ }
154
+ return t2;
12
155
  }
13
- export function PanelBody({ className, ...props }) {
14
- return _jsx("div", { className: cn("flex flex-col gap-4 px-5 pt-4 pb-5", className), ...props });
156
+ export function PanelBody(t0) {
157
+ const $ = _c(8);
158
+ let className;
159
+ let props;
160
+ if ($[0] !== t0) {
161
+ ({
162
+ className,
163
+ ...props
164
+ } = t0);
165
+ $[0] = t0;
166
+ $[1] = className;
167
+ $[2] = props;
168
+ } else {
169
+ className = $[1];
170
+ props = $[2];
171
+ }
172
+ let t1;
173
+ if ($[3] !== className) {
174
+ t1 = cn("flex flex-col gap-4 px-5 pt-4 pb-5", className);
175
+ $[3] = className;
176
+ $[4] = t1;
177
+ } else {
178
+ t1 = $[4];
179
+ }
180
+ let t2;
181
+ if ($[5] !== props || $[6] !== t1) {
182
+ t2 = /*#__PURE__*/_jsx("div", {
183
+ className: t1,
184
+ ...props
185
+ });
186
+ $[5] = props;
187
+ $[6] = t1;
188
+ $[7] = t2;
189
+ } else {
190
+ t2 = $[7];
191
+ }
192
+ return t2;
15
193
  }
16
- export function PanelFooter({ className, ...props }) {
17
- return (_jsx("div", { className: cn("flex flex-wrap items-center justify-end gap-2 border-t bg-muted/70 px-5 py-3", className), ...props }));
194
+ export function PanelFooter(t0) {
195
+ const $ = _c(8);
196
+ let className;
197
+ let props;
198
+ if ($[0] !== t0) {
199
+ ({
200
+ className,
201
+ ...props
202
+ } = t0);
203
+ $[0] = t0;
204
+ $[1] = className;
205
+ $[2] = props;
206
+ } else {
207
+ className = $[1];
208
+ props = $[2];
209
+ }
210
+ let t1;
211
+ if ($[3] !== className) {
212
+ t1 = cn("flex flex-wrap items-center justify-end gap-2 border-t bg-muted/70 px-5 py-3", className);
213
+ $[3] = className;
214
+ $[4] = t1;
215
+ } else {
216
+ t1 = $[4];
217
+ }
218
+ let t2;
219
+ if ($[5] !== props || $[6] !== t1) {
220
+ t2 = /*#__PURE__*/_jsx("div", {
221
+ className: t1,
222
+ ...props
223
+ });
224
+ $[5] = props;
225
+ $[6] = t1;
226
+ $[7] = t2;
227
+ } else {
228
+ t2 = $[7];
229
+ }
230
+ return t2;
18
231
  }
19
- export function LiveStatus({ message }) {
20
- return (_jsx("p", { role: "status", "aria-live": "polite", className: "sr-only", children: message }));
232
+ export function LiveStatus(t0) {
233
+ const $ = _c(2);
234
+ const {
235
+ message
236
+ } = t0;
237
+ let t1;
238
+ if ($[0] !== message) {
239
+ t1 = /*#__PURE__*/_jsx("p", {
240
+ role: "status",
241
+ "aria-live": "polite",
242
+ className: "sr-only",
243
+ children: message
244
+ });
245
+ $[0] = message;
246
+ $[1] = t1;
247
+ } else {
248
+ t1 = $[1];
249
+ }
250
+ return t1;
21
251
  }
@@ -1,12 +1,42 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { cn } from "@locusgraph/components";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
3
4
  export const statusDotTones = {
4
- running: "bg-warn motion-safe:animate-pulse",
5
- waiting: "bg-warn motion-safe:animate-pulse",
6
- done: "bg-good",
7
- danger: "bg-destructive",
8
- idle: "bg-muted-foreground/50",
5
+ running: "bg-warn motion-safe:animate-pulse",
6
+ waiting: "bg-warn motion-safe:animate-pulse",
7
+ done: "bg-good",
8
+ danger: "bg-destructive",
9
+ idle: "bg-muted-foreground/50"
9
10
  };
10
- export function StatusDot({ tone, className }) {
11
- return (_jsx("span", { "aria-hidden": true, "data-slot": "status-dot", "data-tone": tone, className: cn("size-1.5 shrink-0 rounded-full", statusDotTones[tone], className) }));
11
+ export function StatusDot(t0) {
12
+ const $ = _c(6);
13
+ const {
14
+ tone,
15
+ className
16
+ } = t0;
17
+ const t1 = statusDotTones[tone];
18
+ let t2;
19
+ if ($[0] !== className || $[1] !== t1) {
20
+ t2 = cn("size-1.5 shrink-0 rounded-full", t1, className);
21
+ $[0] = className;
22
+ $[1] = t1;
23
+ $[2] = t2;
24
+ } else {
25
+ t2 = $[2];
26
+ }
27
+ let t3;
28
+ if ($[3] !== t2 || $[4] !== tone) {
29
+ t3 = /*#__PURE__*/_jsx("span", {
30
+ "aria-hidden": true,
31
+ "data-slot": "status-dot",
32
+ "data-tone": tone,
33
+ className: t2
34
+ });
35
+ $[3] = t2;
36
+ $[4] = tone;
37
+ $[5] = t3;
38
+ } else {
39
+ t3 = $[5];
40
+ }
41
+ return t3;
12
42
  }
@@ -0,0 +1,24 @@
1
+ import { type CSSProperties, type FocusEvent } from "react";
2
+ export declare const virtualizeAboveCount = 50;
3
+ export declare function shouldVirtualize(count: number, virtualize: boolean | undefined): boolean;
4
+ export type ListVirtualizerOptions = {
5
+ count: number;
6
+ getScrollElement: () => HTMLElement | null;
7
+ estimateSize: (index: number) => number;
8
+ getItemKey: (index: number) => string | number;
9
+ anchorTo?: "start" | "end";
10
+ };
11
+ export declare function useListVirtualizer({ count, getScrollElement, estimateSize, getItemKey, anchorTo, }: ListVirtualizerOptions): {
12
+ virtualizer: import("@tanstack/react-virtual").ReactVirtualizer<HTMLElement, HTMLElement>;
13
+ rows: import("@tanstack/react-virtual").VirtualItem[];
14
+ totalSize: number;
15
+ isScrolling: boolean;
16
+ itemProps: (index: number) => {
17
+ "data-index": number;
18
+ ref: (node: HTMLElement | null) => void;
19
+ onFocus: () => void;
20
+ onBlur: (event: FocusEvent<HTMLElement>) => void;
21
+ };
22
+ };
23
+ export declare const virtualRowClassName = "absolute top-0 left-0 w-full";
24
+ export declare function rowOffsetStyle(start: number): CSSProperties;
@@ -0,0 +1,68 @@
1
+ import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
2
+ import { useCallback, useState } from "react";
3
+ export const virtualizeAboveCount = 50;
4
+ const serverViewportRect = {
5
+ width: 0,
6
+ height: 800
7
+ };
8
+ export function shouldVirtualize(count, virtualize) {
9
+ return virtualize !== false && count > virtualizeAboveCount;
10
+ }
11
+ function offsetOfLastScreen(count, estimateSize) {
12
+ let total = 0;
13
+ for (let index = 0; index < count; index += 1) total += estimateSize(index);
14
+ return Math.max(0, total - serverViewportRect.height);
15
+ }
16
+ function keepFocusedRendered(indexes, focusedIndex, count) {
17
+ if (focusedIndex === null || focusedIndex >= count || indexes.includes(focusedIndex)) {
18
+ return indexes;
19
+ }
20
+ return [...indexes, focusedIndex].sort((a, b) => a - b);
21
+ }
22
+ function focusLeft(event) {
23
+ return !event.currentTarget.contains(event.relatedTarget);
24
+ }
25
+ export function useListVirtualizer({
26
+ count,
27
+ getScrollElement,
28
+ estimateSize,
29
+ getItemKey,
30
+ anchorTo = "start"
31
+ }) {
32
+ "use no memo";
33
+
34
+ const [focusedIndex, setFocusedIndex] = useState(null);
35
+ const rangeExtractor = useCallback(range => keepFocusedRendered(defaultRangeExtractor(range), focusedIndex, range.count), [focusedIndex]);
36
+ const virtualizer = useVirtualizer({
37
+ count,
38
+ getScrollElement,
39
+ estimateSize,
40
+ getItemKey,
41
+ rangeExtractor,
42
+ anchorTo,
43
+ initialRect: serverViewportRect,
44
+ initialOffset: () => anchorTo === "end" ? offsetOfLastScreen(count, estimateSize) : 0,
45
+ overscan: 6
46
+ });
47
+ const itemProps = index => ({
48
+ "data-index": index,
49
+ ref: virtualizer.measureElement,
50
+ onFocus: () => setFocusedIndex(index),
51
+ onBlur: event => {
52
+ if (focusLeft(event)) setFocusedIndex(null);
53
+ }
54
+ });
55
+ return {
56
+ virtualizer,
57
+ rows: virtualizer.getVirtualItems(),
58
+ totalSize: virtualizer.getTotalSize(),
59
+ isScrolling: virtualizer.isScrolling,
60
+ itemProps
61
+ };
62
+ }
63
+ export const virtualRowClassName = "absolute top-0 left-0 w-full";
64
+ export function rowOffsetStyle(start) {
65
+ return {
66
+ transform: `translateY(${start}px)`
67
+ };
68
+ }