@stackone/malachite 2.131.0 → 2.132.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 +3 -3
- 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/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/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/QueryInput.js +91 -90
- package/dist/components/QueryInput.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 +9 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -130,8 +130,8 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
130
130
|
|
|
131
131
|
- **`LevelMeter`** — Rising bars, shortest first, that picture how much of a scale is on — an access level in a level menu or on a level chip. Each step is `on` (a solid accent-green bar), `partial` (a green outline over a faint tint, for a step only some of whose actions are on) or `off` (an empty grey outline); every step keeps 3:1 against the surface, and colours come from the theme. Styled inline so it still draws inside an `ActionMenu`, which portals outside the shadow root and its stylesheet. Beside text that already names the level it is decorative and hidden from assistive tech; give it a `label` only when it stands alone and it reads as an image of that name. As an `ActionMenu` item `icon` or a `Button` `icon`, leave `label` off: the icon joins the item name, and the text already says the level. _Key props:_ `steps` (`LevelMeterStep[]`: `on` | `partial` | `off`), `label`, `className`.
|
|
132
132
|
- **`ScoreMeter`** — A score from 0 to 1 on a track that runs from a low end to a high end through the success, warning and error colours, such as a classifier’s confidence that a response holds a prompt injection. A ringed marker sits at the score, painted by `tone` for the outcome it led to, and an optional line marks the `threshold` where it starts to count as high; leave `threshold` out when it is not known and no line or threshold label is drawn. `lowLabel`, `highLabel` and `thresholdLabel` sit under the track and are hidden from assistive tech, which reads the `meter` by its `label` and `valueText` instead. Scores outside 0 to 1, or not a number, are clamped onto the scale. _Key props:_ `value`, `label`, `valueText`, `threshold`, `thresholdLabel`, `lowLabel`, `highLabel`, `tone` (`ScoreMeterTone`: `neutral` | `success` | `warning` | `error`; default `neutral`), `className`.
|
|
133
|
-
- **`Hexagon`** — A filled hexagon in one status tone
|
|
134
|
-
- **`HexagonScale`** — A row of small hexagons, one per step of an ordered scale, with the `current` step at full strength and the rest dimmed to 20%; with no `current` every step is dimmed. Built for a `LinkCard`’s `trailing` slot, where it places an outcome on a scale such as allowed → redacted → monitored → denied. Beside text that already names the step it is decorative and hidden from assistive tech; give it a `label` only when it stands alone and it reads as an image of that name. `stepLabels` names each step in a tooltip on its
|
|
133
|
+
- **`Hexagon`** — A filled hexagon (or, with `shape="shield"`, a shield with a star cut out) in one status tone: the mark for an outcome, or a risk or protection level when a shield, as a `LinkCard` `icon` and the unit of a `HexagonScale`. Tones fill from the theme: `neutral` grey (`text.dimmed`), `success` green (`text.success`), `caution` pale amber (`warning.fillMuted`), `warning` amber (`warning.fill`), `error` red (`error.background`, as `TimeBarChart` fills it). `dimmed` draws it at 20% for a step of a scale that is not the current one. Always decorative and hidden from assistive tech, so the text beside it has to name what it marks. Styled inline so it still draws outside the shadow root’s stylesheet. _Key props:_ `tone` (`HexagonTone`: `neutral` | `success` | `caution` | `warning` | `error`; default `neutral`), `size` (`HexagonSize`: `small` 16px | `medium` 18px; default `medium`), `shape` (`HexagonShape`: `hexagon` | `shield`; default `hexagon`; shields for a risk or protection level), `dimmed`, `className`.
|
|
134
|
+
- **`HexagonScale`** — A row of small hexagons (or shields, with `shape="shield"`, for a risk or protection level), one per step of an ordered scale, with the `current` step at full strength and the rest dimmed to 20%; with no `current` every step is dimmed. Built for a `LinkCard`’s `trailing` slot, where it places an outcome or risk level on a scale such as allowed → redacted → monitored → denied, or low → critical with shields. Beside text that already names the step it is decorative and hidden from assistive tech; give it a `label` only when it stands alone and it reads as an image of that name. `stepLabels` names each step in a tooltip on its mark, and `currentNote` follows the current step’s name there, such as “High · this call”; the tooltips open on hover only, add no tab stops and need the shadow root’s stylesheet, so leave `stepLabels` off in an `ActionMenu`. Styled inline so it still draws inside an `ActionMenu`, which portals outside the shadow root. _Key props:_ `steps` (`HexagonTone[]`, in order), `shape` (`HexagonShape`; default `hexagon`), `current` (index of the step drawn at full strength), `label`, `stepLabels`, `currentNote`, `className`.
|
|
135
135
|
- **`TimeBarChart`** — Counts per time bucket as stacked bars on a UTC axis, the request-volume chart above a log list. Every bucket in `range` takes a slot whether or not it has data, so gaps read as gaps; a zone-less time string is read as UTC. Hover or arrow-key through buckets for a tooltip listing every series and the total; `highlightTime` shades the bucket holding a time from elsewhere on the page, such as the hovered log row. With `onRangeSelect`, dragging across bars reports the whole buckets covered, `end` exclusive so it goes straight back in as `range`, and whether the selection takes in the last bucket. `loading` dims bars already drawn rather than replacing them, and shows a spinner only when there is nothing to dim. Series colours follow the theme’s status tokens by `tone`, and failures always stack above successes whatever order `series` comes in, so position separates them where colour alone might not; a legend names them unless `legend={false}`. A visually hidden table carries the same numbers for screen readers. _Key props:_ `series` (`{ key, label, tone }[]`, stacked by tone with `error` on top; `TimeBarChartTone`: `success` | `error` | `neutral`), `buckets` (`{ start, values }[]`), `interval` (`{ unit, step }`; `TimeBarChartUnit`: `minute` | `hour` | `day` | `week` | `month`), `range` (`end` exclusive, as a selection reports it; at most 2,000 buckets, the newest kept), `TimeBarChartSize` (`small` | `medium` | `large`), `loading`, `error`, `errorTitle`, `errorSubTitle`, `valueLabel`, `legend`, `highlightTime`, `onRangeSelect`, `aria-label`, `aria-labelledby`, `className`, `style`.
|
|
136
136
|
- **`TimeBarChartSwatch`** — The mark a `TimeBarChart` draws a series in, by its `tone`, for naming the series somewhere other than the chart's legend, such as a count beside the chart standing in for it. It matches the legend and the tooltip, and the bars draw the same colour at 40%; it follows the theme with them. Decorative: the label beside it does the naming. _Key props:_ `tone` (`TimeBarChartTone`).
|
|
137
137
|
- **`Timeline`** — A vertical sequence of steps as an ordered list (`Timeline.Item`): a dot on a connecting line, a title, its timing at the right and a free-form body below, such as what happened to one API call. `titleCode` sets code after the title in the mono face as one phrase with it, such as `n8n called` then `Salesforce | Delete contact`. The dot is painted by `tone` from the theme’s text tokens (`neutral` is secondary text, the rest their status colours), or replaced by a decorative `marker` such as the caller’s logo. `icon` keeps the ring and draws a 12-14px glyph inside it in place of the dot, painted by `tone`, such as the call’s source type (MCP, API key, webhook); `skipped` beats `marker`, which beats `icon`. `stopped` puts an error badge (`stoppedLabel`, default "Stopped here") after the title of the step a flow ended on and paints its dot `error` unless a `tone` is set; the line ends at the last item. `meta` puts facts about a step in one wrapping row under its title, such as `calls` 2 and `status` 200, each label secondary and its value in the mono face, 18px apart, as a `dl`. `skipped` marks a step that never ran with a grey chevron in place of the dot; the title has to say so. For steps a person works through (complete, open, locked) use `StepList`. _Key props:_ `aria-label`, `aria-labelledby`; on `Timeline.Item`: `title`, `eyebrow` (a short label above the title naming the stage), `titleCode`, `time`, `tone` (`TimelineTone`: `neutral` | `info` | `success` | `warning` | `error`), `marker` (fills the 24px circle in place of the ringed dot), `icon` (a glyph inside the ring, painted by `tone`), `skipped`, `stopped`, `stoppedLabel`, `meta` (`TimelineMetaEntry[]`: `label`, `value`).
|
|
@@ -144,7 +144,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
144
144
|
- **`AppLogo`** — A connector's mark, optionally with its name and version tag. Builds on `Avatar`, so a missing or broken logo falls back to the generic "no logo available" placeholder, a neutral grey tile with a darker square, the same mark stackone-logos.com serves. The gap tightens below 18px so the mark and label still read as one unit. _Key props:_ `src`, `name`, `showName`, `size`, `nameSize`, `nameWeight`, `version`, `truncate`, `className`.
|
|
145
145
|
- **`ConnectionHeader`** — Two tilted logo tiles (from → to) showing a connection between apps. _Key props:_ `from`, `to` (`ConnectionEndpoint`: `icon`, `label`, `background`).
|
|
146
146
|
- **`CodeBlock`** — Syntax-styled code block, a JSON tree, or a diff. A `json` tree folds by depth with `collapsed`; `collapseLargerThan` also starts any nested array or object with more entries than the limit collapsed at any depth, so a large payload mounts a row per node rather than per item; a node over the limit gets a keyboard toggle named by its path and size, and a folded one says how many entries it holds. _Key props:_ `code`, `json`, `language` (`yaml` | `cedar`), `collapsed`, `collapseLargerThan`, `diff`, `showLineNumbers`, `wrapLines`, `enableCopy`, `height`, `aria-label`, `aria-labelledby`.
|
|
147
|
-
- **`CodePreview`** — A framed payload, such as the raw request or response under a step of a trace: a header naming it with mono `meta` at the right, its first `previewLines` lines (5 by default) with line numbers, and a full-width “Show All N Lines” toggle for the rest that becomes “Show Less”; the toggle carries `aria-expanded`, is described by the title, says how many flagged lines the fold hides, and only appears when there is more to show. The body is a focusable region named by the title, so a keyboard can scroll it. An empty `code` says so. The body scrolls past 360px, folded or open; past `maxRenderedLines` (2,000 by default) the expanded body stops mounting lines and says how many it left out. `highlightLines` flags 1-based lines with the error tint, a rule down their start edge and a visually hidden “Flagged:” for assistive tech; say why nearby.
|
|
147
|
+
- **`CodePreview`** — A framed payload, such as the raw request or response under a step of a trace: a header naming it with mono `meta` at the right, its first `previewLines` lines (5 by default) with line numbers, and a full-width “Show All N Lines” toggle for the rest that becomes “Show Less”; the toggle carries `aria-expanded`, is described by the title, says how many flagged lines the fold hides, and only appears when there is more to show. The body is a focusable region named by the title, so a keyboard can scroll it. An empty `code` says so. The body scrolls past 360px, folded or open; past `maxRenderedLines` (2,000 by default) the expanded body stops mounting lines and says how many it left out. `highlightLines` flags 1-based lines with the error tint, a rule down their start edge and a visually hidden “Flagged:” for assistive tech; say why nearby. `language="json"` colours keys, strings, numbers and `true`/`false`/`null` line by line with the code block theme’s token colours (a line over 10,000 characters stays plain); otherwise plain text. No JSON tree or other languages: for those use `CodeBlock`. _Key props:_ `title`, `meta`, `titleHidden` (drops the header, `meta` with it, keeping the title as the body’s accessible name), `code`, `language` (`json`; default plain), `previewLines`, `highlightLines`, `showLineNumbers` (default `true`), `copyable` (a button over the body copies the whole payload), `maxRenderedLines`, `className`.
|
|
148
148
|
- **`Stepper`** — Progress dots/segments for a multi-step flow; optionally clickable. `groups` takes a long flow in labelled sections: the active step’s group opens into one bar per step across the full width and every other group folds to a short bar. Folded bars keep a fixed width and the open group shares what is left, so allow about 20px per other group and 12px per step in the open group. With `onChange` each folded bar is a button named after its group. _Key props:_ `steps` or `groups` (`{ label, steps }[]`), `active`, `onChange`.
|
|
149
149
|
- **`FormSteps`** — Steps in order: each a numbered mark on a rail with its title, an optional `description` line under it, an optional `action` such as Edit at the end of the title row, and its content below. For the parts of a form that build on each other (pass `marker` for letters, so they do not read as the pages of a paged form, and `variant="form"` to space the steps for fields; titles always line up with field labels), or for reviewing a multi-step form before it is submitted; for a guide to follow, use `GuideTimeline`. Not `StepList`, the status checklist (complete, open, locked); the two are to be aligned. _Key props:_ `items` (`{ key, title, description, action, children }[]`), `marker`, `variant`, `aria-label`.
|
|
150
150
|
- **`GuideTimeline`** — A guide laid out as one scrolling column: each section a heading with a numbered mark, its steps strung on a rail below it and coded `1.1`, `1.2` so a step names its section once its heading has scrolled away; a section without steps is its description alone, coded `2`. Marks before the `active` step show a check. Place it in a scrolling container with no padding of its own, such as a `SidePanel` aside with `bodyPadding: false`. It reports the step scrolled to the top through `onActiveChange` and scrolls to a step when `active` is set to it, so `GuideJumpMenu` and `GuideProgress` can follow and steer it. `guideTimelinePositions` gives the codes. Not `Timeline`, the trace of events; the two are to be aligned. _Key props:_ `sections` (`{ key, title, description, steps: { key, title, children }[] }[]`), `active`, `onActiveChange`, `end`, `aria-label`.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M12 2.5l8.2 4.75v9.5L12 21.5l-8.2-4.75v-9.5z", fill: "currentColor" }));
|
|
3
|
+
export {
|
|
4
|
+
l as default
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=hexagon_fill.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hexagon_fill.svg.js","sources":["../../../src/assets/icons/hexagon_fill.svg?react"],"sourcesContent":["import * as React from \"react\";\nconst SvgHexagonFill = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M12 2.5l8.2 4.75v9.5L12 21.5l-8.2-4.75v-9.5z\", fill: \"currentColor\" }));\nexport default SvgHexagonFill;\n"],"names":["SvgHexagonFill","props","React"],"mappings":";AACK,MAACA,IAAiB,CAACC,MAA0B,gBAAAC,EAAM,cAAc,OAAO,EAAE,OAAO,IAAI,QAAQ,IAAI,SAAS,aAAa,MAAM,QAAQ,OAAO,8BAA8B,GAAGD,EAAK,GAAoB,gBAAAC,EAAM,cAAc,QAAQ,EAAE,GAAG,gDAAgD,MAAM,eAAc,CAAE,CAAC;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 12 256 256", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { d: "M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.27,47,25.53a8,8,0,0,0,4.2,0c1-.26,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-37,87.43-30.31,12.12L158.4,163.2a8,8,0,1,1-12.8,9.6L128,149.33,110.4,172.8a8,8,0,1,1-12.8-9.6l17.74-23.65L85,127.43A8,8,0,1,1,91,112.57l29,11.61V96a8,8,0,0,1,16,0v28.18l29-11.61a8,8,0,1,1,6,14.86Z", fill: "currentColor" }));
|
|
3
|
+
export {
|
|
4
|
+
l as default
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=shield_star_fill.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shield_star_fill.svg.js","sources":["../../../src/assets/icons/shield_star_fill.svg?react"],"sourcesContent":["import * as React from \"react\";\nconst SvgShieldStarFill = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 16, height: 16, viewBox: \"0 12 256 256\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.27,47,25.53a8,8,0,0,0,4.2,0c1-.26,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40Zm-37,87.43-30.31,12.12L158.4,163.2a8,8,0,1,1-12.8,9.6L128,149.33,110.4,172.8a8,8,0,1,1-12.8-9.6l17.74-23.65L85,127.43A8,8,0,1,1,91,112.57l29,11.61V96a8,8,0,0,1,16,0v28.18l29-11.61a8,8,0,1,1,6,14.86Z\", fill: \"currentColor\" }));\nexport default SvgShieldStarFill;\n"],"names":["SvgShieldStarFill","props","React"],"mappings":";AACK,MAACA,IAAoB,CAACC,MAA0B,gBAAAC,EAAM,cAAc,OAAO,EAAE,OAAO,IAAI,QAAQ,IAAI,SAAS,gBAAgB,MAAM,QAAQ,OAAO,8BAA8B,GAAGD,EAAK,GAAoB,gBAAAC,EAAM,cAAc,QAAQ,EAAE,GAAG,0YAA0Y,MAAM,eAAc,CAAE,CAAC;"}
|
|
@@ -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
|