@seclai/react 0.0.17 → 0.0.19
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/README.md +149 -24
- package/dist/chunk-OFKVHNZ6.js +117 -0
- package/dist/chunk-VRNPDCWI.js +134 -0
- package/dist/extensions-D2MHwNt1.d.ts +49 -0
- package/dist/html.d.ts +22 -0
- package/dist/html.js +11 -0
- package/dist/index.d.ts +79 -29
- package/dist/index.js +773 -297
- package/dist/math.d.ts +22 -0
- package/dist/math.js +106 -0
- package/dist/mermaid.d.ts +30 -0
- package/dist/mermaid.js +126 -0
- package/dist/styles.css +274 -15
- package/package.json +46 -2
package/dist/math.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { M as MarkdownExtension } from './extensions-D2MHwNt1.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react-markdown';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Maths in `MarkdownContent`, rendered with KaTeX: `$…$` and `\(…\)` inline,
|
|
7
|
+
* `$$…$$` and `\[…\]` as a block, and ```` ```math ```` fences. Maths renders
|
|
8
|
+
* once its closing delimiter arrives, and invalid maths shows as its source.
|
|
9
|
+
*
|
|
10
|
+
* Needs `katex` and `remark-math` installed, and KaTeX's stylesheet:
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { SeclaiMarkdownProvider } from "@seclai/react";
|
|
14
|
+
* import { math } from "@seclai/react/math";
|
|
15
|
+
* import "katex/dist/katex.min.css";
|
|
16
|
+
*
|
|
17
|
+
* <SeclaiMarkdownProvider extensions={[math()]}>…</SeclaiMarkdownProvider>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare function math(): MarkdownExtension;
|
|
21
|
+
|
|
22
|
+
export { math };
|
package/dist/math.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
replaceOutsideCode
|
|
4
|
+
} from "./chunk-OFKVHNZ6.js";
|
|
5
|
+
import {
|
|
6
|
+
isClosedFence,
|
|
7
|
+
remarkOpenFencesAsCode
|
|
8
|
+
} from "./chunk-VRNPDCWI.js";
|
|
9
|
+
|
|
10
|
+
// src/math.tsx
|
|
11
|
+
import katex from "katex";
|
|
12
|
+
import { useMemo } from "react";
|
|
13
|
+
import remarkMath from "remark-math";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var DISPLAY = /\\\[[\s\S]*?\\\]/g;
|
|
16
|
+
var INLINE = /\\\([\s\S]*?\\\)/g;
|
|
17
|
+
var LINE_END = /[ \t]*(?:\n|$)/y;
|
|
18
|
+
function normalizeMathDelimiters(markdown) {
|
|
19
|
+
if (!markdown.includes("\\[") && !markdown.includes("\\(")) return markdown;
|
|
20
|
+
const display = replaceOutsideCode(markdown, DISPLAY, (match, offset, text2) => {
|
|
21
|
+
const inner = match.slice(2, -2);
|
|
22
|
+
LINE_END.lastIndex = offset + match.length;
|
|
23
|
+
const ownLines = (offset === 0 || text2[offset - 1] === "\n") && LINE_END.test(text2);
|
|
24
|
+
return ownLines ? `$$
|
|
25
|
+
${inner.trim()}
|
|
26
|
+
$$` : `$$${inner}$$`;
|
|
27
|
+
});
|
|
28
|
+
return replaceOutsideCode(display, INLINE, (match) => `$${match.slice(2, -2)}$`);
|
|
29
|
+
}
|
|
30
|
+
function remarkOpenMathAsCode() {
|
|
31
|
+
return (tree, file) => {
|
|
32
|
+
const source = String(file.value);
|
|
33
|
+
const walk = (parent) => {
|
|
34
|
+
parent.children.forEach((child, index) => {
|
|
35
|
+
const node = child;
|
|
36
|
+
if (node.type === "math" && !isClosedFence(node, source)) {
|
|
37
|
+
parent.children[index] = { type: "code", lang: null, meta: null, value: node.value, position: node.position };
|
|
38
|
+
} else if ("children" in node) {
|
|
39
|
+
walk(node);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
walk(tree);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var text = (node) => node.children.map((child) => child.type === "text" ? child.value : child.type === "element" ? text(child) : "").join("");
|
|
47
|
+
function rehypeMathElements() {
|
|
48
|
+
const isMath = (node) => node?.type === "element" && node.tagName === "code" && Array.isArray(node.properties.className) && node.properties.className.includes("language-math");
|
|
49
|
+
const walk = (parent) => {
|
|
50
|
+
parent.children.forEach((child, index) => {
|
|
51
|
+
if (child.type !== "element") return;
|
|
52
|
+
const code = child.tagName === "pre" ? child.children.find(isMath) : isMath(child) ? child : void 0;
|
|
53
|
+
if (!code) return walk(child);
|
|
54
|
+
parent.children[index] = {
|
|
55
|
+
type: "element",
|
|
56
|
+
tagName: "seclai-math",
|
|
57
|
+
properties: { dataDisplay: child.tagName === "pre" ? "block" : "inline" },
|
|
58
|
+
children: [{ type: "text", value: text(code).replace(/\n$/, "") }]
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
return (tree) => walk(tree);
|
|
63
|
+
}
|
|
64
|
+
var cache = /* @__PURE__ */ new Map();
|
|
65
|
+
function renderMath(source, display) {
|
|
66
|
+
const key = `${display ? "block" : "inline"}\0${source}`;
|
|
67
|
+
let html = cache.get(key);
|
|
68
|
+
if (html === void 0) {
|
|
69
|
+
try {
|
|
70
|
+
html = katex.renderToString(source, {
|
|
71
|
+
displayMode: display,
|
|
72
|
+
throwOnError: true,
|
|
73
|
+
// No `\href`, `\url`, `\includegraphics` or `\html…` commands from the reply.
|
|
74
|
+
trust: false,
|
|
75
|
+
strict: "ignore"
|
|
76
|
+
});
|
|
77
|
+
} catch {
|
|
78
|
+
html = null;
|
|
79
|
+
}
|
|
80
|
+
if (cache.size >= 500) cache.delete(cache.keys().next().value);
|
|
81
|
+
cache.set(key, html);
|
|
82
|
+
}
|
|
83
|
+
return html;
|
|
84
|
+
}
|
|
85
|
+
function MathElement({ node }) {
|
|
86
|
+
const source = node ? text(node) : "";
|
|
87
|
+
const display = node?.properties.dataDisplay === "block";
|
|
88
|
+
const html = useMemo(() => renderMath(source, display), [source, display]);
|
|
89
|
+
if (html === null) {
|
|
90
|
+
return display ? /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: source }) }) : /* @__PURE__ */ jsx("code", { children: source });
|
|
91
|
+
}
|
|
92
|
+
const Tag = display ? "div" : "span";
|
|
93
|
+
return /* @__PURE__ */ jsx(Tag, { className: "seclai-markdown-math", dangerouslySetInnerHTML: { __html: html } });
|
|
94
|
+
}
|
|
95
|
+
var extension;
|
|
96
|
+
function math() {
|
|
97
|
+
return extension ??= {
|
|
98
|
+
remarkPlugins: [remarkMath, remarkOpenMathAsCode, remarkOpenFencesAsCode(["math"])],
|
|
99
|
+
rehypePlugins: [rehypeMathElements],
|
|
100
|
+
components: { "seclai-math": MathElement },
|
|
101
|
+
transform: normalizeMathDelimiters
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
math
|
|
106
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { M as MarkdownExtension } from './extensions-D2MHwNt1.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'react-markdown';
|
|
4
|
+
|
|
5
|
+
interface MermaidOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Mermaid's theme, such as `"dark"` for a dark page. Defaults to `"default"`,
|
|
8
|
+
* on a white background. Mermaid has one configuration per page, so the first
|
|
9
|
+
* diagram's theme applies to all of them.
|
|
10
|
+
*/
|
|
11
|
+
theme?: "default" | "base" | "dark" | "forest" | "neutral";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Mermaid diagrams in `MarkdownContent`, from ```` ```mermaid ```` code blocks.
|
|
15
|
+
* A diagram is drawn once its closing fence arrives; until then, and if it has
|
|
16
|
+
* a syntax error, its source shows as code. Mermaid runs with
|
|
17
|
+
* `securityLevel: "strict"`.
|
|
18
|
+
*
|
|
19
|
+
* Needs `mermaid` installed:
|
|
20
|
+
*
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { SeclaiMarkdownProvider } from "@seclai/react";
|
|
23
|
+
* import { mermaid } from "@seclai/react/mermaid";
|
|
24
|
+
*
|
|
25
|
+
* <SeclaiMarkdownProvider extensions={[mermaid()]}>…</SeclaiMarkdownProvider>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function mermaid(options?: MermaidOptions): MarkdownExtension;
|
|
29
|
+
|
|
30
|
+
export { type MermaidOptions, mermaid };
|
package/dist/mermaid.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
remarkOpenFencesAsCode
|
|
4
|
+
} from "./chunk-VRNPDCWI.js";
|
|
5
|
+
|
|
6
|
+
// src/mermaid.tsx
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var loading;
|
|
10
|
+
function loadMermaid(theme) {
|
|
11
|
+
return loading ??= import("mermaid").then(({ default: mermaid2 }) => {
|
|
12
|
+
mermaid2.initialize({
|
|
13
|
+
startOnLoad: false,
|
|
14
|
+
// Labels are sanitized and click handlers are off.
|
|
15
|
+
securityLevel: "strict",
|
|
16
|
+
// A syntax error throws, rather than drawing Mermaid's error diagram.
|
|
17
|
+
suppressErrorRendering: true,
|
|
18
|
+
theme,
|
|
19
|
+
// Labels may hold some HTML. Like images elsewhere in a reply, none of it
|
|
20
|
+
// may load anything: no images, and no styles, which could hold `url(…)`.
|
|
21
|
+
dompurifyConfig: {
|
|
22
|
+
FORBID_TAGS: ["style", "img", "image", "picture", "source", "video", "audio", "svg", "link"],
|
|
23
|
+
FORBID_ATTR: ["style", "src", "srcset", "background", "poster"]
|
|
24
|
+
},
|
|
25
|
+
// Settings a diagram can't change with an `%%{init: …}%%` directive:
|
|
26
|
+
// Mermaid's own list, plus the ones it copies into the diagram's CSS as
|
|
27
|
+
// they are, which could load outside URLs with `url(…)` or restyle the
|
|
28
|
+
// page, and the label sanitizing above.
|
|
29
|
+
secure: [
|
|
30
|
+
"secure",
|
|
31
|
+
"securityLevel",
|
|
32
|
+
"startOnLoad",
|
|
33
|
+
"maxTextSize",
|
|
34
|
+
"suppressErrorRendering",
|
|
35
|
+
"maxEdges",
|
|
36
|
+
"themeCSS",
|
|
37
|
+
"fontFamily",
|
|
38
|
+
"altFontFamily",
|
|
39
|
+
"dompurifyConfig"
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
return mermaid2;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
var queue = Promise.resolve();
|
|
46
|
+
var nextId = 0;
|
|
47
|
+
var rendered = /* @__PURE__ */ new Map();
|
|
48
|
+
function renderDiagram(source, theme) {
|
|
49
|
+
const key = `${theme}\0${source}`;
|
|
50
|
+
const done = rendered.get(key);
|
|
51
|
+
if (done !== void 0) return Promise.resolve(done);
|
|
52
|
+
const result = queue.then(async () => {
|
|
53
|
+
let svg = null;
|
|
54
|
+
try {
|
|
55
|
+
const mermaid2 = await loadMermaid(theme);
|
|
56
|
+
if (await mermaid2.parse(source, { suppressErrors: true })) {
|
|
57
|
+
svg = (await mermaid2.render(`seclai-mermaid-${nextId++}`, source)).svg;
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
svg = null;
|
|
61
|
+
}
|
|
62
|
+
if (rendered.size >= 100) rendered.delete(rendered.keys().next().value);
|
|
63
|
+
rendered.set(key, svg);
|
|
64
|
+
return svg;
|
|
65
|
+
});
|
|
66
|
+
queue = result;
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
var text = (node) => node.children.map((child) => child.type === "text" ? child.value : child.type === "element" ? text(child) : "").join("");
|
|
70
|
+
function rehypeMermaidElements() {
|
|
71
|
+
const isMermaid = (node) => node.type === "element" && node.tagName === "code" && Array.isArray(node.properties.className) && node.properties.className.includes("language-mermaid");
|
|
72
|
+
const walk = (parent) => {
|
|
73
|
+
parent.children.forEach((child, index) => {
|
|
74
|
+
if (child.type !== "element") return;
|
|
75
|
+
const code = child.tagName === "pre" ? child.children.find(isMermaid) : void 0;
|
|
76
|
+
if (!code) return walk(child);
|
|
77
|
+
parent.children[index] = {
|
|
78
|
+
type: "element",
|
|
79
|
+
tagName: "seclai-mermaid",
|
|
80
|
+
properties: {},
|
|
81
|
+
children: [{ type: "text", value: text(code).replace(/\n$/, "") }]
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
return (tree) => walk(tree);
|
|
86
|
+
}
|
|
87
|
+
function diagramComponent(theme) {
|
|
88
|
+
return function MermaidDiagram({ node }) {
|
|
89
|
+
const source = node ? text(node) : "";
|
|
90
|
+
const key = `${theme}\0${source}`;
|
|
91
|
+
const [svg, setSvg] = useState(() => rendered.get(key) ?? null);
|
|
92
|
+
const [drawn, setDrawn] = useState(() => rendered.get(key) !== void 0 ? key : null);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
let current = true;
|
|
95
|
+
renderDiagram(source, theme).then((result) => {
|
|
96
|
+
if (!current) return;
|
|
97
|
+
setSvg(result);
|
|
98
|
+
setDrawn(key);
|
|
99
|
+
});
|
|
100
|
+
return () => {
|
|
101
|
+
current = false;
|
|
102
|
+
};
|
|
103
|
+
}, [source, key]);
|
|
104
|
+
if (drawn !== key || svg === null) {
|
|
105
|
+
return /* @__PURE__ */ jsx("pre", { className: "seclai-markdown-mermaid-source", children: /* @__PURE__ */ jsx("code", { className: "language-mermaid", children: source }) });
|
|
106
|
+
}
|
|
107
|
+
return /* @__PURE__ */ jsx("div", { className: "seclai-markdown-mermaid", "data-theme": theme, dangerouslySetInnerHTML: { __html: svg } });
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
var extensions = /* @__PURE__ */ new Map();
|
|
111
|
+
function mermaid(options = {}) {
|
|
112
|
+
const theme = options.theme ?? "default";
|
|
113
|
+
let extension = extensions.get(theme);
|
|
114
|
+
if (!extension) {
|
|
115
|
+
extension = {
|
|
116
|
+
remarkPlugins: [remarkOpenFencesAsCode(["mermaid"])],
|
|
117
|
+
rehypePlugins: [rehypeMermaidElements],
|
|
118
|
+
components: { "seclai-mermaid": diagramComponent(theme) }
|
|
119
|
+
};
|
|
120
|
+
extensions.set(theme, extension);
|
|
121
|
+
}
|
|
122
|
+
return extension;
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
mermaid
|
|
126
|
+
};
|
package/dist/styles.css
CHANGED
|
@@ -427,24 +427,136 @@
|
|
|
427
427
|
inset: -8px;
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
/*
|
|
430
|
+
/*
|
|
431
|
+
* Agent output (Markdown). The list numbers are badges, below. Also themable with:
|
|
432
|
+
* --seclai-code-font the monospace font for code (ui-monospace and fallbacks)
|
|
433
|
+
* --seclai-code-surface the background of code blocks and inline code
|
|
434
|
+
*/
|
|
431
435
|
.seclai-markdown {
|
|
432
436
|
overflow-wrap: anywhere;
|
|
433
437
|
}
|
|
434
438
|
|
|
439
|
+
/* Blocks at any depth: no margins of their own, only space between siblings. */
|
|
440
|
+
.seclai-markdown :where(p, ul, ol, pre, blockquote, table, h1, h2, h3, h4, h5, h6, hr, details, dl, figure) {
|
|
441
|
+
margin-block: 0;
|
|
442
|
+
}
|
|
443
|
+
|
|
435
444
|
.seclai-markdown > * {
|
|
436
445
|
margin: 0;
|
|
437
446
|
}
|
|
438
447
|
|
|
439
|
-
.seclai-markdown > * +
|
|
448
|
+
.seclai-markdown > * + *,
|
|
449
|
+
.seclai-markdown :where(blockquote, ul > li, ol > li > div, td, th, details, section) > * + * {
|
|
440
450
|
margin-block-start: 0.75em;
|
|
441
451
|
}
|
|
442
452
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
453
|
+
.seclai-markdown :where(h1, h2, h3, h4, h5, h6) {
|
|
454
|
+
font-weight: 600;
|
|
455
|
+
line-height: 1.3;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.seclai-markdown h1 {
|
|
459
|
+
font-size: 1.5em;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.seclai-markdown h2 {
|
|
463
|
+
font-size: 1.3em;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.seclai-markdown h3 {
|
|
467
|
+
font-size: 1.15em;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.seclai-markdown :where(h4, h5, h6) {
|
|
471
|
+
font-size: 1em;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/* A heading after other content gets more room above it. */
|
|
475
|
+
.seclai-markdown * + :where(h1, h2, h3, h4, h5, h6) {
|
|
476
|
+
margin-block-start: 1.25em;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.seclai-markdown a {
|
|
480
|
+
color: var(--seclai-accent);
|
|
481
|
+
text-underline-offset: 0.16em;
|
|
446
482
|
}
|
|
447
483
|
|
|
484
|
+
@media (hover: hover) {
|
|
485
|
+
.seclai-markdown a:hover {
|
|
486
|
+
color: var(--seclai-accent-hover);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* Code */
|
|
491
|
+
.seclai-markdown :where(code, kbd, samp) {
|
|
492
|
+
font-family: var(--seclai-code-font, ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace);
|
|
493
|
+
font-size: 0.875em;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.seclai-markdown :not(pre) > code {
|
|
497
|
+
padding: 0.1em 0.35em;
|
|
498
|
+
background: var(--seclai-code-surface, var(--seclai-surface-hover));
|
|
499
|
+
border-radius: 4px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.seclai-markdown pre {
|
|
503
|
+
padding: 12px 16px;
|
|
504
|
+
overflow-x: auto;
|
|
505
|
+
line-height: 1.5;
|
|
506
|
+
background: var(--seclai-code-surface, var(--seclai-surface-hover));
|
|
507
|
+
border-radius: var(--seclai-radius);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/* Code blocks keep their lines and scroll sideways rather than wrap. */
|
|
511
|
+
.seclai-markdown pre code {
|
|
512
|
+
font-size: 0.8125em;
|
|
513
|
+
white-space: pre;
|
|
514
|
+
overflow-wrap: normal;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.seclai-markdown kbd {
|
|
518
|
+
padding: 0.1em 0.4em;
|
|
519
|
+
border: 1px solid var(--seclai-border);
|
|
520
|
+
border-block-end-width: 2px;
|
|
521
|
+
border-radius: 4px;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.seclai-markdown blockquote {
|
|
525
|
+
padding-inline-start: 12px;
|
|
526
|
+
color: var(--seclai-muted);
|
|
527
|
+
border-inline-start: 3px solid var(--seclai-border);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/* Tables scroll sideways rather than squeezing their columns. */
|
|
531
|
+
.seclai-markdown-table {
|
|
532
|
+
max-width: 100%;
|
|
533
|
+
overflow-x: auto;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.seclai-markdown table {
|
|
537
|
+
font-size: 0.9375em;
|
|
538
|
+
overflow-wrap: normal;
|
|
539
|
+
border-collapse: collapse;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.seclai-markdown :where(th, td) {
|
|
543
|
+
min-width: 4em;
|
|
544
|
+
padding: 6px 12px;
|
|
545
|
+
text-align: start;
|
|
546
|
+
vertical-align: top;
|
|
547
|
+
border: 1px solid var(--seclai-border);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.seclai-markdown th {
|
|
551
|
+
font-weight: 600;
|
|
552
|
+
background: var(--seclai-surface);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.seclai-markdown tbody tr:nth-child(even) {
|
|
556
|
+
background: var(--seclai-surface);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/* Lists */
|
|
448
560
|
.seclai-markdown ul {
|
|
449
561
|
padding-inline-start: 1.25em;
|
|
450
562
|
list-style: disc;
|
|
@@ -469,6 +581,7 @@
|
|
|
469
581
|
}
|
|
470
582
|
|
|
471
583
|
.seclai-markdown ol > li > :last-child {
|
|
584
|
+
flex: 1;
|
|
472
585
|
min-width: 0;
|
|
473
586
|
}
|
|
474
587
|
|
|
@@ -487,12 +600,69 @@
|
|
|
487
600
|
list-style: square;
|
|
488
601
|
}
|
|
489
602
|
|
|
603
|
+
/* Task lists: the checkbox takes the bullet's place. */
|
|
604
|
+
.seclai-markdown ul.contains-task-list {
|
|
605
|
+
padding-inline-start: 0;
|
|
606
|
+
list-style: none;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.seclai-markdown .task-list-item input {
|
|
610
|
+
margin: 0 0.4em 0 0;
|
|
611
|
+
vertical-align: -0.1em;
|
|
612
|
+
accent-color: var(--seclai-accent);
|
|
613
|
+
}
|
|
614
|
+
|
|
490
615
|
.seclai-markdown hr {
|
|
491
616
|
height: 0;
|
|
492
617
|
border: 0;
|
|
493
618
|
border-block-start: 1px solid var(--seclai-border);
|
|
494
619
|
}
|
|
495
620
|
|
|
621
|
+
.seclai-markdown svg {
|
|
622
|
+
max-width: 100%;
|
|
623
|
+
height: auto;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/* Footnotes */
|
|
627
|
+
.seclai-markdown section.footnotes {
|
|
628
|
+
padding-block-start: 0.75em;
|
|
629
|
+
font-size: 0.875em;
|
|
630
|
+
color: var(--seclai-muted);
|
|
631
|
+
border-block-start: 1px solid var(--seclai-border);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.seclai-markdown .sr-only {
|
|
635
|
+
position: absolute;
|
|
636
|
+
width: 1px;
|
|
637
|
+
height: 1px;
|
|
638
|
+
margin: -1px;
|
|
639
|
+
padding: 0;
|
|
640
|
+
overflow: hidden;
|
|
641
|
+
clip: rect(0, 0, 0, 0);
|
|
642
|
+
white-space: nowrap;
|
|
643
|
+
border: 0;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/* Maths (`@seclai/react/math`) and diagrams (`@seclai/react/mermaid`) */
|
|
647
|
+
div.seclai-markdown-math {
|
|
648
|
+
max-width: 100%;
|
|
649
|
+
overflow-x: auto;
|
|
650
|
+
overflow-y: hidden;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
.seclai-markdown-mermaid {
|
|
654
|
+
max-width: 100%;
|
|
655
|
+
overflow-x: auto;
|
|
656
|
+
padding: 12px;
|
|
657
|
+
text-align: center;
|
|
658
|
+
border-radius: var(--seclai-radius);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/* Mermaid's light themes draw dark text, so they keep a white background on a dark page. */
|
|
662
|
+
.seclai-markdown-mermaid:not([data-theme="dark"]) {
|
|
663
|
+
background: #ffffff;
|
|
664
|
+
}
|
|
665
|
+
|
|
496
666
|
.seclai-media {
|
|
497
667
|
display: flex;
|
|
498
668
|
flex-direction: column;
|
|
@@ -516,23 +686,25 @@
|
|
|
516
686
|
}
|
|
517
687
|
|
|
518
688
|
/*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* --seclai-media-
|
|
522
|
-
* --seclai-media-
|
|
523
|
-
* --seclai-media-
|
|
689
|
+
* Media cards (image, video, audio and PDF), galleries, skeletons and the
|
|
690
|
+
* viewer. Also themable with:
|
|
691
|
+
* --seclai-media-aspect-ratio a frame's ratio before its image or video loads (1 / 1)
|
|
692
|
+
* --seclai-media-fit object-fit for the image in its frame (scale-down)
|
|
693
|
+
* --seclai-media-min-width a gallery column's minimum width (220px)
|
|
694
|
+
* --seclai-media-max-width a card's width outside a gallery (480px)
|
|
695
|
+
* --seclai-media-pdf-aspect-ratio a PDF frame's ratio (3 / 4)
|
|
524
696
|
*/
|
|
525
697
|
.seclai-gallery,
|
|
526
698
|
.seclai-gallery *,
|
|
527
|
-
.seclai-media-
|
|
528
|
-
.seclai-media-
|
|
699
|
+
.seclai-media-card,
|
|
700
|
+
.seclai-media-card *,
|
|
529
701
|
.seclai-viewer,
|
|
530
702
|
.seclai-viewer * {
|
|
531
703
|
box-sizing: border-box;
|
|
532
704
|
}
|
|
533
705
|
|
|
534
706
|
.seclai-gallery :focus-visible,
|
|
535
|
-
.seclai-media-
|
|
707
|
+
.seclai-media-card :focus-visible,
|
|
536
708
|
.seclai-viewer :focus-visible {
|
|
537
709
|
outline: 2px solid var(--seclai-focus);
|
|
538
710
|
outline-offset: 2px;
|
|
@@ -554,7 +726,7 @@
|
|
|
554
726
|
}
|
|
555
727
|
}
|
|
556
728
|
|
|
557
|
-
.seclai-media-
|
|
729
|
+
.seclai-media-card {
|
|
558
730
|
width: 100%;
|
|
559
731
|
max-width: var(--seclai-media-max-width, 480px);
|
|
560
732
|
gap: 0;
|
|
@@ -604,6 +776,78 @@ button.seclai-media-frame:focus-visible {
|
|
|
604
776
|
}
|
|
605
777
|
}
|
|
606
778
|
|
|
779
|
+
.seclai-media-frame > video,
|
|
780
|
+
.seclai-media-frame > object {
|
|
781
|
+
display: block;
|
|
782
|
+
width: 100%;
|
|
783
|
+
height: 100%;
|
|
784
|
+
border: 0;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/* Black bars, as in any video player, rather than the frame's tint. */
|
|
788
|
+
.seclai-media-frame:has(> video) {
|
|
789
|
+
background: #000000;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.seclai-media-frame > video {
|
|
793
|
+
object-fit: contain;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/* Inset, as on an image's button: the frame fills the card and clips anything outside it. */
|
|
797
|
+
.seclai-media-frame > video:focus-visible,
|
|
798
|
+
.seclai-media-frame > object:focus-visible {
|
|
799
|
+
outline-offset: -2px;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
.seclai-media-pdf .seclai-media-frame {
|
|
803
|
+
aspect-ratio: var(--seclai-media-pdf-aspect-ratio, 3 / 4);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/* Shown in place of the PDF by browsers without a PDF viewer. */
|
|
807
|
+
.seclai-media-fallback {
|
|
808
|
+
display: flex;
|
|
809
|
+
flex-direction: column;
|
|
810
|
+
align-items: center;
|
|
811
|
+
justify-content: center;
|
|
812
|
+
gap: 8px;
|
|
813
|
+
height: 100%;
|
|
814
|
+
padding: 12px;
|
|
815
|
+
color: var(--seclai-muted);
|
|
816
|
+
text-align: center;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/* Audio and PDF cards name the file above it, with the badge. */
|
|
820
|
+
.seclai-media-head {
|
|
821
|
+
display: flex;
|
|
822
|
+
align-items: center;
|
|
823
|
+
gap: 8px;
|
|
824
|
+
min-width: 0;
|
|
825
|
+
padding: 8px 12px;
|
|
826
|
+
border-bottom: 1px solid var(--seclai-border);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.seclai-media-title {
|
|
830
|
+
overflow: hidden;
|
|
831
|
+
font-weight: 600;
|
|
832
|
+
text-overflow: ellipsis;
|
|
833
|
+
white-space: nowrap;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.seclai-media-body {
|
|
837
|
+
padding: 8px 12px 0;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
.seclai-media-audio audio {
|
|
841
|
+
display: block;
|
|
842
|
+
width: 100%;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
.seclai-media-audio .seclai-media-error {
|
|
846
|
+
position: static;
|
|
847
|
+
justify-content: flex-start;
|
|
848
|
+
padding: 0;
|
|
849
|
+
}
|
|
850
|
+
|
|
607
851
|
/*
|
|
608
852
|
* A number badge, on an image and on the matching item of a numbered list in
|
|
609
853
|
* the agent's text. Fixed colours: the badge sits on the image, not on the page.
|
|
@@ -629,6 +873,16 @@ button.seclai-media-frame:focus-visible {
|
|
|
629
873
|
position: absolute;
|
|
630
874
|
top: 8px;
|
|
631
875
|
inset-inline-start: 8px;
|
|
876
|
+
/* Clicks go through to the video under it. */
|
|
877
|
+
pointer-events: none;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/* On the page rather than on a picture, so it inverts in a dark colour scheme, like a list number's. */
|
|
881
|
+
.seclai-media-head .seclai-media-badge {
|
|
882
|
+
position: static;
|
|
883
|
+
flex: none;
|
|
884
|
+
color: light-dark(#ffffff, #000000);
|
|
885
|
+
background: light-dark(rgb(0 0 0 / 0.72), rgb(255 255 255 / 0.85));
|
|
632
886
|
}
|
|
633
887
|
|
|
634
888
|
/* On the page, the same badge inverts in a dark colour scheme, so it still stands out. */
|
|
@@ -712,11 +966,16 @@ button.seclai-media-frame:focus-visible {
|
|
|
712
966
|
min-width: 0;
|
|
713
967
|
}
|
|
714
968
|
|
|
715
|
-
.seclai-gallery-grid .seclai-media-
|
|
969
|
+
.seclai-gallery-grid .seclai-media-card {
|
|
716
970
|
max-width: none;
|
|
717
971
|
height: 100%;
|
|
718
972
|
}
|
|
719
973
|
|
|
974
|
+
/* In a row of taller cards, an audio card's player sits at the top and its bar at the bottom. */
|
|
975
|
+
.seclai-gallery-grid .seclai-media-audio .seclai-media-body {
|
|
976
|
+
flex: 1;
|
|
977
|
+
}
|
|
978
|
+
|
|
720
979
|
.seclai-gallery-actions {
|
|
721
980
|
display: flex;
|
|
722
981
|
flex-wrap: wrap;
|