@stackone/malachite 2.131.0 → 2.133.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.
- package/COMPONENTS.md +8 -8
- package/dist/assets/icons/hexagon_fill.svg.js +6 -0
- package/dist/assets/icons/hexagon_fill.svg.js.map +1 -0
- package/dist/assets/icons/shield_star_fill.svg.js +6 -0
- package/dist/assets/icons/shield_star_fill.svg.js.map +1 -0
- package/dist/components/Button.js.map +1 -1
- package/dist/components/CodeBlock.js +130 -130
- package/dist/components/CodeBlock.js.map +1 -1
- package/dist/components/CodeBlockHighlighter.js +65 -65
- package/dist/components/CodeBlockHighlighter.js.map +1 -1
- package/dist/components/CodePreview.js +74 -63
- package/dist/components/CodePreview.js.map +1 -1
- package/dist/components/FormActions.js +13 -9
- package/dist/components/FormActions.js.map +1 -1
- package/dist/components/Hexagon.js +33 -26
- package/dist/components/Hexagon.js.map +1 -1
- package/dist/components/HexagonScale.js +20 -19
- package/dist/components/HexagonScale.js.map +1 -1
- package/dist/components/Input/Input.js +55 -54
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/KeyValueList.js +36 -32
- package/dist/components/KeyValueList.js.map +1 -1
- package/dist/components/QueryInput.js +91 -90
- package/dist/components/QueryInput.js.map +1 -1
- package/dist/components/Surface.js +1 -1
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +691 -637
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TextArea/TextArea.js +46 -46
- package/dist/components/TextArea/TextArea.js.map +1 -1
- package/dist/components/buttonStyles.js +2 -0
- package/dist/components/buttonStyles.js.map +1 -1
- package/dist/components/codeBlockStyles.js +11 -6
- package/dist/components/codeBlockStyles.js.map +1 -1
- package/dist/components/codePreviewJson.js +25 -0
- package/dist/components/codePreviewJson.js.map +1 -0
- package/dist/index.d.ts +42 -7
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +11 -3
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsxs as A, jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { diffHunks as
|
|
6
|
-
import { CodeLine as
|
|
7
|
-
import { rowsWrapperStyle as
|
|
8
|
-
import { devWarning as
|
|
9
|
-
import { FOCUS_RING_INSET as
|
|
10
|
-
const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */
|
|
11
|
-
const o =
|
|
1
|
+
import { jsxs as A, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import u from "@uiw/react-json-view";
|
|
3
|
+
import C from "react";
|
|
4
|
+
import H from "./CopyOverlayButton.js";
|
|
5
|
+
import { diffHunks as P } from "./codeBlockDiff.js";
|
|
6
|
+
import { CodeLine as q } from "./codeBlockLine.js";
|
|
7
|
+
import { CODE_TOKEN_COLOR as l, rowsWrapperStyle as J } from "./codeBlockStyles.js";
|
|
8
|
+
import { devWarning as W } from "./devWarning.js";
|
|
9
|
+
import { FOCUS_RING_INSET as V, FOCUS_RING as z } from "./focusRing.js";
|
|
10
|
+
const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ n("span", { ...r, style: { ...r.style, color: `var(--w-rjv-type-${o}-color)` }, children: e }) : null, K = (e) => e !== null && typeof e == "object" ? Object.keys(e).length : 0, R = (e, o, r) => r.length > 0 && K(o) > e, B = (e) => {
|
|
11
|
+
const o = K(e);
|
|
12
12
|
return `${o} ${o === 1 ? "item" : "items"}`;
|
|
13
|
-
},
|
|
13
|
+
}, Q = (e) => e.map((o) => String(o) || '""').join("."), X = (e) => (o, { value: r, keys: t }) => o || R(e, r, t), Y = (e) => (o, { value: r, keys: t }) => {
|
|
14
14
|
var m;
|
|
15
|
-
if (!
|
|
15
|
+
if (!R(e, r, t ?? []))
|
|
16
16
|
return null;
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
const p = String(((m = o.style) == null ? void 0 : m.transform) ?? "").includes("-90");
|
|
18
|
+
return /* @__PURE__ */ n(
|
|
19
19
|
"button",
|
|
20
20
|
{
|
|
21
21
|
type: "button",
|
|
22
|
-
"aria-expanded": !
|
|
23
|
-
"aria-label": `${
|
|
22
|
+
"aria-expanded": !p,
|
|
23
|
+
"aria-label": `${Q(t ?? [])}, ${B(r)}`,
|
|
24
24
|
className: `${o.className ?? ""} inline-flex cursor-pointer items-center border-0 bg-transparent p-0 text-inherit ${z}`,
|
|
25
25
|
style: o.style,
|
|
26
26
|
children: o.children
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
|
-
},
|
|
29
|
+
}, Z = (e) => (
|
|
30
30
|
// This slot gets no `keys`; the root alone has no `keyName`, as the arrow's slot reads it.
|
|
31
|
-
((o, { value: r, keyName: t }) => Reflect.get(o, "data-expanded") &&
|
|
31
|
+
((o, { value: r, keyName: t }) => Reflect.get(o, "data-expanded") && R(e, r, t === void 0 ? [] : [t]) ? (
|
|
32
32
|
// Its toggle already names the size, so this would say it twice.
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ n(
|
|
34
34
|
"span",
|
|
35
35
|
{
|
|
36
36
|
"aria-hidden": "true",
|
|
@@ -39,67 +39,67 @@ const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ c("span"
|
|
|
39
39
|
}
|
|
40
40
|
)
|
|
41
41
|
) : null)
|
|
42
|
-
),
|
|
42
|
+
), E = C.lazy(() => import("./CodeBlockHighlighter.js")), L = {
|
|
43
43
|
added: "var(--malachite-codeblock-diff-added-background)",
|
|
44
44
|
removed: "var(--malachite-codeblock-diff-removed-background)",
|
|
45
45
|
context: void 0
|
|
46
|
-
},
|
|
46
|
+
}, ee = {
|
|
47
47
|
added: "+",
|
|
48
48
|
removed: "-",
|
|
49
49
|
context: void 0
|
|
50
|
-
},
|
|
50
|
+
}, oe = {
|
|
51
51
|
added: "var(--malachite-codeblock-diff-assistant-background)",
|
|
52
52
|
removed: "var(--malachite-codeblock-diff-assistant-removed-background)",
|
|
53
53
|
context: void 0
|
|
54
|
-
},
|
|
54
|
+
}, re = {
|
|
55
55
|
added: "✦",
|
|
56
56
|
// U+2212 minus sign, not a hyphen: the mock is explicit about which glyph.
|
|
57
57
|
removed: "−",
|
|
58
58
|
context: "·"
|
|
59
|
-
},
|
|
59
|
+
}, te = {
|
|
60
60
|
added: "var(--malachite-codeblock-diff-assistant-foreground)",
|
|
61
61
|
removed: "var(--malachite-codeblock-diff-removed-foreground)",
|
|
62
62
|
context: "var(--malachite-codeblock-diff-context-foreground)"
|
|
63
|
-
},
|
|
63
|
+
}, ne = (e) => `⋯ ${e} unchanged ${e === 1 ? "line" : "lines"}`, le = (e, o, r) => {
|
|
64
64
|
const t = r === "assistant";
|
|
65
65
|
return {
|
|
66
|
-
background: t ?
|
|
67
|
-
marker: t ?
|
|
68
|
-
markerColor: t ?
|
|
66
|
+
background: t ? oe[e.type] : L[e.type],
|
|
67
|
+
marker: t ? re[e.type] : ee[e.type],
|
|
68
|
+
markerColor: t ? te[e.type] : void 0,
|
|
69
69
|
// Reserved on unchanged rows too, so the code column does not step in and out.
|
|
70
70
|
reserveMarker: !0,
|
|
71
71
|
// Context rows read as de-emphasised, not just unmarked, in the assistant palette.
|
|
72
72
|
textColor: t && e.type === "context" ? "var(--malachite-codeblock-diff-context-text)" : void 0,
|
|
73
73
|
strikethrough: t && e.type === "removed",
|
|
74
|
-
separatorAbove: e.skippedAbove === void 0 ? void 0 :
|
|
74
|
+
separatorAbove: e.skippedAbove === void 0 ? void 0 : ne(e.skippedAbove),
|
|
75
75
|
// A removed line has no number in the after-text, so it keeps the one it had before.
|
|
76
76
|
lineNumber: o ? e.afterNumber ?? e.beforeNumber : void 0
|
|
77
77
|
};
|
|
78
|
-
},
|
|
78
|
+
}, pe = ({
|
|
79
79
|
code: e,
|
|
80
80
|
json: o,
|
|
81
81
|
showLineNumbers: r = !0,
|
|
82
82
|
className: t = "",
|
|
83
|
-
style:
|
|
83
|
+
style: p = {},
|
|
84
84
|
height: m,
|
|
85
|
-
enableCopy:
|
|
86
|
-
wrapLines:
|
|
87
|
-
language:
|
|
88
|
-
collapsed:
|
|
89
|
-
collapseLargerThan:
|
|
90
|
-
diff:
|
|
91
|
-
"aria-label":
|
|
92
|
-
"aria-labelledby":
|
|
85
|
+
enableCopy: N = !0,
|
|
86
|
+
wrapLines: k = !1,
|
|
87
|
+
language: y,
|
|
88
|
+
collapsed: U = !1,
|
|
89
|
+
collapseLargerThan: d,
|
|
90
|
+
diff: i,
|
|
91
|
+
"aria-label": h,
|
|
92
|
+
"aria-labelledby": g
|
|
93
93
|
}) => {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
`CodeBlock.collapseLargerThan:${
|
|
97
|
-
`CodeBlock's collapseLargerThan takes a whole count of 0 or more; ${
|
|
94
|
+
const _ = C.useId(), a = d !== void 0 && Number.isInteger(d) && d >= 0 ? d : void 0;
|
|
95
|
+
d !== void 0 && a === void 0 && W(
|
|
96
|
+
`CodeBlock.collapseLargerThan:${d}`,
|
|
97
|
+
`CodeBlock's collapseLargerThan takes a whole count of 0 or more; ${d} is ignored.`
|
|
98
98
|
);
|
|
99
|
-
const
|
|
100
|
-
`)) ?? "",
|
|
101
|
-
if (
|
|
102
|
-
return
|
|
99
|
+
const c = i ? P(i.before, i.after, i.context) : null, x = (c == null ? void 0 : c.map((v) => v.text).join(`
|
|
100
|
+
`)) ?? "", F = (() => {
|
|
101
|
+
if (c)
|
|
102
|
+
return x;
|
|
103
103
|
if (e)
|
|
104
104
|
return e;
|
|
105
105
|
if (o !== void 0)
|
|
@@ -108,27 +108,27 @@ const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ c("span"
|
|
|
108
108
|
} catch {
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
})(),
|
|
112
|
-
|
|
111
|
+
})(), D = N && F !== void 0 && /* @__PURE__ */ n(
|
|
112
|
+
H,
|
|
113
113
|
{
|
|
114
|
-
text:
|
|
115
|
-
...
|
|
116
|
-
id:
|
|
114
|
+
text: F,
|
|
115
|
+
...g ? {
|
|
116
|
+
id: _,
|
|
117
117
|
"aria-label": "Copy",
|
|
118
|
-
"aria-labelledby": `${
|
|
119
|
-
} : { "aria-label":
|
|
118
|
+
"aria-labelledby": `${_} ${g}`
|
|
119
|
+
} : { "aria-label": h ? `Copy ${h}` : "Copy" },
|
|
120
120
|
iconSize: 14,
|
|
121
121
|
className: `absolute top-2 right-2 z-10 flex items-center justify-center rounded-md border border-solid border-[var(--malachite-codeblock-border)] bg-[var(--malachite-codeblock-background)] p-1.5 transition-colors hover:bg-[var(--malachite-codeblock-border)] ${z}`,
|
|
122
122
|
style: { color: "var(--malachite-codeblock-line-number)" }
|
|
123
123
|
}
|
|
124
124
|
), b = {
|
|
125
125
|
role: "region",
|
|
126
|
-
"aria-label":
|
|
127
|
-
"aria-labelledby":
|
|
126
|
+
"aria-label": g ? h : h ?? "Code",
|
|
127
|
+
"aria-labelledby": g,
|
|
128
128
|
tabIndex: 0,
|
|
129
|
-
className: `box-border h-full overflow-auto ${
|
|
129
|
+
className: `box-border h-full overflow-auto ${V}`
|
|
130
130
|
};
|
|
131
|
-
if (o && !
|
|
131
|
+
if (o && !c)
|
|
132
132
|
return /* @__PURE__ */ A(
|
|
133
133
|
"div",
|
|
134
134
|
{
|
|
@@ -137,12 +137,12 @@ const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ c("span"
|
|
|
137
137
|
backgroundColor: "var(--malachite-codeblock-background)",
|
|
138
138
|
borderColor: "var(--malachite-codeblock-border)",
|
|
139
139
|
height: m,
|
|
140
|
-
...
|
|
140
|
+
...p
|
|
141
141
|
},
|
|
142
142
|
children: [
|
|
143
|
-
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
143
|
+
D,
|
|
144
|
+
/* @__PURE__ */ n("div", { ...b, children: /* @__PURE__ */ A(
|
|
145
|
+
u,
|
|
146
146
|
{
|
|
147
147
|
value: o,
|
|
148
148
|
style: {
|
|
@@ -154,50 +154,50 @@ const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ c("span"
|
|
|
154
154
|
lineHeight: "1.5",
|
|
155
155
|
textAlign: "left",
|
|
156
156
|
"--w-rjv-color": "var(--malachite-codeblock-foreground)",
|
|
157
|
-
"--w-rjv-key-string":
|
|
157
|
+
"--w-rjv-key-string": l.keyword,
|
|
158
158
|
"--w-rjv-background-color": "var(--malachite-codeblock-background)",
|
|
159
159
|
"--w-rjv-line-color": "var(--malachite-codeblock-border)",
|
|
160
160
|
"--w-rjv-arrow-color": "var(--malachite-codeblock-line-number)",
|
|
161
|
-
"--w-rjv-edit-color":
|
|
161
|
+
"--w-rjv-edit-color": l.keyword,
|
|
162
162
|
"--w-rjv-info-color": "var(--malachite-codeblock-line-number)",
|
|
163
|
-
"--w-rjv-update-color":
|
|
164
|
-
"--w-rjv-copied-color":
|
|
165
|
-
"--w-rjv-copied-success-color":
|
|
163
|
+
"--w-rjv-update-color": l.keyword,
|
|
164
|
+
"--w-rjv-copied-color": l.string,
|
|
165
|
+
"--w-rjv-copied-success-color": l.string,
|
|
166
166
|
"--w-rjv-curlybraces-color": "var(--malachite-codeblock-foreground)",
|
|
167
167
|
"--w-rjv-colon-color": "var(--malachite-codeblock-foreground)",
|
|
168
168
|
"--w-rjv-brackets-color": "var(--malachite-codeblock-foreground)",
|
|
169
|
-
"--w-rjv-quotes-color":
|
|
170
|
-
"--w-rjv-quotes-string-color":
|
|
171
|
-
"--w-rjv-type-string-color":
|
|
172
|
-
"--w-rjv-type-int-color":
|
|
173
|
-
"--w-rjv-type-float-color":
|
|
174
|
-
"--w-rjv-type-bigint-color":
|
|
175
|
-
"--w-rjv-type-boolean-color":
|
|
176
|
-
"--w-rjv-type-date-color":
|
|
177
|
-
"--w-rjv-type-url-color":
|
|
178
|
-
"--w-rjv-type-null-color":
|
|
179
|
-
"--w-rjv-type-nan-color":
|
|
180
|
-
"--w-rjv-type-undefined-color":
|
|
169
|
+
"--w-rjv-quotes-color": l.string,
|
|
170
|
+
"--w-rjv-quotes-string-color": l.string,
|
|
171
|
+
"--w-rjv-type-string-color": l.string,
|
|
172
|
+
"--w-rjv-type-int-color": l.number,
|
|
173
|
+
"--w-rjv-type-float-color": l.number,
|
|
174
|
+
"--w-rjv-type-bigint-color": l.number,
|
|
175
|
+
"--w-rjv-type-boolean-color": l.keyword,
|
|
176
|
+
"--w-rjv-type-date-color": l.string,
|
|
177
|
+
"--w-rjv-type-url-color": l.keyword,
|
|
178
|
+
"--w-rjv-type-null-color": l.keyword,
|
|
179
|
+
"--w-rjv-type-nan-color": l.keyword,
|
|
180
|
+
"--w-rjv-type-undefined-color": l.keyword
|
|
181
181
|
},
|
|
182
182
|
displayDataTypes: !1,
|
|
183
|
-
enableClipboard:
|
|
184
|
-
collapsed:
|
|
185
|
-
shouldExpandNodeInitially:
|
|
183
|
+
enableClipboard: N,
|
|
184
|
+
collapsed: U,
|
|
185
|
+
shouldExpandNodeInitially: a === void 0 ? void 0 : X(a),
|
|
186
186
|
displayObjectSize: !1,
|
|
187
187
|
children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
|
|
188
|
+
/* @__PURE__ */ n(u.Null, { render: I("null", "null") }),
|
|
189
|
+
/* @__PURE__ */ n(u.Undefined, { render: I("undefined", "undefined") }),
|
|
190
|
+
/* @__PURE__ */ n(u.Nan, { render: I("NaN", "nan") }),
|
|
191
|
+
/* @__PURE__ */ n(
|
|
192
|
+
u.Arrow,
|
|
193
193
|
{
|
|
194
|
-
render:
|
|
194
|
+
render: a === void 0 ? void 0 : Y(a)
|
|
195
195
|
}
|
|
196
196
|
),
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
|
|
197
|
+
/* @__PURE__ */ n(
|
|
198
|
+
u.Ellipsis,
|
|
199
199
|
{
|
|
200
|
-
render:
|
|
200
|
+
render: a === void 0 ? void 0 : Z(a)
|
|
201
201
|
}
|
|
202
202
|
)
|
|
203
203
|
]
|
|
@@ -206,34 +206,34 @@ const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ c("span"
|
|
|
206
206
|
]
|
|
207
207
|
}
|
|
208
208
|
);
|
|
209
|
-
const
|
|
210
|
-
const
|
|
209
|
+
const w = N && (!!e || !!c), S = (v, s) => {
|
|
210
|
+
const $ = v.split(`
|
|
211
211
|
`);
|
|
212
|
-
return /* @__PURE__ */
|
|
212
|
+
return /* @__PURE__ */ n(
|
|
213
213
|
"div",
|
|
214
214
|
{
|
|
215
215
|
...b,
|
|
216
216
|
className: `${b.className} p-4 text-left`,
|
|
217
|
-
style: { paddingRight:
|
|
218
|
-
children: /* @__PURE__ */
|
|
219
|
-
const
|
|
220
|
-
return /* @__PURE__ */
|
|
221
|
-
|
|
217
|
+
style: { paddingRight: w ? 44 : void 0 },
|
|
218
|
+
children: /* @__PURE__ */ n("div", { style: J(k), children: $.map((f, O) => {
|
|
219
|
+
const j = s == null ? void 0 : s(O);
|
|
220
|
+
return /* @__PURE__ */ n(
|
|
221
|
+
q,
|
|
222
222
|
{
|
|
223
|
-
line:
|
|
224
|
-
lineNumber: (
|
|
225
|
-
wrap:
|
|
226
|
-
decoration:
|
|
227
|
-
children:
|
|
223
|
+
line: f,
|
|
224
|
+
lineNumber: (j == null ? void 0 : j.lineNumber) ?? (r ? O + 1 : void 0),
|
|
225
|
+
wrap: k,
|
|
226
|
+
decoration: j,
|
|
227
|
+
children: f
|
|
228
228
|
},
|
|
229
|
-
|
|
229
|
+
O
|
|
230
230
|
);
|
|
231
231
|
}) })
|
|
232
232
|
}
|
|
233
233
|
);
|
|
234
|
-
},
|
|
235
|
-
if (
|
|
236
|
-
return /* @__PURE__ */
|
|
234
|
+
}, T = () => e ? S(e) : null, G = (v) => {
|
|
235
|
+
if (v.length === 0)
|
|
236
|
+
return /* @__PURE__ */ n(
|
|
237
237
|
"div",
|
|
238
238
|
{
|
|
239
239
|
className: "p-4 text-left",
|
|
@@ -241,33 +241,33 @@ const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ c("span"
|
|
|
241
241
|
children: "No changes"
|
|
242
242
|
}
|
|
243
243
|
);
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
return
|
|
244
|
+
const s = ($) => {
|
|
245
|
+
const f = v[$];
|
|
246
|
+
return f ? le(f, r, i == null ? void 0 : i.origin) : void 0;
|
|
247
247
|
};
|
|
248
|
-
return
|
|
249
|
-
|
|
248
|
+
return y ? /* @__PURE__ */ n(C.Suspense, { fallback: S(x, s), children: /* @__PURE__ */ n(
|
|
249
|
+
E,
|
|
250
250
|
{
|
|
251
|
-
code:
|
|
252
|
-
language:
|
|
251
|
+
code: x,
|
|
252
|
+
language: y,
|
|
253
253
|
showLineNumbers: r,
|
|
254
|
-
wrapLines:
|
|
255
|
-
copyClearance:
|
|
256
|
-
decorate:
|
|
254
|
+
wrapLines: k,
|
|
255
|
+
copyClearance: w,
|
|
256
|
+
decorate: s,
|
|
257
257
|
viewportProps: b
|
|
258
258
|
}
|
|
259
|
-
) }) :
|
|
260
|
-
},
|
|
261
|
-
|
|
259
|
+
) }) : S(x, s);
|
|
260
|
+
}, M = () => e ? y ? /* @__PURE__ */ n(C.Suspense, { fallback: T(), children: /* @__PURE__ */ n(
|
|
261
|
+
E,
|
|
262
262
|
{
|
|
263
263
|
code: e,
|
|
264
|
-
language:
|
|
264
|
+
language: y,
|
|
265
265
|
showLineNumbers: r,
|
|
266
|
-
wrapLines:
|
|
267
|
-
copyClearance:
|
|
266
|
+
wrapLines: k,
|
|
267
|
+
copyClearance: w,
|
|
268
268
|
viewportProps: b
|
|
269
269
|
}
|
|
270
|
-
) }) :
|
|
270
|
+
) }) : T() : null;
|
|
271
271
|
return /* @__PURE__ */ A(
|
|
272
272
|
"div",
|
|
273
273
|
{
|
|
@@ -276,16 +276,16 @@ const I = (e, o) => (r, { type: t }) => t === "value" ? /* @__PURE__ */ c("span"
|
|
|
276
276
|
backgroundColor: "var(--malachite-codeblock-background)",
|
|
277
277
|
borderColor: "var(--malachite-codeblock-border)",
|
|
278
278
|
height: m,
|
|
279
|
-
...
|
|
279
|
+
...p
|
|
280
280
|
},
|
|
281
281
|
children: [
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
D,
|
|
283
|
+
c ? G(c) : M()
|
|
284
284
|
]
|
|
285
285
|
}
|
|
286
286
|
);
|
|
287
287
|
};
|
|
288
288
|
export {
|
|
289
|
-
|
|
289
|
+
pe as default
|
|
290
290
|
};
|
|
291
291
|
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.js","sources":["../../src/components/CodeBlock.tsx"],"sourcesContent":["import JsonView from '@uiw/react-json-view';\nimport React from 'react';\nimport CopyOverlayButton from './CopyOverlayButton';\nimport { type DiffDisplayRow, type DiffRowType, diffHunks } from './codeBlockDiff';\nimport { CodeLine, type CodeLineDecoration } from './codeBlockLine';\nimport { rowsWrapperStyle } from './codeBlockStyles';\nimport { devWarning } from './devWarning';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\n\n/**\n * The value side of a JSON literal that has no value of its own to print, in its type's\n * colour. These read as keywords, as `true` and `false` do: the comment grey is under AA\n * contrast on the light background.\n */\nconst renderLiteral =\n (text: string, type: 'null' | 'undefined' | 'nan') =>\n (props: React.HTMLAttributes<HTMLSpanElement>, { type: part }: { type: 'type' | 'value' }) =>\n part === 'value' ? (\n <span {...props} style={{ ...props.style, color: `var(--w-rjv-type-${type}-color)` }}>\n {text}\n </span>\n ) : null;\n\n/** A json node's own entries, as the library counts them to draw it. */\nconst entryCount = (value: unknown): number =>\n value !== null && typeof value === 'object' ? Object.keys(value).length : 0;\n\n/** A nested node over the limit: the only kind the limit folds, toggles and sizes. */\nconst isOverLimit = (limit: number, value: unknown, keys: readonly (number | string)[]): boolean =>\n keys.length > 0 && entryCount(value) > limit;\n\nconst sizeOf = (value: unknown): string => {\n const count = entryCount(value);\n return `${count} ${count === 1 ? 'item' : 'items'}`;\n};\n\n/** Where a node sits, so two toggles for nodes sharing a key read apart: `users.0.roles`. */\nconst pathOf = (keys: readonly (number | string)[]): string =>\n keys.map((key) => String(key) || '\"\"').join('.');\n\n// The library's flag is the inverse of its name: returning true starts the node collapsed.\nconst collapseNodesLargerThan =\n (limit: number) =>\n (\n isCollapsed: boolean,\n { value, keys }: { value?: unknown; keys: (number | string)[] },\n ): boolean =>\n isCollapsed || isOverLimit(limit, value, keys);\n\n// The row around the arrow owns the click and the arrow's rotation is its only state, so this\n// button is a keyboard toggle that reads `aria-expanded` from it.\nconst toggleArrowOver =\n (limit: number) =>\n (\n props: { className?: string; style?: React.CSSProperties; children?: React.ReactNode },\n { value, keys }: { value?: unknown; keys?: (number | string)[] },\n ) => {\n if (!isOverLimit(limit, value, keys ?? [])) {\n return null;\n }\n const collapsed = String(props.style?.transform ?? '').includes('-90');\n return (\n <button\n type=\"button\"\n aria-expanded={!collapsed}\n aria-label={`${pathOf(keys ?? [])}, ${sizeOf(value)}`}\n className={`${props.className ?? ''} inline-flex cursor-pointer items-center border-0 bg-transparent p-0 text-inherit ${FOCUS_RING}`}\n style={props.style}\n >\n {props.children}\n </button>\n );\n };\n\nconst foldedSizeOver =\n (limit: number) =>\n // This slot gets no `keys`; the root alone has no `keyName`, as the arrow's slot reads it.\n (props: object, { value, keyName }: { value?: unknown; keyName?: string | number }) =>\n Reflect.get(props, 'data-expanded') &&\n isOverLimit(limit, value, keyName === undefined ? [] : [keyName]) ? (\n // Its toggle already names the size, so this would say it twice.\n <span\n aria-hidden=\"true\"\n className={`${Reflect.get(props, 'className') ?? ''} mx-[4px] cursor-pointer select-none text-[var(--malachite-codeblock-foreground)]`}\n >\n {`\\u2026 ${sizeOf(value)}`}\n </span>\n ) : null;\n\nconst CodeBlockHighlighter = React.lazy(() => import('./CodeBlockHighlighter'));\n\nexport interface CodeBlockProps {\n /** The code content to display */\n code?: string;\n /** JSON object to display as formatted JSON */\n json?: object;\n /** Show line numbers */\n showLineNumbers?: boolean;\n /** Custom class name */\n className?: string;\n /** Custom styles */\n style?: React.CSSProperties;\n /** Height of the code block */\n height?: string | number;\n /** Enable copy functionality */\n enableCopy?: boolean;\n /** Wrap long lines instead of scrolling horizontally */\n wrapLines?: boolean;\n /**\n * Highlight the code with this language's grammar. `cedar` is a grammar this library\n * ships itself (`prismCedar.ts`), since Prism and refractor carry none; widen the union\n * as further grammars are registered in CodeBlockHighlighter.\n */\n language?: 'yaml' | 'cedar';\n /** How much of a `json` tree starts collapsed: `true` all of it, a number below that depth. */\n collapsed?: boolean | number;\n /**\n * Starts any nested node with more entries than this collapsed, at any depth, behind a keyboard\n * toggle naming its path and size; nodes within the limit keep the library's arrow. 0 or more.\n */\n collapseLargerThan?: number;\n /**\n * Renders the change between two texts rather than one text, and takes precedence over\n * `code` and `json`. Only the changed lines are shown, with `context` unchanged ones either\n * side, so a small edit to a long document reads as a few hunks instead of the whole thing.\n */\n diff?: {\n before: string;\n after: string;\n /** Unchanged lines kept either side of each change. Three by convention. */\n context?: number;\n /**\n * Swaps the `+`/`-` gutter and tinted rows for the palette a mock specified for\n * AI-authored changes: star, minus-sign and middle-dot markers, and a struck-through\n * removal. Omit to keep the neutral markers; there is no default consumer for the\n * assistant look yet.\n */\n origin?: 'assistant';\n };\n /** Names the scrollable region, and the copy button as \"Copy\" and this. Defaults to \"Code\". */\n 'aria-label'?: string;\n /** Names the scrollable region and the copy button by a visible label instead of `aria-label`. */\n 'aria-labelledby'?: string;\n}\n\nconst DIFF_BACKGROUNDS: Record<DiffRowType, string | undefined> = {\n added: 'var(--malachite-codeblock-diff-added-background)',\n removed: 'var(--malachite-codeblock-diff-removed-background)',\n context: undefined,\n};\n\nconst DIFF_MARKERS: Record<DiffRowType, string | undefined> = {\n added: '+',\n removed: '-',\n context: undefined,\n};\n\n// The assistant palette also marks context rows, which the neutral one leaves bare.\nconst ASSISTANT_DIFF_BACKGROUNDS: Record<DiffRowType, string | undefined> = {\n added: 'var(--malachite-codeblock-diff-assistant-background)',\n removed: 'var(--malachite-codeblock-diff-assistant-removed-background)',\n context: undefined,\n};\n\nconst ASSISTANT_DIFF_MARKERS: Record<DiffRowType, string> = {\n added: '\\u2726',\n // U+2212 minus sign, not a hyphen: the mock is explicit about which glyph.\n removed: '\\u2212',\n context: '\\u00b7',\n};\n\nconst ASSISTANT_DIFF_MARKER_COLORS: Record<DiffRowType, string> = {\n added: 'var(--malachite-codeblock-diff-assistant-foreground)',\n removed: 'var(--malachite-codeblock-diff-removed-foreground)',\n context: 'var(--malachite-codeblock-diff-context-foreground)',\n};\n\nconst unchangedRun = (count: number): string =>\n `\\u22ef ${count} unchanged ${count === 1 ? 'line' : 'lines'}`;\n\nconst diffDecoration = (\n row: DiffDisplayRow,\n showLineNumbers: boolean,\n origin?: 'assistant',\n): CodeLineDecoration => {\n const assistant = origin === 'assistant';\n\n return {\n background: assistant ? ASSISTANT_DIFF_BACKGROUNDS[row.type] : DIFF_BACKGROUNDS[row.type],\n marker: assistant ? ASSISTANT_DIFF_MARKERS[row.type] : DIFF_MARKERS[row.type],\n markerColor: assistant ? ASSISTANT_DIFF_MARKER_COLORS[row.type] : undefined,\n // Reserved on unchanged rows too, so the code column does not step in and out.\n reserveMarker: true,\n // Context rows read as de-emphasised, not just unmarked, in the assistant palette.\n textColor:\n assistant && row.type === 'context'\n ? 'var(--malachite-codeblock-diff-context-text)'\n : undefined,\n strikethrough: assistant && row.type === 'removed',\n separatorAbove: row.skippedAbove === undefined ? undefined : unchangedRun(row.skippedAbove),\n // A removed line has no number in the after-text, so it keeps the one it had before.\n lineNumber: showLineNumbers ? (row.afterNumber ?? row.beforeNumber) : undefined,\n };\n};\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({\n code,\n json,\n showLineNumbers = true,\n className = '',\n style = {},\n height,\n enableCopy = true,\n wrapLines = false,\n language,\n collapsed = false,\n collapseLargerThan,\n diff,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const copyId = React.useId();\n const limit =\n collapseLargerThan !== undefined &&\n Number.isInteger(collapseLargerThan) &&\n collapseLargerThan >= 0\n ? collapseLargerThan\n : undefined;\n if (collapseLargerThan !== undefined && limit === undefined) {\n devWarning(\n `CodeBlock.collapseLargerThan:${collapseLargerThan}`,\n `CodeBlock's collapseLargerThan takes a whole count of 0 or more; ${collapseLargerThan} is ignored.`,\n );\n }\n const diffRows = diff ? diffHunks(diff.before, diff.after, diff.context) : null;\n const diffText = diffRows?.map((row) => row.text).join('\\n') ?? '';\n\n /**\n * What the button puts on the clipboard, in the same form the block is showing. A JSON\n * block is pretty-printed rather than handed over minified: the reader is copying what\n * they can see. `undefined` means there is nothing to copy and no button to offer.\n */\n const copyText = (): string | undefined => {\n if (diffRows) {\n return diffText;\n }\n\n // An empty block has nothing to copy, so it offers no button — `!== undefined` would\n // hand back the empty string and put a dead control on it.\n if (code) {\n return code;\n }\n\n if (json !== undefined) {\n try {\n return JSON.stringify(json, null, 2);\n } catch {\n // A cycle or a BigInt: no honest text to copy, so offer no button.\n return undefined;\n }\n }\n\n return undefined;\n };\n\n const textToCopy = copyText();\n\n // Declared once and rendered by both the JSON branch and the code branch below, so the\n // two tabs of one document do not disagree about whether it can be copied.\n const copyButton = enableCopy && textToCopy !== undefined && (\n <CopyOverlayButton\n text={textToCopy}\n // Named after the block, so a page of blocks has a \"Copy\" for each rather than\n // several alike. Its own id leads the list to keep the word \"Copy\" in the name.\n {...(ariaLabelledBy\n ? {\n id: copyId,\n 'aria-label': 'Copy',\n 'aria-labelledby': `${copyId} ${ariaLabelledBy}`,\n }\n : { 'aria-label': ariaLabel ? `Copy ${ariaLabel}` : 'Copy' })}\n iconSize={14}\n className={`absolute top-2 right-2 z-10 flex items-center justify-center rounded-md border border-solid border-[var(--malachite-codeblock-border)] bg-[var(--malachite-codeblock-background)] p-1.5 transition-colors hover:bg-[var(--malachite-codeblock-border)] ${FOCUS_RING}`}\n style={{ color: 'var(--malachite-codeblock-line-number)' }}\n />\n );\n\n // Tabbable so a keyboard can scroll it: Safari never focuses a scroll container on its own.\n const viewportProps = {\n role: 'region',\n 'aria-label': ariaLabelledBy ? ariaLabel : (ariaLabel ?? 'Code'),\n 'aria-labelledby': ariaLabelledBy,\n tabIndex: 0,\n className: `box-border h-full overflow-auto ${FOCUS_RING_INSET}`,\n } satisfies React.HTMLAttributes<HTMLElement>;\n\n // If JSON is provided, use JsonView component\n if (json && !diffRows) {\n return (\n <div\n className={`relative border border-solid rounded-lg overflow-hidden ${className}`}\n style={{\n backgroundColor: 'var(--malachite-codeblock-background)',\n borderColor: 'var(--malachite-codeblock-border)',\n height,\n ...style,\n }}\n >\n {copyButton}\n {/* The frame clips at `height`; this scrolls inside it, so the copy button stays put. */}\n <div {...viewportProps}>\n <JsonView\n value={json}\n style={\n {\n backgroundColor: 'var(--malachite-codeblock-background)',\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n padding: '16px',\n lineHeight: '1.5',\n textAlign: 'left',\n '--w-rjv-color': 'var(--malachite-codeblock-foreground)',\n '--w-rjv-key-string': 'var(--malachite-codeblock-keyword)',\n '--w-rjv-background-color': 'var(--malachite-codeblock-background)',\n '--w-rjv-line-color': 'var(--malachite-codeblock-border)',\n '--w-rjv-arrow-color': 'var(--malachite-codeblock-line-number)',\n '--w-rjv-edit-color': 'var(--malachite-codeblock-keyword)',\n '--w-rjv-info-color': 'var(--malachite-codeblock-line-number)',\n '--w-rjv-update-color': 'var(--malachite-codeblock-keyword)',\n '--w-rjv-copied-color': 'var(--malachite-codeblock-string)',\n '--w-rjv-copied-success-color': 'var(--malachite-codeblock-string)',\n '--w-rjv-curlybraces-color':\n 'var(--malachite-codeblock-foreground)',\n '--w-rjv-colon-color': 'var(--malachite-codeblock-foreground)',\n '--w-rjv-brackets-color': 'var(--malachite-codeblock-foreground)',\n '--w-rjv-quotes-color': 'var(--malachite-codeblock-string)',\n '--w-rjv-quotes-string-color': 'var(--malachite-codeblock-string)',\n '--w-rjv-type-string-color': 'var(--malachite-codeblock-string)',\n '--w-rjv-type-int-color': 'var(--malachite-codeblock-number)',\n '--w-rjv-type-float-color': 'var(--malachite-codeblock-number)',\n '--w-rjv-type-bigint-color': 'var(--malachite-codeblock-number)',\n '--w-rjv-type-boolean-color': 'var(--malachite-codeblock-keyword)',\n '--w-rjv-type-date-color': 'var(--malachite-codeblock-string)',\n '--w-rjv-type-url-color': 'var(--malachite-codeblock-keyword)',\n '--w-rjv-type-null-color': 'var(--malachite-codeblock-keyword)',\n '--w-rjv-type-nan-color': 'var(--malachite-codeblock-keyword)',\n '--w-rjv-type-undefined-color':\n 'var(--malachite-codeblock-keyword)',\n } as React.CSSProperties\n }\n displayDataTypes={false}\n enableClipboard={enableCopy}\n collapsed={collapsed}\n shouldExpandNodeInitially={\n limit === undefined ? undefined : collapseNodesLargerThan(limit)\n }\n displayObjectSize={false}\n >\n {/* The library draws these three only as their type label, which\n `displayDataTypes` turns off, so without a value of their own a\n `null` reads as a key with nothing after it. */}\n <JsonView.Null render={renderLiteral('null', 'null')} />\n <JsonView.Undefined render={renderLiteral('undefined', 'undefined')} />\n <JsonView.Nan render={renderLiteral('NaN', 'nan')} />\n {/* Mounted either way: the library keeps a slot's last render, so it is\n switched off by passing none rather than by unmounting. */}\n <JsonView.Arrow\n render={limit === undefined ? undefined : toggleArrowOver(limit)}\n />\n <JsonView.Ellipsis\n render={limit === undefined ? undefined : foldedSizeOver(limit)}\n />\n </JsonView>\n </div>\n </div>\n );\n }\n\n // Reserve clearance so a wide first line never sits under the floating copy button.\n const copyClearance = enableCopy && (!!code || !!diffRows);\n\n const renderPlainLines = (\n text: string,\n decorate?: (index: number) => CodeLineDecoration | undefined,\n ) => {\n const lines = text.split('\\n');\n\n return (\n <div\n {...viewportProps}\n className={`${viewportProps.className} p-4 text-left`}\n style={{ paddingRight: copyClearance ? 44 : undefined }}\n >\n <div style={rowsWrapperStyle(wrapLines)}>\n {lines.map((line, index) => {\n const decoration = decorate?.(index);\n\n return (\n <CodeLine\n key={index}\n line={line}\n lineNumber={\n decoration?.lineNumber ??\n (showLineNumbers ? index + 1 : undefined)\n }\n wrap={wrapLines}\n decoration={decoration}\n >\n {line}\n </CodeLine>\n );\n })}\n </div>\n </div>\n );\n };\n\n const renderPlainCode = () => (code ? renderPlainLines(code) : null);\n\n const renderDiff = (rows: DiffDisplayRow[]) => {\n if (rows.length === 0) {\n return (\n <div\n className=\"p-4 text-left\"\n style={{ color: 'var(--malachite-codeblock-comment)' }}\n >\n No changes\n </div>\n );\n }\n\n const decorate = (index: number) => {\n const row = rows[index];\n\n return row ? diffDecoration(row, showLineNumbers, diff?.origin) : undefined;\n };\n\n if (language) {\n return (\n <React.Suspense fallback={renderPlainLines(diffText, decorate)}>\n {/*\n * The whole merged text goes to the highlighter in one piece, so a hunk\n * is tokenised in the company of its neighbours rather than on its own.\n * Prism still cannot see the lines the hunks left out, so a construct\n * spanning an omitted run can highlight oddly — the reason `context`\n * defaults to a few lines rather than none.\n */}\n <CodeBlockHighlighter\n code={diffText}\n language={language}\n showLineNumbers={showLineNumbers}\n wrapLines={wrapLines}\n copyClearance={copyClearance}\n decorate={decorate}\n viewportProps={viewportProps}\n />\n </React.Suspense>\n );\n }\n\n return renderPlainLines(diffText, decorate);\n };\n\n // For code strings, create a simple syntax-highlighted view\n const renderCodeContent = () => {\n if (!code) {\n return null;\n }\n\n if (language) {\n return (\n <React.Suspense fallback={renderPlainCode()}>\n <CodeBlockHighlighter\n code={code}\n language={language}\n showLineNumbers={showLineNumbers}\n wrapLines={wrapLines}\n copyClearance={copyClearance}\n viewportProps={viewportProps}\n />\n </React.Suspense>\n );\n }\n\n return renderPlainCode();\n };\n\n return (\n <div\n className={`relative border border-solid rounded-lg overflow-hidden ${className}`}\n style={{\n backgroundColor: 'var(--malachite-codeblock-background)',\n borderColor: 'var(--malachite-codeblock-border)',\n height,\n ...style,\n }}\n >\n {copyButton}\n {diffRows ? renderDiff(diffRows) : renderCodeContent()}\n </div>\n );\n};\n\nexport default CodeBlock;\n"],"names":["renderLiteral","text","type","props","part","jsx","entryCount","value","isOverLimit","limit","keys","sizeOf","count","pathOf","key","collapseNodesLargerThan","isCollapsed","toggleArrowOver","collapsed","_a","FOCUS_RING","foldedSizeOver","keyName","CodeBlockHighlighter","React","DIFF_BACKGROUNDS","DIFF_MARKERS","ASSISTANT_DIFF_BACKGROUNDS","ASSISTANT_DIFF_MARKERS","ASSISTANT_DIFF_MARKER_COLORS","unchangedRun","diffDecoration","row","showLineNumbers","origin","assistant","CodeBlock","code","json","className","style","height","enableCopy","wrapLines","language","collapseLargerThan","diff","ariaLabel","ariaLabelledBy","copyId","devWarning","diffRows","diffHunks","diffText","textToCopy","copyButton","CopyOverlayButton","viewportProps","FOCUS_RING_INSET","jsxs","JsonView","copyClearance","renderPlainLines","decorate","lines","rowsWrapperStyle","line","index","decoration","CodeLine","renderPlainCode","renderDiff","rows","renderCodeContent"],"mappings":";;;;;;;;;AAcA,MAAMA,IACF,CAACC,GAAcC,MACf,CAACC,GAA8C,EAAE,MAAMC,EAAA,MACnDA,MAAS,UACL,gBAAAC,EAAC,QAAA,EAAM,GAAGF,GAAO,OAAO,EAAE,GAAGA,EAAM,OAAO,OAAO,oBAAoBD,CAAI,UAAA,GACpE,UAAAD,EAAA,CACL,IACA,MAGNK,IAAa,CAACC,MAChBA,MAAU,QAAQ,OAAOA,KAAU,WAAW,OAAO,KAAKA,CAAK,EAAE,SAAS,GAGxEC,IAAc,CAACC,GAAeF,GAAgBG,MAChDA,EAAK,SAAS,KAAKJ,EAAWC,CAAK,IAAIE,GAErCE,IAAS,CAACJ,MAA2B;AACvC,QAAMK,IAAQN,EAAWC,CAAK;AAC9B,SAAO,GAAGK,CAAK,IAAIA,MAAU,IAAI,SAAS,OAAO;AACrD,GAGMC,IAAS,CAAC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,QACA,GAAGD;AAAA,MAAA;AAAA,MAGN,UAAA;AAAA,QAAAe;AAAA,QACAJ,IAAWoB,EAAWpB,CAAQ,IAAIsB,EAAA;AAAA,MAAkB;AAAA,IAAA;AAAA,EAAA;AAGjE;"}
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","sources":["../../src/components/CodeBlock.tsx"],"sourcesContent":["import JsonView from '@uiw/react-json-view';\nimport React from 'react';\nimport CopyOverlayButton from './CopyOverlayButton';\nimport { type DiffDisplayRow, type DiffRowType, diffHunks } from './codeBlockDiff';\nimport { CodeLine, type CodeLineDecoration } from './codeBlockLine';\nimport { CODE_TOKEN_COLOR, rowsWrapperStyle } from './codeBlockStyles';\nimport { devWarning } from './devWarning';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\n\n/**\n * The value side of a JSON literal that has no value of its own to print, in its type's\n * colour. These read as keywords, as `true` and `false` do: the comment grey is under AA\n * contrast on the light background.\n */\nconst renderLiteral =\n (text: string, type: 'null' | 'undefined' | 'nan') =>\n (props: React.HTMLAttributes<HTMLSpanElement>, { type: part }: { type: 'type' | 'value' }) =>\n part === 'value' ? (\n <span {...props} style={{ ...props.style, color: `var(--w-rjv-type-${type}-color)` }}>\n {text}\n </span>\n ) : null;\n\n/** A json node's own entries, as the library counts them to draw it. */\nconst entryCount = (value: unknown): number =>\n value !== null && typeof value === 'object' ? Object.keys(value).length : 0;\n\n/** A nested node over the limit: the only kind the limit folds, toggles and sizes. */\nconst isOverLimit = (limit: number, value: unknown, keys: readonly (number | string)[]): boolean =>\n keys.length > 0 && entryCount(value) > limit;\n\nconst sizeOf = (value: unknown): string => {\n const count = entryCount(value);\n return `${count} ${count === 1 ? 'item' : 'items'}`;\n};\n\n/** Where a node sits, so two toggles for nodes sharing a key read apart: `users.0.roles`. */\nconst pathOf = (keys: readonly (number | string)[]): string =>\n keys.map((key) => String(key) || '\"\"').join('.');\n\n// The library's flag is the inverse of its name: returning true starts the node collapsed.\nconst collapseNodesLargerThan =\n (limit: number) =>\n (\n isCollapsed: boolean,\n { value, keys }: { value?: unknown; keys: (number | string)[] },\n ): boolean =>\n isCollapsed || isOverLimit(limit, value, keys);\n\n// The row around the arrow owns the click and the arrow's rotation is its only state, so this\n// button is a keyboard toggle that reads `aria-expanded` from it.\nconst toggleArrowOver =\n (limit: number) =>\n (\n props: { className?: string; style?: React.CSSProperties; children?: React.ReactNode },\n { value, keys }: { value?: unknown; keys?: (number | string)[] },\n ) => {\n if (!isOverLimit(limit, value, keys ?? [])) {\n return null;\n }\n const collapsed = String(props.style?.transform ?? '').includes('-90');\n return (\n <button\n type=\"button\"\n aria-expanded={!collapsed}\n aria-label={`${pathOf(keys ?? [])}, ${sizeOf(value)}`}\n className={`${props.className ?? ''} inline-flex cursor-pointer items-center border-0 bg-transparent p-0 text-inherit ${FOCUS_RING}`}\n style={props.style}\n >\n {props.children}\n </button>\n );\n };\n\nconst foldedSizeOver =\n (limit: number) =>\n // This slot gets no `keys`; the root alone has no `keyName`, as the arrow's slot reads it.\n (props: object, { value, keyName }: { value?: unknown; keyName?: string | number }) =>\n Reflect.get(props, 'data-expanded') &&\n isOverLimit(limit, value, keyName === undefined ? [] : [keyName]) ? (\n // Its toggle already names the size, so this would say it twice.\n <span\n aria-hidden=\"true\"\n className={`${Reflect.get(props, 'className') ?? ''} mx-[4px] cursor-pointer select-none text-[var(--malachite-codeblock-foreground)]`}\n >\n {`\\u2026 ${sizeOf(value)}`}\n </span>\n ) : null;\n\nconst CodeBlockHighlighter = React.lazy(() => import('./CodeBlockHighlighter'));\n\nexport interface CodeBlockProps {\n /** The code content to display */\n code?: string;\n /** JSON object to display as formatted JSON */\n json?: object;\n /** Show line numbers */\n showLineNumbers?: boolean;\n /** Custom class name */\n className?: string;\n /** Custom styles */\n style?: React.CSSProperties;\n /** Height of the code block */\n height?: string | number;\n /** Enable copy functionality */\n enableCopy?: boolean;\n /** Wrap long lines instead of scrolling horizontally */\n wrapLines?: boolean;\n /**\n * Highlight the code with this language's grammar. `cedar` is a grammar this library\n * ships itself (`prismCedar.ts`), since Prism and refractor carry none; widen the union\n * as further grammars are registered in CodeBlockHighlighter.\n */\n language?: 'yaml' | 'cedar';\n /** How much of a `json` tree starts collapsed: `true` all of it, a number below that depth. */\n collapsed?: boolean | number;\n /**\n * Starts any nested node with more entries than this collapsed, at any depth, behind a keyboard\n * toggle naming its path and size; nodes within the limit keep the library's arrow. 0 or more.\n */\n collapseLargerThan?: number;\n /**\n * Renders the change between two texts rather than one text, and takes precedence over\n * `code` and `json`. Only the changed lines are shown, with `context` unchanged ones either\n * side, so a small edit to a long document reads as a few hunks instead of the whole thing.\n */\n diff?: {\n before: string;\n after: string;\n /** Unchanged lines kept either side of each change. Three by convention. */\n context?: number;\n /**\n * Swaps the `+`/`-` gutter and tinted rows for the palette a mock specified for\n * AI-authored changes: star, minus-sign and middle-dot markers, and a struck-through\n * removal. Omit to keep the neutral markers; there is no default consumer for the\n * assistant look yet.\n */\n origin?: 'assistant';\n };\n /** Names the scrollable region, and the copy button as \"Copy\" and this. Defaults to \"Code\". */\n 'aria-label'?: string;\n /** Names the scrollable region and the copy button by a visible label instead of `aria-label`. */\n 'aria-labelledby'?: string;\n}\n\nconst DIFF_BACKGROUNDS: Record<DiffRowType, string | undefined> = {\n added: 'var(--malachite-codeblock-diff-added-background)',\n removed: 'var(--malachite-codeblock-diff-removed-background)',\n context: undefined,\n};\n\nconst DIFF_MARKERS: Record<DiffRowType, string | undefined> = {\n added: '+',\n removed: '-',\n context: undefined,\n};\n\n// The assistant palette also marks context rows, which the neutral one leaves bare.\nconst ASSISTANT_DIFF_BACKGROUNDS: Record<DiffRowType, string | undefined> = {\n added: 'var(--malachite-codeblock-diff-assistant-background)',\n removed: 'var(--malachite-codeblock-diff-assistant-removed-background)',\n context: undefined,\n};\n\nconst ASSISTANT_DIFF_MARKERS: Record<DiffRowType, string> = {\n added: '\\u2726',\n // U+2212 minus sign, not a hyphen: the mock is explicit about which glyph.\n removed: '\\u2212',\n context: '\\u00b7',\n};\n\nconst ASSISTANT_DIFF_MARKER_COLORS: Record<DiffRowType, string> = {\n added: 'var(--malachite-codeblock-diff-assistant-foreground)',\n removed: 'var(--malachite-codeblock-diff-removed-foreground)',\n context: 'var(--malachite-codeblock-diff-context-foreground)',\n};\n\nconst unchangedRun = (count: number): string =>\n `\\u22ef ${count} unchanged ${count === 1 ? 'line' : 'lines'}`;\n\nconst diffDecoration = (\n row: DiffDisplayRow,\n showLineNumbers: boolean,\n origin?: 'assistant',\n): CodeLineDecoration => {\n const assistant = origin === 'assistant';\n\n return {\n background: assistant ? ASSISTANT_DIFF_BACKGROUNDS[row.type] : DIFF_BACKGROUNDS[row.type],\n marker: assistant ? ASSISTANT_DIFF_MARKERS[row.type] : DIFF_MARKERS[row.type],\n markerColor: assistant ? ASSISTANT_DIFF_MARKER_COLORS[row.type] : undefined,\n // Reserved on unchanged rows too, so the code column does not step in and out.\n reserveMarker: true,\n // Context rows read as de-emphasised, not just unmarked, in the assistant palette.\n textColor:\n assistant && row.type === 'context'\n ? 'var(--malachite-codeblock-diff-context-text)'\n : undefined,\n strikethrough: assistant && row.type === 'removed',\n separatorAbove: row.skippedAbove === undefined ? undefined : unchangedRun(row.skippedAbove),\n // A removed line has no number in the after-text, so it keeps the one it had before.\n lineNumber: showLineNumbers ? (row.afterNumber ?? row.beforeNumber) : undefined,\n };\n};\n\nconst CodeBlock: React.FC<CodeBlockProps> = ({\n code,\n json,\n showLineNumbers = true,\n className = '',\n style = {},\n height,\n enableCopy = true,\n wrapLines = false,\n language,\n collapsed = false,\n collapseLargerThan,\n diff,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const copyId = React.useId();\n const limit =\n collapseLargerThan !== undefined &&\n Number.isInteger(collapseLargerThan) &&\n collapseLargerThan >= 0\n ? collapseLargerThan\n : undefined;\n if (collapseLargerThan !== undefined && limit === undefined) {\n devWarning(\n `CodeBlock.collapseLargerThan:${collapseLargerThan}`,\n `CodeBlock's collapseLargerThan takes a whole count of 0 or more; ${collapseLargerThan} is ignored.`,\n );\n }\n const diffRows = diff ? diffHunks(diff.before, diff.after, diff.context) : null;\n const diffText = diffRows?.map((row) => row.text).join('\\n') ?? '';\n\n /**\n * What the button puts on the clipboard, in the same form the block is showing. A JSON\n * block is pretty-printed rather than handed over minified: the reader is copying what\n * they can see. `undefined` means there is nothing to copy and no button to offer.\n */\n const copyText = (): string | undefined => {\n if (diffRows) {\n return diffText;\n }\n\n // An empty block has nothing to copy, so it offers no button — `!== undefined` would\n // hand back the empty string and put a dead control on it.\n if (code) {\n return code;\n }\n\n if (json !== undefined) {\n try {\n return JSON.stringify(json, null, 2);\n } catch {\n // A cycle or a BigInt: no honest text to copy, so offer no button.\n return undefined;\n }\n }\n\n return undefined;\n };\n\n const textToCopy = copyText();\n\n // Declared once and rendered by both the JSON branch and the code branch below, so the\n // two tabs of one document do not disagree about whether it can be copied.\n const copyButton = enableCopy && textToCopy !== undefined && (\n <CopyOverlayButton\n text={textToCopy}\n // Named after the block, so a page of blocks has a \"Copy\" for each rather than\n // several alike. Its own id leads the list to keep the word \"Copy\" in the name.\n {...(ariaLabelledBy\n ? {\n id: copyId,\n 'aria-label': 'Copy',\n 'aria-labelledby': `${copyId} ${ariaLabelledBy}`,\n }\n : { 'aria-label': ariaLabel ? `Copy ${ariaLabel}` : 'Copy' })}\n iconSize={14}\n className={`absolute top-2 right-2 z-10 flex items-center justify-center rounded-md border border-solid border-[var(--malachite-codeblock-border)] bg-[var(--malachite-codeblock-background)] p-1.5 transition-colors hover:bg-[var(--malachite-codeblock-border)] ${FOCUS_RING}`}\n style={{ color: 'var(--malachite-codeblock-line-number)' }}\n />\n );\n\n // Tabbable so a keyboard can scroll it: Safari never focuses a scroll container on its own.\n const viewportProps = {\n role: 'region',\n 'aria-label': ariaLabelledBy ? ariaLabel : (ariaLabel ?? 'Code'),\n 'aria-labelledby': ariaLabelledBy,\n tabIndex: 0,\n className: `box-border h-full overflow-auto ${FOCUS_RING_INSET}`,\n } satisfies React.HTMLAttributes<HTMLElement>;\n\n // If JSON is provided, use JsonView component\n if (json && !diffRows) {\n return (\n <div\n className={`relative border border-solid rounded-lg overflow-hidden ${className}`}\n style={{\n backgroundColor: 'var(--malachite-codeblock-background)',\n borderColor: 'var(--malachite-codeblock-border)',\n height,\n ...style,\n }}\n >\n {copyButton}\n {/* The frame clips at `height`; this scrolls inside it, so the copy button stays put. */}\n <div {...viewportProps}>\n <JsonView\n value={json}\n style={\n {\n backgroundColor: 'var(--malachite-codeblock-background)',\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n padding: '16px',\n lineHeight: '1.5',\n textAlign: 'left',\n '--w-rjv-color': 'var(--malachite-codeblock-foreground)',\n '--w-rjv-key-string': CODE_TOKEN_COLOR.keyword,\n '--w-rjv-background-color': 'var(--malachite-codeblock-background)',\n '--w-rjv-line-color': 'var(--malachite-codeblock-border)',\n '--w-rjv-arrow-color': 'var(--malachite-codeblock-line-number)',\n '--w-rjv-edit-color': CODE_TOKEN_COLOR.keyword,\n '--w-rjv-info-color': 'var(--malachite-codeblock-line-number)',\n '--w-rjv-update-color': CODE_TOKEN_COLOR.keyword,\n '--w-rjv-copied-color': CODE_TOKEN_COLOR.string,\n '--w-rjv-copied-success-color': CODE_TOKEN_COLOR.string,\n '--w-rjv-curlybraces-color':\n 'var(--malachite-codeblock-foreground)',\n '--w-rjv-colon-color': 'var(--malachite-codeblock-foreground)',\n '--w-rjv-brackets-color': 'var(--malachite-codeblock-foreground)',\n '--w-rjv-quotes-color': CODE_TOKEN_COLOR.string,\n '--w-rjv-quotes-string-color': CODE_TOKEN_COLOR.string,\n '--w-rjv-type-string-color': CODE_TOKEN_COLOR.string,\n '--w-rjv-type-int-color': CODE_TOKEN_COLOR.number,\n '--w-rjv-type-float-color': CODE_TOKEN_COLOR.number,\n '--w-rjv-type-bigint-color': CODE_TOKEN_COLOR.number,\n '--w-rjv-type-boolean-color': CODE_TOKEN_COLOR.keyword,\n '--w-rjv-type-date-color': CODE_TOKEN_COLOR.string,\n '--w-rjv-type-url-color': CODE_TOKEN_COLOR.keyword,\n '--w-rjv-type-null-color': CODE_TOKEN_COLOR.keyword,\n '--w-rjv-type-nan-color': CODE_TOKEN_COLOR.keyword,\n '--w-rjv-type-undefined-color': CODE_TOKEN_COLOR.keyword,\n } as React.CSSProperties\n }\n displayDataTypes={false}\n enableClipboard={enableCopy}\n collapsed={collapsed}\n shouldExpandNodeInitially={\n limit === undefined ? undefined : collapseNodesLargerThan(limit)\n }\n displayObjectSize={false}\n >\n {/* The library draws these three only as their type label, which\n `displayDataTypes` turns off, so without a value of their own a\n `null` reads as a key with nothing after it. */}\n <JsonView.Null render={renderLiteral('null', 'null')} />\n <JsonView.Undefined render={renderLiteral('undefined', 'undefined')} />\n <JsonView.Nan render={renderLiteral('NaN', 'nan')} />\n {/* Mounted either way: the library keeps a slot's last render, so it is\n switched off by passing none rather than by unmounting. */}\n <JsonView.Arrow\n render={limit === undefined ? undefined : toggleArrowOver(limit)}\n />\n <JsonView.Ellipsis\n render={limit === undefined ? undefined : foldedSizeOver(limit)}\n />\n </JsonView>\n </div>\n </div>\n );\n }\n\n // Reserve clearance so a wide first line never sits under the floating copy button.\n const copyClearance = enableCopy && (!!code || !!diffRows);\n\n const renderPlainLines = (\n text: string,\n decorate?: (index: number) => CodeLineDecoration | undefined,\n ) => {\n const lines = text.split('\\n');\n\n return (\n <div\n {...viewportProps}\n className={`${viewportProps.className} p-4 text-left`}\n style={{ paddingRight: copyClearance ? 44 : undefined }}\n >\n <div style={rowsWrapperStyle(wrapLines)}>\n {lines.map((line, index) => {\n const decoration = decorate?.(index);\n\n return (\n <CodeLine\n key={index}\n line={line}\n lineNumber={\n decoration?.lineNumber ??\n (showLineNumbers ? index + 1 : undefined)\n }\n wrap={wrapLines}\n decoration={decoration}\n >\n {line}\n </CodeLine>\n );\n })}\n </div>\n </div>\n );\n };\n\n const renderPlainCode = () => (code ? renderPlainLines(code) : null);\n\n const renderDiff = (rows: DiffDisplayRow[]) => {\n if (rows.length === 0) {\n return (\n <div\n className=\"p-4 text-left\"\n style={{ color: 'var(--malachite-codeblock-comment)' }}\n >\n No changes\n </div>\n );\n }\n\n const decorate = (index: number) => {\n const row = rows[index];\n\n return row ? diffDecoration(row, showLineNumbers, diff?.origin) : undefined;\n };\n\n if (language) {\n return (\n <React.Suspense fallback={renderPlainLines(diffText, decorate)}>\n {/*\n * The whole merged text goes to the highlighter in one piece, so a hunk\n * is tokenised in the company of its neighbours rather than on its own.\n * Prism still cannot see the lines the hunks left out, so a construct\n * spanning an omitted run can highlight oddly — the reason `context`\n * defaults to a few lines rather than none.\n */}\n <CodeBlockHighlighter\n code={diffText}\n language={language}\n showLineNumbers={showLineNumbers}\n wrapLines={wrapLines}\n copyClearance={copyClearance}\n decorate={decorate}\n viewportProps={viewportProps}\n />\n </React.Suspense>\n );\n }\n\n return renderPlainLines(diffText, decorate);\n };\n\n // For code strings, create a simple syntax-highlighted view\n const renderCodeContent = () => {\n if (!code) {\n return null;\n }\n\n if (language) {\n return (\n <React.Suspense fallback={renderPlainCode()}>\n <CodeBlockHighlighter\n code={code}\n language={language}\n showLineNumbers={showLineNumbers}\n wrapLines={wrapLines}\n copyClearance={copyClearance}\n viewportProps={viewportProps}\n />\n </React.Suspense>\n );\n }\n\n return renderPlainCode();\n };\n\n return (\n <div\n className={`relative border border-solid rounded-lg overflow-hidden ${className}`}\n style={{\n backgroundColor: 'var(--malachite-codeblock-background)',\n borderColor: 'var(--malachite-codeblock-border)',\n height,\n ...style,\n }}\n >\n {copyButton}\n {diffRows ? renderDiff(diffRows) : renderCodeContent()}\n </div>\n );\n};\n\nexport default CodeBlock;\n"],"names":["renderLiteral","text","type","props","part","jsx","entryCount","value","isOverLimit","limit","keys","sizeOf","count","pathOf","key","collapseNodesLargerThan","isCollapsed","toggleArrowOver","collapsed","_a","FOCUS_RING","foldedSizeOver","keyName","CodeBlockHighlighter","React","DIFF_BACKGROUNDS","DIFF_MARKERS","ASSISTANT_DIFF_BACKGROUNDS","ASSISTANT_DIFF_MARKERS","ASSISTANT_DIFF_MARKER_COLORS","unchangedRun","diffDecoration","row","showLineNumbers","origin","assistant","CodeBlock","code","json","className","style","height","enableCopy","wrapLines","language","collapseLargerThan","diff","ariaLabel","ariaLabelledBy","copyId","devWarning","diffRows","diffHunks","diffText","textToCopy","copyButton","CopyOverlayButton","viewportProps","FOCUS_RING_INSET","jsxs","JsonView","CODE_TOKEN_COLOR","copyClearance","renderPlainLines","decorate","lines","rowsWrapperStyle","line","index","decoration","CodeLine","renderPlainCode","renderDiff","rows","renderCodeContent"],"mappings":";;;;;;;;;AAcA,MAAMA,IACF,CAACC,GAAcC,MACf,CAACC,GAA8C,EAAE,MAAMC,EAAA,MACnDA,MAAS,UACL,gBAAAC,EAAC,QAAA,EAAM,GAAGF,GAAO,OAAO,EAAE,GAAGA,EAAM,OAAO,OAAO,oBAAoBD,CAAI,UAAA,GACpE,UAAAD,EAAA,CACL,IACA,MAGNK,IAAa,CAACC,MAChBA,MAAU,QAAQ,OAAOA,KAAU,WAAW,OAAO,KAAKA,CAAK,EAAE,SAAS,GAGxEC,IAAc,CAACC,GAAeF,GAAgBG,MAChDA,EAAK,SAAS,KAAKJ,EAAWC,CAAK,IAAIE,GAErCE,IAAS,CAACJ,MAA2B;AACvC,QAAMK,IAAQN,EAAWC,CAAK;AAC9B,SAAO,GAAGK,CAAK,IAAIA,MAAU,IAAI,SAAS,OAAO;AACrD,GAGMC,IAAS,CAACH,MACZA,EAAK,IAAI,CAACI,MAAQ,OAAOA,CAAG,KAAK,IAAI,EAAE,KAAK,GAAG,GAG7CC,IACF,CAACN,MACD,CACIO,GACA,EAAE,OAAAT,GAAO,MAAAG,EAAA,MAETM,KAAeR,EAAYC,GAAOF,GAAOG,CAAI,GAI/CO,IACF,CAACR,MACD,CACIN,GACA,EAAE,OAAAI,GAAO,MAAAG,QACR;;AACD,M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