@trinityui/design-system 2.11.0 → 2.11.1
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/CHANGELOG.md +54 -0
- package/MIGRATION.md +25 -0
- package/dist/app-shell.js +2964 -2904
- package/dist/components/AI/AIChainOfThought.d.ts +38 -0
- package/dist/components/AI/AIChainOfThought.d.ts.map +1 -1
- package/dist/components/AI/AIChainOfThought.types.d.ts +12 -2
- package/dist/components/AI/AIChainOfThought.types.d.ts.map +1 -1
- package/dist/components/AI/AISources.d.ts +10 -2
- package/dist/components/AI/AISources.d.ts.map +1 -1
- package/dist/components/AI/AITextBlock.d.ts +4 -2
- package/dist/components/AI/AITextBlock.d.ts.map +1 -1
- package/dist/components/AI/InsightEngineInput.d.ts +5 -1
- package/dist/components/AI/InsightEngineInput.d.ts.map +1 -1
- package/dist/components/HtmlToMui/HtmlToMui.d.ts +32 -2
- package/dist/components/HtmlToMui/HtmlToMui.d.ts.map +1 -1
- package/dist/components/SandboxedIframeRenderer/SandboxedIframeRenderer.d.ts +48 -4
- package/dist/components/SandboxedIframeRenderer/SandboxedIframeRenderer.d.ts.map +1 -1
- package/dist/components/shared/safeContent.d.ts +129 -0
- package/dist/components/shared/safeContent.d.ts.map +1 -0
- package/dist/components/shared/warnDeprecated.d.ts.map +1 -1
- package/dist/safe-content.js +792 -0
- package/dist/trinity.css +1 -1
- package/package.json +1 -1
|
@@ -87,7 +87,45 @@
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
import React from 'react';
|
|
90
|
+
import { Theme } from '@mui/material';
|
|
91
|
+
import { type CSSObject } from '@mui/material/styles';
|
|
90
92
|
import type { StepStatus, PhaseStatus, ChainSource, TaskError, ExecutionTask, ChainArtifact, OutputStat, InsightMetric, InsightReference, UnderstandingPhase, PlanPhase, ExecutionPhase, OutputPhase, InsightPhase, ChainPhase, AIChainOfThoughtProps } from './AIChainOfThought.types';
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
* Primary tint behind `<mark>` per mode, calibrated so the highlight measures at
|
|
96
|
+
* least 1.5:1 against the thought and insight surfaces and text.primary on it
|
|
97
|
+
* at least 7:1 (asserted in AIChainOfThought.security.test.tsx).
|
|
98
|
+
*/
|
|
99
|
+
export declare const MARK_TINT: {
|
|
100
|
+
readonly light: 0.24;
|
|
101
|
+
readonly dark: 0.32;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
* Styles for the links and highlights the allowlist keeps. Links resolve the
|
|
106
|
+
* theme's link role like MUI Link with its default props: the colour prop (MUI
|
|
107
|
+
* Link's default, or a theme MuiLink defaultProps colour) gives the base colour,
|
|
108
|
+
* and a root style override goes on top — an object, or a function called with
|
|
109
|
+
* MUI Link's default props (color, component, variant), the ownerState built from
|
|
110
|
+
* them plus theme defaultProps, and the theme. One rule styles every link, so
|
|
111
|
+
* per-link props (href, className, style, children) are not available to it.
|
|
112
|
+
* Other override slots and `variants` are not applied; an override that throws
|
|
113
|
+
* falls back to the base colour. A link
|
|
114
|
+
* inside a highlight keeps the highlight's text colour: the link colour on the
|
|
115
|
+
* tint can fall below 4.5:1, and the underline still marks the link.
|
|
116
|
+
*/
|
|
117
|
+
export declare const safeContentSx: {
|
|
118
|
+
readonly '& a': (theme: Theme) => CSSObject;
|
|
119
|
+
readonly '& mark': {
|
|
120
|
+
readonly backgroundColor: (theme: Theme) => string;
|
|
121
|
+
readonly color: "text.primary";
|
|
122
|
+
readonly borderRadius: "4px";
|
|
123
|
+
readonly px: 0.25;
|
|
124
|
+
};
|
|
125
|
+
readonly '& mark a, & mark a:hover': {
|
|
126
|
+
readonly color: "inherit";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
91
129
|
export type { StepStatus, PhaseStatus, ChainSource, TaskError, ExecutionTask, ChainArtifact, OutputStat, InsightMetric, InsightReference, UnderstandingPhase, PlanPhase, ExecutionPhase, OutputPhase, InsightPhase, ChainPhase, AIChainOfThoughtProps, };
|
|
92
130
|
/**
|
|
93
131
|
* AIChainOfThought — Evolved reasoning UI.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIChainOfThought.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIChainOfThought.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AIChainOfThought.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIChainOfThought.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAQL,KAAK,EAEN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAS,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAY7D,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,WAAW,EACX,YAAY,EACZ,UAAU,EACV,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AASlC;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;CAAuC,CAAC;AAsB9D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;4BACT,KAAK,KAAG,SAAS;;0CAkBL,KAAK;;;;;;;;CAMxB,CAAC;AAGX,YAAY,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,WAAW,EACX,YAAY,EACZ,UAAU,EACV,qBAAqB,GACtB,CAAC;AA6vCF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,8FAwO5B,CAAC"}
|
|
@@ -105,7 +105,12 @@ export interface PhaseBase {
|
|
|
105
105
|
/** Understanding phase — thought bubbles + sources */
|
|
106
106
|
export interface UnderstandingPhase extends PhaseBase {
|
|
107
107
|
type: 'understanding';
|
|
108
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Thought bubble contents. Treated as untrusted: rendered through the safe-content
|
|
110
|
+
* allowlist (b, strong, i, em, code, br, p, ul, ol, li, span, a, mark). Links keep
|
|
111
|
+
* only http(s)/mailto/tel/relative hrefs; every other tag, attribute and handler
|
|
112
|
+
* is removed or shown as text.
|
|
113
|
+
*/
|
|
109
114
|
thoughts: string[];
|
|
110
115
|
/** Sources consulted */
|
|
111
116
|
sources?: ChainSource[];
|
|
@@ -141,7 +146,12 @@ export interface OutputPhase extends PhaseBase {
|
|
|
141
146
|
/** Insight phase — highlighted body, metrics, references */
|
|
142
147
|
export interface InsightPhase extends PhaseBase {
|
|
143
148
|
type: 'insight';
|
|
144
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* The insight body. Treated as untrusted: rendered through the safe-content
|
|
151
|
+
* allowlist (b, strong, i, em, code, br, p, ul, ol, li, span, a, mark), with
|
|
152
|
+
* `<span class="insight-highlight">` for highlights. Links keep only
|
|
153
|
+
* http(s)/mailto/tel/relative hrefs; everything else is removed or shown as text.
|
|
154
|
+
*/
|
|
145
155
|
content: string;
|
|
146
156
|
/** Optional confidence 0-1 */
|
|
147
157
|
confidence?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIChainOfThought.types.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIChainOfThought.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAA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
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Source URL. Only http(s), mailto, tel and relative URLs become a link (new
|
|
28
|
+
* tab, `rel="noopener noreferrer"`); any other scheme is shown as plain text,
|
|
29
|
+
* with a development warning.
|
|
30
|
+
*/
|
|
27
31
|
url?: string;
|
|
28
32
|
/** Source description/snippet */
|
|
29
33
|
description?: string;
|
|
30
34
|
/** Source type (webpage, document, etc.) */
|
|
31
35
|
type?: 'webpage' | 'document' | 'article' | 'video' | 'other';
|
|
32
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Favicon URL: http(s), `blob:`, relative or a raster `data:image/*` source,
|
|
38
|
+
* loaded lazily without a referrer. Other sources are not loaded (development
|
|
39
|
+
* warning).
|
|
40
|
+
*/
|
|
33
41
|
favicon?: string;
|
|
34
42
|
/** Click handler */
|
|
35
43
|
onClick?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AISources.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AISources.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAUL,OAAO,EACP,KAAK,EACN,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"AISources.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AISources.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAUL,OAAO,EACP,KAAK,EACN,MAAM,eAAe,CAAC;AAWvB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IAC9D;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sBAAsB;IACtB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,sFA+InB,CAAC;AAMH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sBAAsB;IACtB,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC;IACzC,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6BAA6B;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;IAC/E,sBAAsB;IACtB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,8FA+E5B,CAAC"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* | `**bold**` | `<strong>` |
|
|
14
14
|
* | `*italic*` or `_italic_` | `<em>` |
|
|
15
15
|
* | `` `code` `` | `<code>` with monospace styling |
|
|
16
|
-
* | `[text](url)` | `<a>` (
|
|
16
|
+
* | `[text](url)` | `<a>` for http(s), mailto, tel and relative URLs (new tab, `rel="noopener noreferrer"`); other schemes render as text |
|
|
17
17
|
* | `# Heading 1` through `###### Heading 6` | `<h1>`–`<h6>` |
|
|
18
18
|
* | `- item` or `* item` | `<ul><li>` (unordered list) |
|
|
19
19
|
* | `1. item` | `<ol><li>` (ordered list) |
|
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
*
|
|
37
37
|
* The parser does NOT execute HTML — incoming content is split and reassembled
|
|
38
38
|
* via React elements, so `<script>`, `<iframe>`, etc. in the source string are
|
|
39
|
-
* rendered as literal text, not parsed.
|
|
39
|
+
* rendered as literal text, not parsed. Link URLs pass the shared link policy
|
|
40
|
+
* (ADR-09): `javascript:`, `data:`, `vbscript:` and other schemes — including
|
|
41
|
+
* obfuscated forms — render as plain text, with a development warning.
|
|
40
42
|
*
|
|
41
43
|
* @example Plain text
|
|
42
44
|
* ```tsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AITextBlock.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AITextBlock.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AITextBlock.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AITextBlock.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAOzC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mCAAmC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/B,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAMD;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,sFA2BtB,CAAC;AAymBH,eAAe,WAAW,CAAC"}
|
|
@@ -55,7 +55,11 @@ export interface AttachmentFile {
|
|
|
55
55
|
size?: number;
|
|
56
56
|
/** MIME type, used to choose the file-type icon */
|
|
57
57
|
type?: string;
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Image preview URL, shown as a thumbnail: an object (blob:) URL, an http(s) or
|
|
60
|
+
* relative URL, or a raster `data:image/*`. Any other scheme (e.g. javascript:,
|
|
61
|
+
* data:image/svg+xml) falls back to the file-type icon.
|
|
62
|
+
*/
|
|
59
63
|
previewUrl?: string;
|
|
60
64
|
/** Upload state. Omit (or `'done'`) for a settled file. */
|
|
61
65
|
status?: AttachmentStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightEngineInput.d.ts","sourceRoot":"","sources":["../../../src/components/AI/InsightEngineInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAiBL,OAAO,EACP,KAAK,EACN,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"InsightEngineInput.d.ts","sourceRoot":"","sources":["../../../src/components/AI/InsightEngineInput.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAiBL,OAAO,EACP,KAAK,EACN,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAMhE,MAAM,WAAW,WAAW;IAC1B,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B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C,EAAE,OAAO,CAAC;IACf,sBAAsB;IACtB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAMD,eAAO,MAAM,kBAAkB,gGA07B7B,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
* @module components/HtmlToMui
|
|
4
4
|
* @example
|
|
5
5
|
* ```tsx
|
|
6
|
-
*
|
|
6
|
+
* // Internal component: not exported from the package yet (export decision OD-I7).
|
|
7
|
+
* import { HtmlToMui } from '../components/HtmlToMui';
|
|
7
8
|
*
|
|
8
9
|
* <HtmlToMui html="<h2>Overview</h2><p><strong>Safe</strong> rich content.</p>" />
|
|
9
10
|
* ```
|
|
10
11
|
*/
|
|
11
12
|
import * as React from "react";
|
|
12
13
|
import { type SxProps, type Theme, type TypographyProps } from "@mui/material";
|
|
14
|
+
/** Untrusted-content policies come from one shared module (ADR-09). */
|
|
15
|
+
type RemoteImagePolicy = "block" | "allow";
|
|
13
16
|
export interface HtmlToMuiProps {
|
|
14
17
|
/**
|
|
15
18
|
* Raw HTML to convert.
|
|
@@ -29,11 +32,38 @@ export interface HtmlToMuiProps {
|
|
|
29
32
|
*/
|
|
30
33
|
className?: string;
|
|
31
34
|
/**
|
|
32
|
-
* When true,
|
|
35
|
+
* When true, drops dangerous elements (script, style, iframe, object, form, svg, …)
|
|
36
|
+
* together with their content. URL, style and class policies always apply,
|
|
37
|
+
* whatever this is set to.
|
|
33
38
|
* @default true
|
|
34
39
|
*/
|
|
35
40
|
sanitize?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Remote (http, https, protocol-relative) image sources. `"block"` removes them
|
|
43
|
+
* so untrusted content cannot fetch third-party URLs (tracking pixels);
|
|
44
|
+
* relative, `blob:` and raster `data:image/*` sources always render.
|
|
45
|
+
* @default "block"
|
|
46
|
+
*/
|
|
47
|
+
remoteImages?: RemoteImagePolicy;
|
|
48
|
+
/**
|
|
49
|
+
* Restrict passed-through `class` tokens to this list. When omitted, every class
|
|
50
|
+
* except MUI (`Mui*`, `Mui-*`, `mui-*`, any case) and Emotion (`css-*`) names
|
|
51
|
+
* passes through — untrusted
|
|
52
|
+
* content can still match your own global class selectors, so set this when
|
|
53
|
+
* the HTML is not fully trusted.
|
|
54
|
+
*/
|
|
55
|
+
allowedClasses?: readonly string[];
|
|
36
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Converts an HTML string into MUI-styled React nodes through the shared
|
|
59
|
+
* safe-content policies (ADR-09).
|
|
60
|
+
*
|
|
61
|
+
* Known issue (SSR): parsing needs `DOMParser`. Where it is unavailable (server
|
|
62
|
+
* rendering), the component renders the tag-stripped text in one paragraph, and
|
|
63
|
+
* the client then renders the parsed tree, so hydration does not match. Recorded
|
|
64
|
+
* as an ADR-27 (3) waiver owned by remediation Step 8; render it client-only, or
|
|
65
|
+
* use `renderSafeHtml`-based components, when server rendering matters.
|
|
66
|
+
*/
|
|
37
67
|
export declare const HtmlToMui: React.ForwardRefExoticComponent<HtmlToMuiProps & React.RefAttributes<HTMLDivElement>>;
|
|
38
68
|
export default HtmlToMui;
|
|
39
69
|
//# sourceMappingURL=HtmlToMui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HtmlToMui.d.ts","sourceRoot":"","sources":["../../../src/components/HtmlToMui/HtmlToMui.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"HtmlToMui.d.ts","sourceRoot":"","sources":["../../../src/components/HtmlToMui/HtmlToMui.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAWL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAUvB,uEAAuE;AACvE,KAAK,iBAAiB,GAAG,OAAO,GAAG,OAAO,CAAC;AAgD3C,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAChD;;OAEG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAmRD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,uFAyCpB,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @module components/SandboxedIframeRenderer
|
|
4
4
|
* @example
|
|
5
5
|
* ```tsx
|
|
6
|
-
*
|
|
6
|
+
* // Internal component: not exported from the package yet.
|
|
7
|
+
* import { SandboxedIframeRenderer } from '../components/SandboxedIframeRenderer';
|
|
7
8
|
*
|
|
8
9
|
* <SandboxedIframeRenderer
|
|
9
10
|
* title="Policy Preview"
|
|
@@ -36,14 +37,32 @@ export interface SandboxedIframeRendererProps {
|
|
|
36
37
|
/**
|
|
37
38
|
* Sandbox preset:
|
|
38
39
|
* - strict: no scripts allowed
|
|
39
|
-
* - interactive: allows scripts inside iframe only
|
|
40
|
-
* @default "
|
|
40
|
+
* - interactive: allows scripts inside iframe only (never same-origin access)
|
|
41
|
+
* @default "strict"
|
|
41
42
|
*/
|
|
42
43
|
sandboxPreset?: SandboxPreset;
|
|
43
44
|
/**
|
|
44
|
-
* Explicit sandbox value override.
|
|
45
|
+
* Explicit sandbox value override. Tokens are normalised to lower case (as
|
|
46
|
+
* browsers read them), and `allow-same-origin` is always removed when combined
|
|
47
|
+
* with `allow-scripts`, because together they let the framed content remove
|
|
48
|
+
* its own sandbox. Without `allow-same-origin` the framed document has an
|
|
49
|
+
* opaque origin, so its navigations send no referrer; adding it (without
|
|
50
|
+
* scripts) lets untrusted content send the host page URL, so keep it out for
|
|
51
|
+
* untrusted HTML.
|
|
45
52
|
*/
|
|
46
53
|
sandbox?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Content-Security-Policy injected as the first element of the framed document.
|
|
56
|
+
* The default blocks resource loads from the network (scripts, images, styles,
|
|
57
|
+
* fonts, fetch/XHR, frames): `default-src 'none'; img-src data: blob:;
|
|
58
|
+
* style-src 'unsafe-inline'`, plus `script-src 'unsafe-inline'` when the
|
|
59
|
+
* resolved sandbox allows scripts. CSP does not govern navigation: the sandbox
|
|
60
|
+
* blocks top-level and popup navigation and form submission (both presets; only
|
|
61
|
+
* a `sandbox` override with `allow-forms` enables forms), but the frame can
|
|
62
|
+
* still navigate itself through a link (or script, when allowed), so data
|
|
63
|
+
* could leave in a URL. Pass a string to customise, or `false` to inject nothing.
|
|
64
|
+
*/
|
|
65
|
+
contentSecurityPolicy?: string | false;
|
|
47
66
|
/**
|
|
48
67
|
* Optional iframe allow attribute.
|
|
49
68
|
*/
|
|
@@ -57,6 +76,31 @@ export interface SandboxedIframeRendererProps {
|
|
|
57
76
|
*/
|
|
58
77
|
onLoad?: React.ReactEventHandler<HTMLIFrameElement>;
|
|
59
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @internal — exported for tests only; not re-exported from index.ts.
|
|
81
|
+
* True when an override asks for scripts together with same-origin access,
|
|
82
|
+
* which {@link resolveSandboxValue} refuses.
|
|
83
|
+
*/
|
|
84
|
+
export declare function sandboxDropsSameOrigin(sandboxOverride?: string): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* @internal — exported for tests only; not re-exported from index.ts.
|
|
87
|
+
* Resolve the sandbox attribute (pure). Tokens are lower-cased and split on HTML
|
|
88
|
+
* whitespace (browsers compare them ASCII case-insensitively), and scripts are
|
|
89
|
+
* never combined with same-origin access.
|
|
90
|
+
*/
|
|
91
|
+
export declare function resolveSandboxValue(sandboxPreset: SandboxPreset, sandboxOverride?: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* @internal — exported for tests only; not re-exported from index.ts.
|
|
94
|
+
* Put a CSP `<meta>` before any author content. It goes right after a leading
|
|
95
|
+
* doctype (so the doctype stays first) or at the very start. The HTML parser
|
|
96
|
+
* places a leading `<meta>` into `<head>` before anything else is processed,
|
|
97
|
+
* so the policy applies to every script and resource in the document. The
|
|
98
|
+
* author HTML is never searched for `<head>`: that text could sit inside a
|
|
99
|
+
* comment, an attribute or a script, where a meta would not be enforced.
|
|
100
|
+
* (iframe `srcdoc` documents are always parsed in no-quirks mode, so a meta
|
|
101
|
+
* ahead of a missing doctype cannot change rendering.)
|
|
102
|
+
*/
|
|
103
|
+
export declare function injectCsp(html: string, policy: string): string;
|
|
60
104
|
export declare const SandboxedIframeRenderer: React.ForwardRefExoticComponent<SandboxedIframeRendererProps & React.RefAttributes<HTMLDivElement>>;
|
|
61
105
|
export default SandboxedIframeRenderer;
|
|
62
106
|
//# sourceMappingURL=SandboxedIframeRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxedIframeRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/SandboxedIframeRenderer/SandboxedIframeRenderer.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SandboxedIframeRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/SandboxedIframeRenderer/SandboxedIframeRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9D,KAAK,aAAa,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE9C,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;OAUG;IACH,qBAAqB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;CACrD;AAYD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAIxE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAQlG;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAO9D;AAED,eAAO,MAAM,uBAAuB,qGA8DnC,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal — not part of the public API; used by components that render untrusted content.
|
|
3
|
+
* @fileoverview Safe rendering of untrusted (model-, user- or data-supplied) content.
|
|
4
|
+
* @module components/shared/safeContent
|
|
5
|
+
*
|
|
6
|
+
* One module owns every policy for turning untrusted strings into DOM, so AI
|
|
7
|
+
* components never reach for `dangerouslySetInnerHTML` (ADR-09, audit SEC-01..03):
|
|
8
|
+
*
|
|
9
|
+
* - {@link renderSafeHtml} — a deterministic string tokenizer (no DOMParser, no
|
|
10
|
+
* `window`), so `renderToString` and the client build identical trees (no
|
|
11
|
+
* hydration mismatch). Allowlisted tags become React elements; dangerous tags
|
|
12
|
+
* are dropped with their content; every other tag is unwrapped to its text.
|
|
13
|
+
* - {@link isSafeHref} / {@link isSafeSrc} — separate URL policies for links and
|
|
14
|
+
* images, evaluated after decoding entities and removing whitespace/C0 controls,
|
|
15
|
+
* so obfuscations like `java\tscript:` or `javascript:` are caught.
|
|
16
|
+
* - {@link sanitizeInlineStyle} — a typographic/box allowlist for inline styles.
|
|
17
|
+
*
|
|
18
|
+
* React escapes every text node and attribute value, so output is inert by
|
|
19
|
+
* construction; the policies decide only what structure survives.
|
|
20
|
+
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
* Decode decimal, hex and known named character references the way browsers do.
|
|
25
|
+
* Numeric references decode with or without a semicolon. Named references need
|
|
26
|
+
* their semicolon, except the legacy set; in attribute values a legacy reference
|
|
27
|
+
* followed by `=` or an alphanumeric stays literal (so `?a=1©=2` keeps its
|
|
28
|
+
* query string).
|
|
29
|
+
*/
|
|
30
|
+
export declare function decodeEntities(input: string, inAttribute?: boolean): string;
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
* Link policy: http, https, mailto, tel, relative paths and fragments.
|
|
34
|
+
* Everything else — javascript:, vbscript:, data:, file:, and any obfuscated
|
|
35
|
+
* form of them — is unsafe.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isSafeHref(url: string | null | undefined): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
* Image-source policy: http, https, blob:, relative paths, and raster
|
|
41
|
+
* `data:image/(png|jpeg|gif|webp|avif|bmp|x-icon)`. Never `data:image/svg+xml`
|
|
42
|
+
* (SVG can carry script), never any other data: payload, and no app-shell
|
|
43
|
+
* schemes (file:, asset:, tauri:, capacitor:).
|
|
44
|
+
*/
|
|
45
|
+
export declare function isSafeSrc(url: string | null | undefined): boolean;
|
|
46
|
+
/** @internal Test-only: forget which unsafe-URL warnings were shown (mirrors `__resetDeprecationWarnings`). */
|
|
47
|
+
export declare function __resetUnsafeUrlWarnings(): void;
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
* Dev-only, once per component, kind and scheme: report a URL that a safety
|
|
51
|
+
* policy blocked, so integrators notice a dropped link or image instead of
|
|
52
|
+
* silently losing it. Silent in production builds.
|
|
53
|
+
*/
|
|
54
|
+
export declare function warnUnsafeUrl(component: string, url: string | null | undefined, kind?: 'link' | 'image'): void;
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
* True for sources fetched from the network: http(s) and network-path URLs.
|
|
58
|
+
* Browsers treat a backslash like a slash in such URLs, so `\\host/x` and
|
|
59
|
+
* `/\\host/x` count as remote too.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isRemoteSrc(url: string | null | undefined): boolean;
|
|
62
|
+
/** @internal A style map suitable for an MUI `sx` / React `style` object. */
|
|
63
|
+
export type SafeStyleMap = Record<string, string | number>;
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
* Parse an inline `style` attribute through the typographic/box allowlist.
|
|
67
|
+
* Positioning (position, inset, top/left/right/bottom, z-index), transforms,
|
|
68
|
+
* filters and any value that can fetch or execute (url(), expression(), var(),
|
|
69
|
+
* attr(), image-set(), @import, escapes) are dropped.
|
|
70
|
+
*/
|
|
71
|
+
export declare function sanitizeInlineStyle(styleValue: string | null | undefined): SafeStyleMap | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
* Tags removed together with everything inside them. A superset of the
|
|
75
|
+
* historical HtmlToMui BLOCKED_TAGS, so nothing previously dropped is loosened.
|
|
76
|
+
*/
|
|
77
|
+
export declare const DROP_WITH_CONTENT_TAGS: ReadonlySet<string>;
|
|
78
|
+
/** @internal Default (and maximum) tag set kept by {@link renderSafeHtml}. */
|
|
79
|
+
export declare const DEFAULT_ALLOWED_TAGS: ReadonlySet<string>;
|
|
80
|
+
type Token = {
|
|
81
|
+
kind: 'text';
|
|
82
|
+
value: string;
|
|
83
|
+
} | {
|
|
84
|
+
kind: 'start';
|
|
85
|
+
name: string;
|
|
86
|
+
attrs: Record<string, string>;
|
|
87
|
+
selfClosing: boolean;
|
|
88
|
+
} | {
|
|
89
|
+
kind: 'end';
|
|
90
|
+
name: string;
|
|
91
|
+
};
|
|
92
|
+
/** @internal Split HTML into tokens. Comments, doctypes and processing instructions vanish. */
|
|
93
|
+
export declare function tokenizeHtml(source: string): Token[];
|
|
94
|
+
/** @internal Tags {@link renderSafeHtml} can keep. */
|
|
95
|
+
export type SafeHtmlTag = 'b' | 'strong' | 'i' | 'em' | 'code' | 'br' | 'p' | 'ul' | 'ol' | 'li' | 'span' | 'a' | 'mark';
|
|
96
|
+
/** @internal Options for {@link renderSafeHtml}. */
|
|
97
|
+
export interface RenderSafeHtmlOptions {
|
|
98
|
+
/**
|
|
99
|
+
* Restrict the kept tags to a subset of {@link DEFAULT_ALLOWED_TAGS} (see
|
|
100
|
+
* {@link SafeHtmlTag}). Other names are accepted, warned about in development
|
|
101
|
+
* and unwrapped to text: the builder only implements the HTML parser's nesting
|
|
102
|
+
* rules for the default tags, and that is what keeps server and client output
|
|
103
|
+
* identical (no hydration mismatch).
|
|
104
|
+
*/
|
|
105
|
+
allowTags?: Iterable<string>;
|
|
106
|
+
/**
|
|
107
|
+
* Classes allowed on `span`/`mark`, mapped to the element that renders them.
|
|
108
|
+
* `{ 'insight-highlight': 'span' }` keeps the class on a span;
|
|
109
|
+
* `{ highlight: 'mark' }` renders a semantic `<mark>`. All other classes are dropped.
|
|
110
|
+
*/
|
|
111
|
+
allowClasses?: Record<string, 'span' | 'mark'>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
* Render untrusted HTML as React nodes through the allowlist. Deterministic:
|
|
116
|
+
* the same input yields the same tree on the server and the client.
|
|
117
|
+
*
|
|
118
|
+
* Default tags: b, strong, i, em, code, br, p, ul, ol, li, span, a, mark.
|
|
119
|
+
* Anchors keep only a safe `href`, `title` and `target="_blank"`, and always
|
|
120
|
+
* get `rel="noopener noreferrer"`; an anchor with an unsafe href becomes text.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```tsx
|
|
124
|
+
* <Box>{renderSafeHtml(thought, { allowClasses: { 'insight-highlight': 'span' } })}</Box>
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function renderSafeHtml(html: string | null | undefined, options?: RenderSafeHtmlOptions): React.ReactNode;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=safeContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeContent.d.ts","sourceRoot":"","sources":["../../../src/components/shared/safeContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6F/B;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,MAAM,CAqBzE;AAqBD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAMlE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAQjE;AAID,+GAA+G;AAC/G,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,GAAE,MAAM,GAAG,OAAgB,GAAG,IAAI,CAetH;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GA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AC,CAAC;CAChD;AAyMD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE,qBAA0B,GAAG,KAAK,CAAC,SAAS,CAIpH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warnDeprecated.d.ts","sourceRoot":"","sources":["../../../src/components/shared/warnDeprecated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,GAClB,IAAI,
|
|
1
|
+
{"version":3,"file":"warnDeprecated.d.ts","sourceRoot":"","sources":["../../../src/components/shared/warnDeprecated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,GAClB,IAAI,CAeN;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}
|