vizmatic 0.1.1 → 0.1.3
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/PROMPT.md +27 -3
- package/README.md +78 -7
- package/dist/{chunk-ADU7JROD.js → chunk-SGIYXUY3.js} +26 -10
- package/dist/cli.js +4 -3
- package/dist/index.d.ts +7 -2
- package/dist/index.js +3 -1
- package/docs/PROMPT.md +27 -3
- package/docs/assets/examples/sources.json +52 -13
- package/package.json +9 -10
package/PROMPT.md
CHANGED
|
@@ -10,7 +10,7 @@ Use the package manager already present in the project.
|
|
|
10
10
|
pnpm add vizmatic react
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Optional edge build from GitHub:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
pnpm add github:bvolpato/vizmatic react
|
|
@@ -109,6 +109,29 @@ Render it:
|
|
|
109
109
|
pnpm exec vizmatic render frames --out public/vizmatic --theme dark,light --watermark "Your Product" --watermark-image ./logo.svg --watermark-position top-right
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
Frame modules can also export a watermark element when code-owned branding is clearer than CLI flags:
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { Watermark } from "vizmatic"
|
|
116
|
+
|
|
117
|
+
export const watermark = (
|
|
118
|
+
<Watermark position="bottom-right" opacity={0.82}>
|
|
119
|
+
<div style={{
|
|
120
|
+
display: "flex",
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
gap: 6,
|
|
123
|
+
color: "#7c3aed",
|
|
124
|
+
fontFamily: "Inter",
|
|
125
|
+
fontWeight: 800,
|
|
126
|
+
fontSize: 12,
|
|
127
|
+
}}>
|
|
128
|
+
<img src="data:image/svg+xml;base64,..." width={14} height={14} />
|
|
129
|
+
LeetLLM
|
|
130
|
+
</div>
|
|
131
|
+
</Watermark>
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
112
135
|
Render animated frames with `createScenes(theme)`:
|
|
113
136
|
|
|
114
137
|
```bash
|
|
@@ -289,9 +312,10 @@ Theme and render APIs:
|
|
|
289
312
|
- `getThemeColors(mode)`: `mode: ThemeMode`.
|
|
290
313
|
- `getToneColor(tone, c)`, `getToneGradient(tone)`, `getColor(name, c?)`, `getGradient(name)`, `heatColor(value)`.
|
|
291
314
|
- `renderToPng(element, options, createFn?, theme?)`: `element`, `options: RenderOptions`, `createFn?: (theme: "dark" | "light") => ReactNode`, `theme?: "dark" | "light"`.
|
|
292
|
-
- `
|
|
315
|
+
- `Watermark`: JSX marker component for frame-module exports. Props are `WatermarkOptions` plus `children?: ReactNode`; children become the complete watermark body.
|
|
316
|
+
- `WatermarkInput`: `boolean | string | WatermarkOptions | ReactElement<WatermarkElementProps>`. `true` uses Vizmatic defaults. A string sets the watermark text. A React element can be `<Watermark>...</Watermark>` or any custom element.
|
|
293
317
|
- `WatermarkImageOptions`: `src`, `width?: number`, `height?: number`, `alt?: string`. Programmatic `src` should be a URL or data URI. CLI `--watermark-image` accepts URL, data URI, or local path.
|
|
294
|
-
- `WatermarkOptions`: `text?: string | false`, `image?: string | WatermarkImageOptions`, `icon?: ReactNode | string | false`, `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" = "top-right"`, `opacity?: number`, `color?: string`.
|
|
318
|
+
- `WatermarkOptions`: `text?: string | false`, `image?: string | WatermarkImageOptions`, `icon?: ReactNode | string | false`, `element?: ReactNode`, `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" = "top-right"`, `opacity?: number`, `color?: string`.
|
|
295
319
|
- `RenderOptions`: `width`, `height`, `outputPath`, `watermark?: WatermarkInput`, `brand?: boolean | string` as a compatibility alias, `crop?: boolean = true`, `scale?: number = 2`.
|
|
296
320
|
- `renderToBuffer(element, width, height, options?)`: `options` supports `watermark?`, `brand?`, `scale?`.
|
|
297
321
|
- `renderToSvg(element, width, height, options?)`: `options` supports `watermark?`, `brand?`.
|
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<p align="center">
|
|
11
11
|
<a href="https://github.com/bvolpato/vizmatic/actions/workflows/ci.yml"><img src="https://github.com/bvolpato/vizmatic/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
|
|
12
|
+
<a href="https://github.com/bvolpato/vizmatic/actions/workflows/pages.yml"><img src="https://github.com/bvolpato/vizmatic/actions/workflows/pages.yml/badge.svg" alt="Pages" /></a>
|
|
12
13
|
<a href="https://github.com/bvolpato/vizmatic/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT" /></a>
|
|
13
14
|
<a href="https://www.npmjs.com/package/vizmatic"><img src="https://img.shields.io/npm/v/vizmatic?color=%2334d058" alt="npm version" /></a>
|
|
14
15
|
</p>
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
pnpm add vizmatic react
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
Optional edge build from GitHub:
|
|
38
39
|
|
|
39
40
|
```bash
|
|
40
41
|
pnpm add github:bvolpato/vizmatic react
|
|
@@ -92,6 +93,21 @@ await renderToPng(create("dark"), {
|
|
|
92
93
|
})
|
|
93
94
|
```
|
|
94
95
|
|
|
96
|
+
Code-owned watermark:
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { Watermark } from "vizmatic"
|
|
100
|
+
|
|
101
|
+
export const watermark = (
|
|
102
|
+
<Watermark position="bottom-right" opacity={0.82}>
|
|
103
|
+
<div style={{ display: "flex", alignItems: "center", gap: 6, color: "#7c3aed", fontWeight: 800 }}>
|
|
104
|
+
<img src="data:image/svg+xml;base64,..." width={14} height={14} />
|
|
105
|
+
Acme
|
|
106
|
+
</div>
|
|
107
|
+
</Watermark>
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
95
111
|
## Why Vizmatic
|
|
96
112
|
|
|
97
113
|
Models can write structure reliably. They are worse at raw SVG path work, fragile coordinate math, and one-off design choices.
|
|
@@ -339,6 +355,38 @@ export default frame.default
|
|
|
339
355
|
|
|
340
356
|
[`PROMPT.md`](PROMPT.md) is a plug-and-play instruction file for coding agents. It covers install, frame structure, every visual component with props, render commands, examples, quality rules, and final verification.
|
|
341
357
|
|
|
358
|
+
## Quality Gates
|
|
359
|
+
|
|
360
|
+
Vizmatic treats generated visuals as source-controlled build artifacts. CI fails if examples, site assets, source snippets, or prompt copies drift from the repo source.
|
|
361
|
+
|
|
362
|
+
| Gate | What it protects |
|
|
363
|
+
|---|---|
|
|
364
|
+
| `pnpm typecheck` | Type safety across `src/`, `examples/`, `scripts/`, and tests |
|
|
365
|
+
| `pnpm test` | Render pipeline behavior, watermark options, and output validation |
|
|
366
|
+
| `pnpm render:examples` | Dark/light PNGs, animated GIFs, source snippets, and website HTML |
|
|
367
|
+
| `pnpm docs:check` | Local asset references, `PROMPT.md` sync, source modal themes, and homepage affordances |
|
|
368
|
+
| `pnpm security:audit` | Fails on known low-or-higher npm advisories |
|
|
369
|
+
| `npm pack --dry-run` | Published package contents before release |
|
|
370
|
+
| CI generated-file check | Ensures rendered docs/examples are committed |
|
|
371
|
+
|
|
372
|
+
Run the full local gate:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
pnpm verify
|
|
376
|
+
git diff --exit-code
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## Supply Chain Posture
|
|
380
|
+
|
|
381
|
+
Vizmatic keeps runtime dependencies narrow: `satori` for JSX layout, `@resvg/resvg-js` for rasterization, `gifenc` for animated GIF output, and `tsx` so the CLI can load TSX scene files directly.
|
|
382
|
+
|
|
383
|
+
Package resolution is intentionally conservative:
|
|
384
|
+
|
|
385
|
+
- `minimumReleaseAge: 10080` requires timestamped package releases to age seven days before pnpm can select them.
|
|
386
|
+
- `strictPeerDependencies`, `engineStrict`, and `packageManagerStrict` make install drift fail loudly.
|
|
387
|
+
- `overrides.esbuild: 0.28.1` keeps the build graph on the patched esbuild line used by `tsx` and `tsup`.
|
|
388
|
+
- `pnpm security:audit` runs inside `pnpm verify`, `prepublishOnly`, and CI.
|
|
389
|
+
|
|
342
390
|
## API
|
|
343
391
|
|
|
344
392
|
### Themes
|
|
@@ -454,7 +502,8 @@ Vizmatic exports a fairly complete visual kit. Common cases should use these pri
|
|
|
454
502
|
| `renderAnimatedGif` | Render ordered `AnimatedScene[]` states to GIF with `fade`, `appear`, or no transition. |
|
|
455
503
|
| `renderToBuffer` | Render PNG to memory for tests and pipelines. |
|
|
456
504
|
| `renderToSvg` | Render SVG markup directly. |
|
|
457
|
-
| `
|
|
505
|
+
| `Watermark` | JSX marker component for expressive frame-module watermarks. |
|
|
506
|
+
| `wrapWithWatermark` | Add optional watermark text, image/icon, custom element, and position to a frame. |
|
|
458
507
|
| `detectBackgroundColor` | Find dominant transparent/background color for cropping. |
|
|
459
508
|
| `detectContentBounds` | Compute non-background bounds for autocrop. |
|
|
460
509
|
| `cropPixels` | Crop raw pixel buffers. |
|
|
@@ -466,7 +515,7 @@ Vizmatic exports a fairly complete visual kit. Common cases should use these pri
|
|
|
466
515
|
import { renderAnimatedGif, renderToPng, renderToBuffer, renderToSvg } from "vizmatic"
|
|
467
516
|
```
|
|
468
517
|
|
|
469
|
-
`renderToPng` renders at 2x scale by default, checks for clipped content, crops extra vertical whitespace, and can apply an optional watermark. Use `watermark.image` for a URL or data URI; the CLI also accepts local image paths through `--watermark-image`. `brand` still works as a compatibility alias.
|
|
518
|
+
`renderToPng` renders at 2x scale by default, checks for clipped content, crops extra vertical whitespace, and can apply an optional watermark. Use `watermark.image` for a URL or data URI; the CLI also accepts local image paths through `--watermark-image`. For frame-owned branding, export `watermark = <Watermark>...</Watermark>` from the frame module. `brand` still works as a compatibility alias.
|
|
470
519
|
|
|
471
520
|
```ts
|
|
472
521
|
await renderToPng(element, {
|
|
@@ -479,6 +528,20 @@ await renderToPng(element, {
|
|
|
479
528
|
})
|
|
480
529
|
```
|
|
481
530
|
|
|
531
|
+
Frame modules can export watermark config directly:
|
|
532
|
+
|
|
533
|
+
```tsx
|
|
534
|
+
import { Watermark } from "vizmatic"
|
|
535
|
+
|
|
536
|
+
export const watermark = (
|
|
537
|
+
<Watermark position="bottom-right">
|
|
538
|
+
<div style={{ color: "#7c3aed", fontFamily: "Inter", fontWeight: 800 }}>
|
|
539
|
+
Acme Research
|
|
540
|
+
</div>
|
|
541
|
+
</Watermark>
|
|
542
|
+
)
|
|
543
|
+
```
|
|
544
|
+
|
|
482
545
|
`renderAnimatedGif` turns ordered scene states into a looping GIF.
|
|
483
546
|
|
|
484
547
|
```ts
|
|
@@ -512,16 +575,24 @@ docs/
|
|
|
512
575
|
|
|
513
576
|
```bash
|
|
514
577
|
pnpm install
|
|
515
|
-
pnpm
|
|
516
|
-
pnpm render:examples
|
|
578
|
+
pnpm verify
|
|
517
579
|
pnpm site:serve
|
|
518
580
|
```
|
|
519
581
|
|
|
520
582
|
## Publishing
|
|
521
583
|
|
|
584
|
+
Preferred release path is the GitHub `Release` workflow. It runs the full verification gate, bumps the package version, publishes to npm with provenance, pushes the tag, and creates a GitHub release.
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
gh workflow run release.yml -f version=patch
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
The workflow requires an `NPM_TOKEN` repository secret with publish access.
|
|
591
|
+
|
|
592
|
+
Manual release fallback:
|
|
593
|
+
|
|
522
594
|
```bash
|
|
523
|
-
pnpm
|
|
524
|
-
pnpm render:examples
|
|
595
|
+
pnpm verify
|
|
525
596
|
npm publish --access public
|
|
526
597
|
```
|
|
527
598
|
|
|
@@ -25,8 +25,19 @@ function normalizeWatermark(watermark) {
|
|
|
25
25
|
if (watermark == null || watermark === false) return void 0;
|
|
26
26
|
if (watermark === true) return {};
|
|
27
27
|
if (typeof watermark === "string") return { text: watermark };
|
|
28
|
+
if (React.isValidElement(watermark)) {
|
|
29
|
+
if (watermark.type !== Watermark) return { element: watermark };
|
|
30
|
+
const { children, ...props } = watermark.props;
|
|
31
|
+
return {
|
|
32
|
+
...props,
|
|
33
|
+
element: children ?? props.element
|
|
34
|
+
};
|
|
35
|
+
}
|
|
28
36
|
return watermark;
|
|
29
37
|
}
|
|
38
|
+
function Watermark(_props) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
30
41
|
function positionStyle(position) {
|
|
31
42
|
switch (position) {
|
|
32
43
|
case "top-left":
|
|
@@ -83,6 +94,19 @@ function wrapWithWatermark(element, width, height, theme = "dark", watermark = t
|
|
|
83
94
|
const opacity = options?.opacity ?? (isDark ? 0.55 : 0.4);
|
|
84
95
|
const icon = options ? imageNode(options.image) ?? iconNode(options.icon, color) : void 0;
|
|
85
96
|
const text = options?.text ?? DEFAULT_WATERMARK_TEXT;
|
|
97
|
+
const content = options?.element ?? [
|
|
98
|
+
icon,
|
|
99
|
+
text !== false && text && React.createElement("div", {
|
|
100
|
+
key: "text",
|
|
101
|
+
style: {
|
|
102
|
+
fontSize: 11,
|
|
103
|
+
fontWeight: 600,
|
|
104
|
+
color,
|
|
105
|
+
fontFamily: "Inter",
|
|
106
|
+
letterSpacing: 0.3
|
|
107
|
+
}
|
|
108
|
+
}, text)
|
|
109
|
+
];
|
|
86
110
|
return React.createElement(
|
|
87
111
|
"div",
|
|
88
112
|
{
|
|
@@ -106,16 +130,7 @@ function wrapWithWatermark(element, width, height, theme = "dark", watermark = t
|
|
|
106
130
|
opacity
|
|
107
131
|
}
|
|
108
132
|
},
|
|
109
|
-
|
|
110
|
-
text !== false && text && React.createElement("div", {
|
|
111
|
-
style: {
|
|
112
|
-
fontSize: 11,
|
|
113
|
-
fontWeight: 600,
|
|
114
|
-
color,
|
|
115
|
-
fontFamily: "Inter",
|
|
116
|
-
letterSpacing: 0.3
|
|
117
|
-
}
|
|
118
|
-
}, text)
|
|
133
|
+
content
|
|
119
134
|
)
|
|
120
135
|
);
|
|
121
136
|
}
|
|
@@ -612,6 +627,7 @@ async function renderAnimatedGif(scenes, options) {
|
|
|
612
627
|
|
|
613
628
|
export {
|
|
614
629
|
normalizeWatermark,
|
|
630
|
+
Watermark,
|
|
615
631
|
wrapWithWatermark,
|
|
616
632
|
wrapWithBrand,
|
|
617
633
|
detectBackgroundColor,
|
package/dist/cli.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
renderAnimatedGif,
|
|
4
4
|
renderToPng
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SGIYXUY3.js";
|
|
6
6
|
|
|
7
7
|
// src/cli.ts
|
|
8
8
|
import { mkdir, readFile, readdir, writeFile } from "fs/promises";
|
|
9
9
|
import { basename, extname, join, relative, resolve } from "path";
|
|
10
10
|
import { pathToFileURL } from "url";
|
|
11
|
+
import { isValidElement } from "react";
|
|
11
12
|
var RENDER_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".jsx", ".mjs", ".ts", ".tsx"]);
|
|
12
13
|
function usageText() {
|
|
13
14
|
return `Usage:
|
|
@@ -49,7 +50,7 @@ async function imageSourceToDataUri(source) {
|
|
|
49
50
|
}
|
|
50
51
|
async function resolveWatermarkAssets(watermark) {
|
|
51
52
|
if (watermark == null || typeof watermark !== "object") return watermark;
|
|
52
|
-
if (!watermark.image) return watermark;
|
|
53
|
+
if (isValidElement(watermark) || !("image" in watermark) || !watermark.image) return watermark;
|
|
53
54
|
if (typeof watermark.image === "string") {
|
|
54
55
|
return {
|
|
55
56
|
...watermark,
|
|
@@ -75,7 +76,7 @@ function parseRenderArgs(argv) {
|
|
|
75
76
|
let scale;
|
|
76
77
|
function mutableWatermark() {
|
|
77
78
|
if (!watermarkOptions) {
|
|
78
|
-
watermarkOptions = typeof watermark === "object" && watermark !== null ? { ...watermark } : {};
|
|
79
|
+
watermarkOptions = typeof watermark === "object" && watermark !== null && !isValidElement(watermark) ? { ...watermark } : {};
|
|
79
80
|
if (typeof watermark === "string") watermarkOptions.text = watermark;
|
|
80
81
|
watermark = watermarkOptions;
|
|
81
82
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1253,12 +1253,17 @@ interface WatermarkOptions {
|
|
|
1253
1253
|
text?: string | false;
|
|
1254
1254
|
image?: string | WatermarkImageOptions;
|
|
1255
1255
|
icon?: ReactNode | string | false;
|
|
1256
|
+
element?: ReactNode;
|
|
1256
1257
|
position?: WatermarkPosition;
|
|
1257
1258
|
opacity?: number;
|
|
1258
1259
|
color?: string;
|
|
1259
1260
|
}
|
|
1260
|
-
|
|
1261
|
+
interface WatermarkElementProps extends WatermarkOptions {
|
|
1262
|
+
children?: ReactNode;
|
|
1263
|
+
}
|
|
1264
|
+
type WatermarkInput = boolean | string | WatermarkOptions | React.ReactElement<WatermarkElementProps>;
|
|
1261
1265
|
declare function normalizeWatermark(watermark: WatermarkInput | undefined): WatermarkOptions | undefined;
|
|
1266
|
+
declare function Watermark(_props: WatermarkElementProps): null;
|
|
1262
1267
|
/**
|
|
1263
1268
|
* Wrap an illustration element with a watermark overlay.
|
|
1264
1269
|
*/
|
|
@@ -1430,4 +1435,4 @@ interface OverflowResult {
|
|
|
1430
1435
|
*/
|
|
1431
1436
|
declare function detectOverflow(pixels: Uint8Array, width: number, height: number, bgColor: string, edgeTolerance?: number, minDensity?: number, alphaThreshold?: number): OverflowResult;
|
|
1432
1437
|
|
|
1433
|
-
export { type AnimatedScene, type AnimationOptions, Arrow, ArrowMarkerDef, AxisPlot, type AxisPlotPath, Badge, BadgePill, BarChart, type BarChartDatum, Box, CalloutCard, Canvas, Card, ChartFrame, type ChartLegendItem, type ChartMargins, type ChartValueFormat, CodeBlock, type CodeLineSpec, type ColorName, Column, Comparison, type ComparisonSideSpec, Connector, type CropRegion, DashedLine, DataTable, DetailList, DotPoint, EquationCard, Flow, FlowArrow, type FlowStageSpec, GradientChip, GraphDiagram, type GraphDiagramEdge, type GraphDiagramNode, Grid, Heatmap, type IllustrationBuilder, type IntervalDatum, IntervalPlot, KeyValueList, type KeyValueRow, LayeredNetwork, type LayeredNetworkLayer, Legend, LineChart, type LineChartSeries, MathText, Matrix, MetricCard, MiniBarChart, type MiniBarDatum, type OverflowResult, Panel, Pipeline, type PlotArea, ProgressList, ProgressRow, type ProgressRowSpec, QuadrantChart, type QuadrantRegion, type RenderOptions, Row, ScatterPlot, type ScatterPoint, Scene, Stack, StackedBar, type StackedBarSegment, type StatusKind, StatusList, StatusRow, type StatusRowSpec, StepCard, SvgFrame, SvgMathText, SvgPoint, TextLabel, type ThemeColors, type ThemeMode, Tile, TileGrid, type TileSpec, TiledMatrix, type TiledMatrixRegion, TitleBar, type ToneName, ToneStrip, type TransitionType, ValuePill, VectorArrow, VectorSegment, type WatermarkImageOptions, type WatermarkInput, type WatermarkOptions, type WatermarkPosition, WindowFrame, canvas, colors, createPlotArea, cropPixels, defineIllustration, detectBackgroundColor, detectContentBounds, detectOverflow, formatMathText, getColor, getFonts, getGradient, getStyles, getThemeColors, getToneColor, getToneGradient, gradients, heatColor, loadAdditionalAsset, normalizeWatermark, renderAnimatedGif, renderToBuffer, renderToPng, renderToSvg, styles, toneGradients, typography, wrapWithBrand, wrapWithWatermark };
|
|
1438
|
+
export { type AnimatedScene, type AnimationOptions, Arrow, ArrowMarkerDef, AxisPlot, type AxisPlotPath, Badge, BadgePill, BarChart, type BarChartDatum, Box, CalloutCard, Canvas, Card, ChartFrame, type ChartLegendItem, type ChartMargins, type ChartValueFormat, CodeBlock, type CodeLineSpec, type ColorName, Column, Comparison, type ComparisonSideSpec, Connector, type CropRegion, DashedLine, DataTable, DetailList, DotPoint, EquationCard, Flow, FlowArrow, type FlowStageSpec, GradientChip, GraphDiagram, type GraphDiagramEdge, type GraphDiagramNode, Grid, Heatmap, type IllustrationBuilder, type IntervalDatum, IntervalPlot, KeyValueList, type KeyValueRow, LayeredNetwork, type LayeredNetworkLayer, Legend, LineChart, type LineChartSeries, MathText, Matrix, MetricCard, MiniBarChart, type MiniBarDatum, type OverflowResult, Panel, Pipeline, type PlotArea, ProgressList, ProgressRow, type ProgressRowSpec, QuadrantChart, type QuadrantRegion, type RenderOptions, Row, ScatterPlot, type ScatterPoint, Scene, Stack, StackedBar, type StackedBarSegment, type StatusKind, StatusList, StatusRow, type StatusRowSpec, StepCard, SvgFrame, SvgMathText, SvgPoint, TextLabel, type ThemeColors, type ThemeMode, Tile, TileGrid, type TileSpec, TiledMatrix, type TiledMatrixRegion, TitleBar, type ToneName, ToneStrip, type TransitionType, ValuePill, VectorArrow, VectorSegment, Watermark, type WatermarkElementProps, type WatermarkImageOptions, type WatermarkInput, type WatermarkOptions, type WatermarkPosition, WindowFrame, canvas, colors, createPlotArea, cropPixels, defineIllustration, detectBackgroundColor, detectContentBounds, detectOverflow, formatMathText, getColor, getFonts, getGradient, getStyles, getThemeColors, getToneColor, getToneGradient, gradients, heatColor, loadAdditionalAsset, normalizeWatermark, renderAnimatedGif, renderToBuffer, renderToPng, renderToSvg, styles, toneGradients, typography, wrapWithBrand, wrapWithWatermark };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Watermark,
|
|
2
3
|
cropPixels,
|
|
3
4
|
detectBackgroundColor,
|
|
4
5
|
detectContentBounds,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
renderToSvg,
|
|
13
14
|
wrapWithBrand,
|
|
14
15
|
wrapWithWatermark
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SGIYXUY3.js";
|
|
16
17
|
|
|
17
18
|
// src/theme.ts
|
|
18
19
|
var darkColors = {
|
|
@@ -4669,6 +4670,7 @@ export {
|
|
|
4669
4670
|
ValuePill,
|
|
4670
4671
|
VectorArrow,
|
|
4671
4672
|
VectorSegment,
|
|
4673
|
+
Watermark,
|
|
4672
4674
|
WindowFrame,
|
|
4673
4675
|
canvas,
|
|
4674
4676
|
colors,
|
package/docs/PROMPT.md
CHANGED
|
@@ -10,7 +10,7 @@ Use the package manager already present in the project.
|
|
|
10
10
|
pnpm add vizmatic react
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Optional edge build from GitHub:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
pnpm add github:bvolpato/vizmatic react
|
|
@@ -109,6 +109,29 @@ Render it:
|
|
|
109
109
|
pnpm exec vizmatic render frames --out public/vizmatic --theme dark,light --watermark "Your Product" --watermark-image ./logo.svg --watermark-position top-right
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
Frame modules can also export a watermark element when code-owned branding is clearer than CLI flags:
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { Watermark } from "vizmatic"
|
|
116
|
+
|
|
117
|
+
export const watermark = (
|
|
118
|
+
<Watermark position="bottom-right" opacity={0.82}>
|
|
119
|
+
<div style={{
|
|
120
|
+
display: "flex",
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
gap: 6,
|
|
123
|
+
color: "#7c3aed",
|
|
124
|
+
fontFamily: "Inter",
|
|
125
|
+
fontWeight: 800,
|
|
126
|
+
fontSize: 12,
|
|
127
|
+
}}>
|
|
128
|
+
<img src="data:image/svg+xml;base64,..." width={14} height={14} />
|
|
129
|
+
LeetLLM
|
|
130
|
+
</div>
|
|
131
|
+
</Watermark>
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
112
135
|
Render animated frames with `createScenes(theme)`:
|
|
113
136
|
|
|
114
137
|
```bash
|
|
@@ -289,9 +312,10 @@ Theme and render APIs:
|
|
|
289
312
|
- `getThemeColors(mode)`: `mode: ThemeMode`.
|
|
290
313
|
- `getToneColor(tone, c)`, `getToneGradient(tone)`, `getColor(name, c?)`, `getGradient(name)`, `heatColor(value)`.
|
|
291
314
|
- `renderToPng(element, options, createFn?, theme?)`: `element`, `options: RenderOptions`, `createFn?: (theme: "dark" | "light") => ReactNode`, `theme?: "dark" | "light"`.
|
|
292
|
-
- `
|
|
315
|
+
- `Watermark`: JSX marker component for frame-module exports. Props are `WatermarkOptions` plus `children?: ReactNode`; children become the complete watermark body.
|
|
316
|
+
- `WatermarkInput`: `boolean | string | WatermarkOptions | ReactElement<WatermarkElementProps>`. `true` uses Vizmatic defaults. A string sets the watermark text. A React element can be `<Watermark>...</Watermark>` or any custom element.
|
|
293
317
|
- `WatermarkImageOptions`: `src`, `width?: number`, `height?: number`, `alt?: string`. Programmatic `src` should be a URL or data URI. CLI `--watermark-image` accepts URL, data URI, or local path.
|
|
294
|
-
- `WatermarkOptions`: `text?: string | false`, `image?: string | WatermarkImageOptions`, `icon?: ReactNode | string | false`, `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" = "top-right"`, `opacity?: number`, `color?: string`.
|
|
318
|
+
- `WatermarkOptions`: `text?: string | false`, `image?: string | WatermarkImageOptions`, `icon?: ReactNode | string | false`, `element?: ReactNode`, `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" = "top-right"`, `opacity?: number`, `color?: string`.
|
|
295
319
|
- `RenderOptions`: `width`, `height`, `outputPath`, `watermark?: WatermarkInput`, `brand?: boolean | string` as a compatibility alias, `crop?: boolean = true`, `scale?: number = 2`.
|
|
296
320
|
- `renderToBuffer(element, width, height, options?)`: `options` supports `watermark?`, `brand?`, `scale?`.
|
|
297
321
|
- `renderToSvg(element, width, height, options?)`: `options` supports `watermark?`, `brand?`.
|