sealed_surface/lib.rs
1//! Non-extractable data surface.
2//!
3//! Paint tables, timeseries, scatter, and treemaps as glyphs on a bitmap so cell values never
4//! appear as Unicode in a host DOM. Framework-agnostic. Zero required
5//! dependencies.
6//!
7//! **Not DRM. Not OCR-proof.** A human with a camera still wins. The crate
8//! signs DOM scrape, copy/paste, and tooltip-JSON layers when the host obeys
9//! the contract (see `examples/host_contract.rs`). Screen readers do not get
10//! cell values in sealed mode; the accessible egress is a licensed API the
11//! host already meters.
12//!
13//! ```
14//! use sealed_surface::{
15//! AccessTier, CellValue, Column, FrameRequest, Grid, LicenseLens, Row, Surface,
16//! SurfaceMode, Viewport,
17//! };
18//!
19//! let grid = Grid::try_new(
20//! vec![Column::new(0, "sku"), Column::new(1, "price")],
21//! vec![Row::new(
22//! 0,
23//! vec![CellValue::text("ACME-SKU-1"), CellValue::float(49.0, 2)],
24//! )],
25//! )?;
26//!
27//! let mut surface = Surface::new(
28//! SurfaceMode::Sealed,
29//! LicenseLens::from_tier(AccessTier::Trial),
30//! );
31//! let frame = surface.render(&grid, &FrameRequest::full(Viewport::window(640, 240)))?;
32//! assert!(frame.host.clipboard.is_none());
33//! assert!(!frame.host.audit_text().contains("49.00"));
34//! assert!(frame.png.starts_with(b"\x89PNG"));
35//! # Ok::<(), sealed_surface::Error>(())
36//! ```
37
38#![warn(missing_docs)]
39#![cfg_attr(docsrs, feature(doc_cfg))]
40
41mod appearance;
42mod chart;
43mod deflate;
44mod error;
45mod font;
46mod host;
47mod layout;
48mod lens;
49mod mode;
50mod model;
51mod raster;
52mod surface;
53mod theme;
54mod tree;
55
56pub use appearance::{Appearance, ChartStyle, MarkerStyle, TypeScale};
57pub use chart::{Series, SeriesId, SeriesLayout, SeriesPoint};
58pub use error::Error;
59pub use host::{ClipboardPayload, HostProjection, HostText};
60pub use layout::{Hit, HitKind, HitMap, Pointer, TableMetrics, Viewport, MAX_PIXMAP_AXIS};
61pub use lens::{AccessTier, LicenseLens, RedactionStyle};
62pub use mode::SurfaceMode;
63pub use model::{CellValue, Column, ColumnId, Grid, Row, RowId};
64pub use raster::Pixmap;
65pub use surface::{Frame, FrameRequest, Surface};
66pub use theme::{Rgb, Theme};
67pub use tree::{TreeId, TreeLayout, TreeNode};