netra-artifacts 0.1.0-alpha.0 → 0.1.0-alpha.2
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 +35 -1
- package/README.md +48 -48
- package/dist/classifier/classifierPrompt.js +27 -27
- package/dist/client/useArtifactStream.d.ts +1 -1
- package/dist/client/useArtifactStream.js +1 -1
- package/dist/iframe/iframeSrcDoc.d.ts.map +1 -1
- package/dist/iframe/iframeSrcDoc.js +91 -38
- package/dist/iframe/iframeSrcDoc.js.map +1 -1
- package/dist/prompts/htmlArtifactPrompt.d.ts.map +1 -1
- package/dist/prompts/htmlArtifactPrompt.js +102 -61
- package/dist/prompts/htmlArtifactPrompt.js.map +1 -1
- package/dist-cjs/classifier/classifierPrompt.js +27 -27
- package/dist-cjs/client/useArtifactStream.js +1 -1
- package/dist-cjs/iframe/iframeSrcDoc.js +91 -38
- package/dist-cjs/iframe/iframeSrcDoc.js.map +1 -1
- package/dist-cjs/prompts/htmlArtifactPrompt.js +102 -61
- package/dist-cjs/prompts/htmlArtifactPrompt.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to `netra` are documented here. This project
|
|
3
|
+
All notable changes to `netra-artifacts` are documented here. This project
|
|
4
4
|
adheres to [Semantic Versioning](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- HTML-artifact prompt reworked to a **hybrid styling model**: one small shared
|
|
11
|
+
`<style>` design system (box-sizing reset + fluid `clamp()` type/space scale +
|
|
12
|
+
element defaults + `.wrap/.stack/.grid/.row/.card/.scroll-x` utility classes)
|
|
13
|
+
plus inline `style=""` for per-element specifics, with an optional 1–2 `@media`
|
|
14
|
+
breakpoints as a third tier. Cuts repeated inline markup and yields
|
|
15
|
+
compact-on-mobile, comfortable-on-desktop layouts. (`<style>` was always
|
|
16
|
+
sanitizer-allowed; the prompt previously forbade it for streaming reasons.)
|
|
17
|
+
- Camouflage/seamless rendering now **preserves inner card surfaces**: only
|
|
18
|
+
`html`/`body` are forced transparent so the page blends into the host, while
|
|
19
|
+
data cards keep their own backgrounds, gradients, text, and border colours
|
|
20
|
+
(previously every block element was force-transparented, flattening the UI).
|
|
21
|
+
The seamless prompt now requires visible card surfaces.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Artifacts that pinned the root to the viewport (`height:100%`,
|
|
26
|
+
`min-height:100vh`) collapsed to ~0 height in the auto-sizing iframe and
|
|
27
|
+
rendered blank. `SEAMLESS_BASE` and the camouflage pass now force
|
|
28
|
+
`html,body{height:auto;min-height:0}`, and the prompt forbids viewport-relative
|
|
29
|
+
root heights (the artifact is auto-sized to content).
|
|
30
|
+
- `position:sticky`/`position:fixed` ghosting over scrolled content, and CSS
|
|
31
|
+
leaking as visible text when a data-URI `<svg>` (or backslash-escaped quotes)
|
|
32
|
+
was placed inside a `style` attribute — both now hard rules in the prompt and
|
|
33
|
+
the `html-practices` skill.
|
|
34
|
+
- Camouflage CSS normalizer is now brace-aware: nested `@media`/`@supports`/
|
|
35
|
+
`@container` blocks are preserved and their inner rules normalized, instead of
|
|
36
|
+
being mangled by a flat regex.
|
|
37
|
+
- Theme-aware custom scrollbars are injected into the artifact iframe (tinted
|
|
38
|
+
from `--foreground`/`--fg`), so inner scroll containers match the palette.
|
|
39
|
+
|
|
6
40
|
## [0.1.0] - 2026-05-29
|
|
7
41
|
|
|
8
42
|
### Added
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Netra Predictive HTML Parser
|
|
2
2
|
|
|
3
|
-
Experimental dependency-free package for streaming AI-generated HTML into
|
|
4
|
-
sandboxed iframe previews. Bring any model SDK that can produce text chunks.
|
|
5
|
-
|
|
6
|
-
The high-level server helper is provider-agnostic: pass a
|
|
7
|
-
`generateTextStream(args) => AsyncIterable<string>` adapter. For lower-level
|
|
8
|
-
integrations, `streamHtmlArtifactFromTextStream` accepts raw text chunks
|
|
9
|
-
directly.
|
|
3
|
+
Experimental dependency-free package for streaming AI-generated HTML into
|
|
4
|
+
sandboxed iframe previews. Bring any model SDK that can produce text chunks.
|
|
5
|
+
|
|
6
|
+
The high-level server helper is provider-agnostic: pass a
|
|
7
|
+
`generateTextStream(args) => AsyncIterable<string>` adapter. For lower-level
|
|
8
|
+
integrations, `streamHtmlArtifactFromTextStream` accepts raw text chunks
|
|
9
|
+
directly.
|
|
10
10
|
|
|
11
11
|
Netra keeps two versions of streamed HTML:
|
|
12
12
|
|
|
@@ -19,38 +19,38 @@ document.
|
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
|
22
|
-
```bash
|
|
23
|
-
npm install netra
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Add whatever provider SDK you want:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install @ai-sdk/google
|
|
30
|
-
```
|
|
22
|
+
```bash
|
|
23
|
+
npm install netra-artifacts
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Add whatever provider SDK you want:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @ai-sdk/google
|
|
30
|
+
```
|
|
31
31
|
|
|
32
32
|
## Backend
|
|
33
33
|
|
|
34
|
-
```ts
|
|
35
|
-
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
36
|
-
import { generateText, streamText } from "ai";
|
|
37
|
-
import { createArtifactStreamResponse } from "netra/server";
|
|
38
|
-
|
|
39
|
-
const google = createGoogleGenerativeAI({
|
|
40
|
-
apiKey: process.env.GOOGLE_API_KEY,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
export async function POST(req: Request) {
|
|
44
|
-
const { messages } = await req.json();
|
|
45
|
-
const model = google("gemini-2.5-flash");
|
|
46
|
-
|
|
47
|
-
return createArtifactStreamResponse({
|
|
48
|
-
messages,
|
|
49
|
-
generateTextStream: (args) => streamText({ model, ...args }).textStream,
|
|
50
|
-
generateText: async (args) => (await generateText({ model, ...args })).text,
|
|
51
|
-
mode: "auto",
|
|
52
|
-
snapshotIntervalMs: 0,
|
|
53
|
-
allowExternalFonts: true,
|
|
34
|
+
```ts
|
|
35
|
+
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
36
|
+
import { generateText, streamText } from "ai";
|
|
37
|
+
import { createArtifactStreamResponse } from "netra-artifacts/server";
|
|
38
|
+
|
|
39
|
+
const google = createGoogleGenerativeAI({
|
|
40
|
+
apiKey: process.env.GOOGLE_API_KEY,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export async function POST(req: Request) {
|
|
44
|
+
const { messages } = await req.json();
|
|
45
|
+
const model = google("gemini-2.5-flash");
|
|
46
|
+
|
|
47
|
+
return createArtifactStreamResponse({
|
|
48
|
+
messages,
|
|
49
|
+
generateTextStream: (args) => streamText({ model, ...args }).textStream,
|
|
50
|
+
generateText: async (args) => (await generateText({ model, ...args })).text,
|
|
51
|
+
mode: "auto",
|
|
52
|
+
snapshotIntervalMs: 0,
|
|
53
|
+
allowExternalFonts: true,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
```
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
createSseResponse,
|
|
64
64
|
event,
|
|
65
65
|
streamHtmlArtifactFromTextStream,
|
|
66
|
-
} from "netra/server";
|
|
66
|
+
} from "netra-artifacts/server";
|
|
67
67
|
|
|
68
68
|
async function* toText(chunks: AsyncIterable<unknown>) {
|
|
69
69
|
for await (const chunk of chunks) {
|
|
@@ -114,7 +114,7 @@ export async function POST(req: Request) {
|
|
|
114
114
|
```tsx
|
|
115
115
|
"use client";
|
|
116
116
|
|
|
117
|
-
import { ArtifactMessage, useArtifactStream } from "netra/client";
|
|
117
|
+
import { ArtifactMessage, useArtifactStream } from "netra-artifacts/client";
|
|
118
118
|
|
|
119
119
|
export function Chat() {
|
|
120
120
|
const { messages, artifacts, status, sendMessage } = useArtifactStream({
|
|
@@ -153,7 +153,7 @@ export function Chat() {
|
|
|
153
153
|
## Direct Parser Usage
|
|
154
154
|
|
|
155
155
|
```ts
|
|
156
|
-
import { PredictiveHtmlParser } from "netra/stream";
|
|
156
|
+
import { PredictiveHtmlParser } from "netra-artifacts/stream";
|
|
157
157
|
|
|
158
158
|
const parser = new PredictiveHtmlParser();
|
|
159
159
|
|
|
@@ -170,7 +170,7 @@ const frameB = parser.push('<input type="email" />');
|
|
|
170
170
|
## One-Shot Assembly
|
|
171
171
|
|
|
172
172
|
```ts
|
|
173
|
-
import { assembleStreamingHtml } from "netra/stream";
|
|
173
|
+
import { assembleStreamingHtml } from "netra-artifacts/stream";
|
|
174
174
|
|
|
175
175
|
const result = assembleStreamingHtml("<html><body><main><h1>Hello");
|
|
176
176
|
|
|
@@ -185,14 +185,14 @@ result.renderable;
|
|
|
185
185
|
|
|
186
186
|
| Import | Purpose |
|
|
187
187
|
| --- | --- |
|
|
188
|
-
| `netra` | Isomorphic helpers, types, parser, sanitizer |
|
|
189
|
-
| `netra/server` | Server response helpers for SSE |
|
|
190
|
-
| `netra/client` | React hook and UI components |
|
|
191
|
-
| `netra/iframe` | Iframe card and preview primitives |
|
|
192
|
-
| `netra/stream` | Parser, SSE, buffering utilities |
|
|
193
|
-
| `netra/sanitizer` | Sanitizer helpers |
|
|
194
|
-
| `netra/classifier` | Auto-mode classifier |
|
|
195
|
-
| `netra/types` | Public types |
|
|
188
|
+
| `netra-artifacts` | Isomorphic helpers, types, parser, sanitizer |
|
|
189
|
+
| `netra-artifacts/server` | Server response helpers for SSE |
|
|
190
|
+
| `netra-artifacts/client` | React hook and UI components |
|
|
191
|
+
| `netra-artifacts/iframe` | Iframe card and preview primitives |
|
|
192
|
+
| `netra-artifacts/stream` | Parser, SSE, buffering utilities |
|
|
193
|
+
| `netra-artifacts/sanitizer` | Sanitizer helpers |
|
|
194
|
+
| `netra-artifacts/classifier` | Auto-mode classifier |
|
|
195
|
+
| `netra-artifacts/types` | Public types |
|
|
196
196
|
|
|
197
197
|
## Protocol
|
|
198
198
|
|
|
@@ -2,40 +2,40 @@
|
|
|
2
2
|
* The classifier prompt. The model must return ONLY JSON of the shape
|
|
3
3
|
* `{ "mode": "markdown" | "artifact" | "generative_ui", "reason": "short reason" }`.
|
|
4
4
|
*/
|
|
5
|
-
export const CLASSIFIER_SYSTEM_PROMPT = `You are a routing classifier for an AI assistant that can answer in three ways:
|
|
6
|
-
|
|
7
|
-
1. "markdown" — a normal text/markdown chat answer.
|
|
8
|
-
2. "artifact" — a standalone, self-contained, STATIC HTML/CSS document rendered in a framed preview card (no JavaScript).
|
|
9
|
-
3. "generative_ui" — a chromeless, transparent, STATIC HTML/CSS UI rendered inline so it blends with the host app (no JavaScript).
|
|
10
|
-
|
|
11
|
-
Decide which mode best serves the user's most recent request.
|
|
12
|
-
|
|
5
|
+
export const CLASSIFIER_SYSTEM_PROMPT = `You are a routing classifier for an AI assistant that can answer in three ways:
|
|
6
|
+
|
|
7
|
+
1. "markdown" — a normal text/markdown chat answer.
|
|
8
|
+
2. "artifact" — a standalone, self-contained, STATIC HTML/CSS document rendered in a framed preview card (no JavaScript).
|
|
9
|
+
3. "generative_ui" — a chromeless, transparent, STATIC HTML/CSS UI rendered inline so it blends with the host app (no JavaScript).
|
|
10
|
+
|
|
11
|
+
Decide which mode best serves the user's most recent request.
|
|
12
|
+
|
|
13
13
|
Choose "markdown" when text is enough:
|
|
14
14
|
- explanations, Q&A, definitions, summaries
|
|
15
15
|
- debugging help, error analysis, code review
|
|
16
16
|
- writing code, functions, queries, scripts
|
|
17
17
|
- system design, architecture, best practices, advice
|
|
18
|
-
- comparisons that read fine as prose or a small table
|
|
19
|
-
- general writing and conversation
|
|
20
|
-
|
|
21
|
-
Choose "artifact" when a visual, standalone document/page adds real value:
|
|
22
|
-
- standalone forms (sign-up, login, contact, survey)
|
|
23
|
-
- landing pages, hero sections, pricing cards, product pages
|
|
24
|
-
- dashboards, stat grids, report/stat visualizations
|
|
25
|
-
- invoices, receipts, certificates, resumes/CVs
|
|
18
|
+
- comparisons that read fine as prose or a small table
|
|
19
|
+
- general writing and conversation
|
|
20
|
+
|
|
21
|
+
Choose "artifact" when a visual, standalone document/page adds real value:
|
|
22
|
+
- standalone forms (sign-up, login, contact, survey)
|
|
23
|
+
- landing pages, hero sections, pricing cards, product pages
|
|
24
|
+
- dashboards, stat grids, report/stat visualizations
|
|
25
|
+
- invoices, receipts, certificates, resumes/CVs
|
|
26
26
|
- email/newsletter templates
|
|
27
27
|
- profile/business cards, onboarding screens
|
|
28
|
-
- comparison cards, timelines, funnels, galleries
|
|
29
|
-
- CSS/SVG charts (bar, line, donut, progress) when the user wants a visual
|
|
30
|
-
|
|
31
|
-
Choose "generative_ui" when the user specifically wants UI that should feel native/inline in the host app:
|
|
32
|
-
- generative UI, inline UI, seamless/camouflaged/native UI
|
|
33
|
-
- widgets, components, interface states, UI kits/systems, component variations
|
|
34
|
-
- app/interface prototypes or explorations intended to sit inside the chat surface
|
|
35
|
-
|
|
36
|
-
Be conservative: if the request is primarily about understanding, reasoning, or code, prefer "markdown". Do not pick an HTML mode just because a topic could be visualized — only when the user actually wants a rendered UI/document.
|
|
37
|
-
|
|
38
|
-
Return ONLY minified JSON, no prose, no code fences:
|
|
28
|
+
- comparison cards, timelines, funnels, galleries
|
|
29
|
+
- CSS/SVG charts (bar, line, donut, progress) when the user wants a visual
|
|
30
|
+
|
|
31
|
+
Choose "generative_ui" when the user specifically wants UI that should feel native/inline in the host app:
|
|
32
|
+
- generative UI, inline UI, seamless/camouflaged/native UI
|
|
33
|
+
- widgets, components, interface states, UI kits/systems, component variations
|
|
34
|
+
- app/interface prototypes or explorations intended to sit inside the chat surface
|
|
35
|
+
|
|
36
|
+
Be conservative: if the request is primarily about understanding, reasoning, or code, prefer "markdown". Do not pick an HTML mode just because a topic could be visualized — only when the user actually wants a rendered UI/document.
|
|
37
|
+
|
|
38
|
+
Return ONLY minified JSON, no prose, no code fences:
|
|
39
39
|
{"mode":"markdown"|"artifact"|"generative_ui","reason":"short reason"}`;
|
|
40
40
|
export function buildClassifierUserPrompt(query) {
|
|
41
41
|
return `Classify this request:\n\n"""${query}"""\n\nReturn only the JSON object.`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { UseArtifactStreamOptions, UseArtifactStreamReturn } from "../types/client.js";
|
|
2
2
|
/**
|
|
3
|
-
* Drives a chat against
|
|
3
|
+
* Drives a chat against a `netra-artifacts` SSE endpoint. Reduces the event
|
|
4
4
|
* protocol into `messages` + `artifacts`, exposing `sendMessage`, `stop`, and
|
|
5
5
|
* `reset`. Markdown answers update a message; HTML answers also build an
|
|
6
6
|
* artifact record consumed by `HtmlArtifactCard`.
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { readArtifactStream } from "../stream/sse.js";
|
|
4
4
|
import { createMessageId } from "../core/createIds.js";
|
|
5
5
|
/**
|
|
6
|
-
* Drives a chat against
|
|
6
|
+
* Drives a chat against a `netra-artifacts` SSE endpoint. Reduces the event
|
|
7
7
|
* protocol into `messages` + `artifacts`, exposing `sendMessage`, `stop`, and
|
|
8
8
|
* `reset`. Markdown answers update a message; HTML answers also build an
|
|
9
9
|
* artifact record consumed by `HtmlArtifactCard`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframeSrcDoc.d.ts","sourceRoot":"","sources":["../../src/iframe/iframeSrcDoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"iframeSrcDoc.d.ts","sourceRoot":"","sources":["../../src/iframe/iframeSrcDoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA+B1D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAsBvD;AA2MD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,IAAI,CACpB,0BAA0B,EACxB,YAAY,GACZ,mBAAmB,GACnB,gBAAgB,GAChB,UAAU,GACV,oBAAoB,CACvB,CAAC;CACH;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAsBR;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,MAAM,CAUT"}
|
|
@@ -9,9 +9,24 @@ import { DEFAULT_SANDBOX, FORBIDDEN_SANDBOX_TOKENS } from "../constants/sandbox.
|
|
|
9
9
|
* light mode). Camouflage transparency is handled separately by
|
|
10
10
|
* {@link inlineCamouflageHtml}.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
// The `height:auto/min-height:0 !important` neutralizes viewport-relative root
|
|
13
|
+
// heights (height:100%, min-height:100vh) an artifact may set: the preview iframe
|
|
14
|
+
// auto-sizes to content, so those would otherwise collapse the frame to ~0 and
|
|
15
|
+
// nothing would show. `!important` is required to beat an inline <html style="">.
|
|
16
|
+
const SEAMLESS_BASE = `<style>html,body{margin:0;padding:0;height:auto!important;min-height:0!important;}*{box-sizing:border-box;}</style>`;
|
|
17
|
+
// Custom, theme-aware scrollbars for any scroll containers INSIDE the artifact
|
|
18
|
+
// (e.g. .scroll-x wide tables). The host page's scrollbar CSS can't reach into
|
|
19
|
+
// the iframe document, so we inject our own — tinted from the artifact's
|
|
20
|
+
// --foreground so it matches whatever palette the artifact/theme uses, with a
|
|
21
|
+
// neutral fallback when no theme variable is present.
|
|
22
|
+
const SCROLLBAR_CSS = `<style>
|
|
23
|
+
*{scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--foreground,var(--fg,#9aa0ab)) 28%,transparent) transparent}
|
|
24
|
+
*::-webkit-scrollbar{width:10px;height:10px}
|
|
25
|
+
*::-webkit-scrollbar-track{background:transparent}
|
|
26
|
+
*::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--foreground,var(--fg,#9aa0ab)) 28%,transparent);border-radius:999px;border:2px solid transparent;background-clip:content-box}
|
|
27
|
+
*::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--foreground,var(--fg,#9aa0ab)) 48%,transparent);background-clip:content-box}
|
|
28
|
+
*::-webkit-scrollbar-corner{background:transparent}
|
|
29
|
+
</style>`;
|
|
15
30
|
/**
|
|
16
31
|
* Render a host {@link ArtifactTheme} into a `<style>` block exposing its values
|
|
17
32
|
* as CSS custom properties inside the iframe, plus sensible base color/font so
|
|
@@ -112,8 +127,11 @@ function inlineCamouflageHtml(html, theme) {
|
|
|
112
127
|
"background-image:none!important",
|
|
113
128
|
"color-scheme:normal!important",
|
|
114
129
|
"box-sizing:border-box",
|
|
130
|
+
// Inline artifacts are auto-sized to their CONTENT; viewport-relative root
|
|
131
|
+
// heights (height:100%, min-height:100vh) would collapse the frame to ~0.
|
|
132
|
+
"height:auto!important",
|
|
133
|
+
"min-height:0!important",
|
|
115
134
|
"color:var(--foreground,#f4f4f8)!important",
|
|
116
|
-
theme?.fontFamily ? "font-family:var(--font)!important" : "",
|
|
117
135
|
]
|
|
118
136
|
.filter(Boolean)
|
|
119
137
|
.join(";");
|
|
@@ -124,25 +142,21 @@ function inlineCamouflageHtml(html, theme) {
|
|
|
124
142
|
"background-color:transparent!important",
|
|
125
143
|
"background-image:none!important",
|
|
126
144
|
"box-sizing:border-box",
|
|
145
|
+
"height:auto!important",
|
|
146
|
+
"min-height:0!important",
|
|
127
147
|
"color:var(--foreground,#f4f4f8)!important",
|
|
128
|
-
theme?.fontFamily ? "font-family:var(--font)!important" : "",
|
|
129
148
|
]
|
|
130
149
|
.filter(Boolean)
|
|
131
150
|
.join(";");
|
|
132
|
-
const blockStyle = [
|
|
133
|
-
"background-color:transparent!important",
|
|
134
|
-
"background-image:none!important",
|
|
135
|
-
"box-sizing:border-box",
|
|
136
|
-
"color:var(--foreground,#f4f4f8)!important",
|
|
137
|
-
"border-color:var(--border,rgba(255,255,255,0.12))!important",
|
|
138
|
-
].join(";");
|
|
139
151
|
return html.replace(CAMOUFLAGE_TAGS, (tag, name, attrs) => {
|
|
140
152
|
const lowerName = name.toLowerCase();
|
|
141
153
|
if (lowerName === "html")
|
|
142
154
|
return `<${name}${appendInlineStyle(attrs, rootStyle)}>`;
|
|
143
155
|
if (lowerName === "body")
|
|
144
156
|
return `<${name}${appendInlineStyle(attrs, bodyStyle)}>`;
|
|
145
|
-
|
|
157
|
+
// Inner blocks keep their OWN surfaces, gradients, text and border colours so
|
|
158
|
+
// data cards stay clearly visible — camouflage only makes the PAGE transparent.
|
|
159
|
+
return tag;
|
|
146
160
|
});
|
|
147
161
|
}
|
|
148
162
|
function normalizeInlineCamouflageStyle(style) {
|
|
@@ -152,43 +166,82 @@ function normalizeInlineCamouflageStyle(style) {
|
|
|
152
166
|
.filter(Boolean)
|
|
153
167
|
.join(";");
|
|
154
168
|
}
|
|
169
|
+
// Conditional group at-rules whose CONTENTS are nested style rules we still
|
|
170
|
+
// want to normalize (e.g. @media breakpoints). Other at-rules (@keyframes,
|
|
171
|
+
// @font-face, @page) are passed through verbatim — their bodies aren't plain
|
|
172
|
+
// style declarations and must not be touched.
|
|
173
|
+
const NESTED_AT_RULE = /^(media|supports|container)\b/i;
|
|
174
|
+
/**
|
|
175
|
+
* Normalize the CSS inside a `<style>` block for camouflage (light → transparent
|
|
176
|
+
* backgrounds, light text → host foreground). Brace-aware: it tracks nesting so
|
|
177
|
+
* conditional group rules like `@media (...) { .x{...} }` are preserved and
|
|
178
|
+
* their inner rules normalized recursively, instead of being mangled by a flat
|
|
179
|
+
* regex. Malformed/partial CSS (mid-stream) is emitted as-is.
|
|
180
|
+
*/
|
|
155
181
|
function normalizeCamouflageCss(css) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
.
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
let out = "";
|
|
183
|
+
let i = 0;
|
|
184
|
+
const n = css.length;
|
|
185
|
+
while (i < n) {
|
|
186
|
+
const open = css.indexOf("{", i);
|
|
187
|
+
if (open === -1) {
|
|
188
|
+
out += css.slice(i);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
// Walk to the brace that closes this block, respecting nesting.
|
|
192
|
+
let depth = 1;
|
|
193
|
+
let j = open + 1;
|
|
194
|
+
for (; j < n && depth > 0; j++) {
|
|
195
|
+
if (css[j] === "{")
|
|
196
|
+
depth++;
|
|
197
|
+
else if (css[j] === "}")
|
|
198
|
+
depth--;
|
|
199
|
+
}
|
|
200
|
+
// `j` now points just past the matching `}` (or end of string if partial).
|
|
201
|
+
const close = depth === 0 ? j - 1 : n;
|
|
202
|
+
const prelude = css.slice(i, open);
|
|
203
|
+
const inner = css.slice(open + 1, close);
|
|
204
|
+
const selector = prelude.trim();
|
|
205
|
+
const atRule = selector.startsWith("@")
|
|
206
|
+
? selector.slice(1).match(/^[\w-]+/)?.[0] ?? ""
|
|
207
|
+
: "";
|
|
208
|
+
if (atRule && NESTED_AT_RULE.test(atRule)) {
|
|
209
|
+
out += `${prelude}{${normalizeCamouflageCss(inner)}}`;
|
|
210
|
+
}
|
|
211
|
+
else if (atRule) {
|
|
212
|
+
out += `${prelude}{${inner}}`;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
const normalizedBody = inner
|
|
216
|
+
.split(";")
|
|
217
|
+
.map((declaration) => normalizeCamouflageDeclaration(declaration, /\b(html|body)\b/i.test(selector)))
|
|
218
|
+
.filter(Boolean)
|
|
219
|
+
.join(";");
|
|
220
|
+
out += normalizedBody ? `${selector}{${normalizedBody}}` : `${prelude}{${inner}}`;
|
|
221
|
+
}
|
|
222
|
+
i = close + 1;
|
|
223
|
+
}
|
|
224
|
+
return out;
|
|
165
225
|
}
|
|
166
226
|
function normalizeCamouflageDeclaration(declaration, forceTransparent = false) {
|
|
167
227
|
const trimmed = declaration.trim();
|
|
168
228
|
if (!trimmed)
|
|
169
229
|
return "";
|
|
230
|
+
// Inner content (cards, sections, inline styles) is left untouched so its own
|
|
231
|
+
// surfaces, gradients, text and border colours stay intact — camouflage only
|
|
232
|
+
// makes the PAGE transparent. `forceTransparent` is set only for html/body.
|
|
233
|
+
if (!forceTransparent)
|
|
234
|
+
return trimmed;
|
|
170
235
|
const match = trimmed.match(/^(-?[\w-]+)\s*:\s*([\s\S]+)$/);
|
|
171
236
|
if (!match)
|
|
172
237
|
return trimmed;
|
|
173
238
|
const property = match[1]?.toLowerCase() ?? "";
|
|
174
239
|
const value = match[2] ?? "";
|
|
175
240
|
const important = /!important/i.test(value) ? " !important" : "";
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return `${property}:none${important}`;
|
|
179
|
-
}
|
|
180
|
-
if (property.startsWith("--") && LIGHT_COLOR.test(cleanValue)) {
|
|
181
|
-
return `${property}:transparent`;
|
|
182
|
-
}
|
|
241
|
+
if (property === "background-image")
|
|
242
|
+
return `background-image:none${important}`;
|
|
183
243
|
if (property === "background" || property === "background-color") {
|
|
184
|
-
|
|
185
|
-
return `${property}:transparent${important}`;
|
|
186
|
-
if (LIGHT_COLOR.test(cleanValue) || LIGHT_GRADIENT.test(cleanValue)) {
|
|
187
|
-
return `${property}:transparent${important}`;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (property === "color" && LIGHT_COLOR.test(cleanValue)) {
|
|
191
|
-
return `${property}:var(--foreground,#f4f4f8)${important}`;
|
|
244
|
+
return `${property}:transparent${important}`;
|
|
192
245
|
}
|
|
193
246
|
return trimmed;
|
|
194
247
|
}
|
|
@@ -207,7 +260,7 @@ export function buildSrcDoc(rawHtml, options = {}) {
|
|
|
207
260
|
html = normalizeCamouflageHtml(html);
|
|
208
261
|
}
|
|
209
262
|
const themeStyles = theme && !camouflage ? themeToCss(theme) : "";
|
|
210
|
-
const injection = `<base target="_blank" />${seamless && !camouflage ? SEAMLESS_BASE : ""}${themeStyles}`;
|
|
263
|
+
const injection = `<base target="_blank" />${SCROLLBAR_CSS}${seamless && !camouflage ? SEAMLESS_BASE : ""}${themeStyles}`;
|
|
211
264
|
let doc;
|
|
212
265
|
if (isFullDocument(html)) {
|
|
213
266
|
doc = injectIntoHead(html, injection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframeSrcDoc.js","sourceRoot":"","sources":["../../src/iframe/iframeSrcDoc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"iframeSrcDoc.js","sourceRoot":"","sources":["../../src/iframe/iframeSrcDoc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEpF;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,GAAG,CAAC;AAC7D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAG9B;IACC,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,QAAQ;aACZ,KAAK,CAAC,KAAK,CAAC;aACZ,MAAM,CAAC,OAAO,CAAC;aACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAU,CAAC,CAAC;aAC7D,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;AAC7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"htmlArtifactPrompt.d.ts","sourceRoot":"","sources":["../../src/prompts/htmlArtifactPrompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;
|
|
1
|
+
{"version":3,"file":"htmlArtifactPrompt.d.ts","sourceRoot":"","sources":["../../src/prompts/htmlArtifactPrompt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACd,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAgQD,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAqC/E;AAED,yEAAyE;AACzE,eAAO,MAAM,2BAA2B,QAA4B,CAAC"}
|