hyper_render_core library

HyperRender Core - Zero External Dependencies

This is the core rendering engine for HyperRender. It provides the Unified Document Tree (UDT) model, rendering primitives, and interfaces for plugins.

Features

  • Universal Document Tree (UDT) model
  • Custom RenderObject-based layout engine
  • Fragment-based inline layout with float support
  • CJK line-breaking (Kinsoku)
  • Ruby/Furigana support for Japanese
  • Text selection with handles
  • CSS cascade style resolution

Zero External Dependencies

This package only depends on Flutter SDK. Parsing (HTML, Markdown, CSS) and syntax highlighting are provided by separate plugin packages.

Plugin Interfaces

Example

import 'package:hyper_render_core/hyper_render_core.dart';

// Create document manually
final document = DocumentNode(children: [
  BlockNode.h1(children: [TextNode('Hello World')]),
  BlockNode.p(children: [TextNode('Welcome to HyperRender!')]),
]);

// Render with HyperRenderWidget
HyperRenderWidget(document: document)

Classes

AtomicNode
Atomic/replaced element node (img, video, audio, iframe)
BlockNode
Block-level element node (div, p, h1-h6, blockquote, etc.)
CachedImage
Cached image data
CodeBlockWidget
A widget that displays code with optional syntax highlighting.
CodeHighlighter
Interface for code syntax highlighting plugins
ComputedStyle
Computed style for a UDT node All CSS properties are resolved to final values here
ContentParser
Interface for content parsing plugins
CssIndexStats
Statistics about CSS rule indexing
CssParserInterface
Interface for CSS parsing plugins
CssRule
A CSS rule with selector and declarations
CssRuleIndex
CSS Rule Index for O(1) rule lookup by selector type
DefaultImageClipboardHandler
Default implementation that only supports URL copying
DefaultMediaWidget
Default placeholder for media elements.
DesignTokens
Design tokens for HyperRender
DocumentNode
Document root node
ErrorBoundaryNode
Represents a parse or render error wrapped in the UDT for graceful display.
ErrorBoundaryWidget
Widget that displays error boundaries in a user-friendly way
ExtendedContentParser
Extended parser interface with metadata support
FlexContainerWidget
Widget that renders a flex container (display: flex)
FlexItemWidget
Wrapper for flex items with flex properties (flex-grow, flex-shrink)
FloatCarryover
Describes a float element whose visual area extends beyond the bottom of a virtualized section boundary.
FormulaInfo
FormulaInfo for media-style handling
FormulaWidget
Default formula widget using basic text rendering
Fragment
A Fragment represents a unit of content for inline layout
GridContainerWidget
GridContainerWidget — renders a CSS Grid container (display: grid).
GridItem
A grid item with its column span for GridContainerWidget.
HtmlToSpanConverter
HtmlToSpanConverter - Core Engine
HyperAnimatedWidget
Widget that applies CSS-like animations to its child
HyperAnimations
Predefined CSS keyframe animations
HyperBoxParentData
Parent data for children of RenderHyperBox
HyperDetailsWidget
Renders an HTML <details>/<summary> element as an interactive expand/collapse panel.
HyperErrorIndicator
Compact inline error indicator
HyperErrorWidget
Beautiful error widget following Material Design 3
HyperImage
HyperImage - Image widget with context menu for copy/save/share
HyperKeyframe
A single keyframe in an animation
HyperKeyframes
A collection of keyframes that define an animation
HyperNodePlugin
Abstract base for a HyperRender node plugin.
HyperPluginBuildContext
Context provided to HyperNodePlugin.buildWidget.
HyperPluginRegistry
Registry for HyperNodePlugin instances.
HyperRenderConfig
Configuration for the HyperRender engine.
HyperRenderDebugHooks
Zero-overhead hook points for DevTools integration.
HyperRenderTheme
An InheritedWidget that provides HyperRenderThemeData to descendants.
HyperRenderThemeData
Theme data for HyperRender styling and interactive elements.
HyperRenderWidget
HyperRenderWidget - MultiChildRenderObjectWidget for custom HTML rendering
HyperSelectionController
Coordinates text-selection state across multiple RenderHyperBox instances.
HyperSelectionOverlay
HyperSelectionOverlay - Provides selection UI features like SelectionArea
HyperSelectionOverlayState
HyperTable
Custom HTML table widget.
HyperTextSelection
Selection range for text
HyperTransition
CSS transition definition
ImageClipboardHandler
Interface for image clipboard and sharing operations.
ImageOperationResult
Result of an image operation
InlineNode
Inline element node (span, a, strong, em, etc.)
KinsokuProcessor
Kinsoku processor for CJK line-breaking rules
LayoutCache
Layout cache for storing computed layout information separately from the tree
LayoutCacheDiff
Difference between two layout cache snapshots
LayoutCacheSnapshot
Immutable snapshot of layout cache state
LayoutCacheStats
Statistics about layout cache usage
LayoutChange<T>
LazyImageQueue
A singleton priority queue for image loading.
LineBreakNode
Line break node (br)
LineInfo
A line of fragments after layout
LoadingSkeleton
Beautiful loading skeleton with shimmer animation
Helper widget that wraps media with a link to open externally
MediaInfo
Information about a media element
ParsedCssRule
Represents a parsed CSS rule
ParseResult
Parse result with metadata
PerformanceMonitor
Performance monitor for tracking render pipeline timing
PerformanceReport
Performance metrics for HyperRender operations
PerformanceStats
Performance statistics aggregator
PlainTextHighlighter
A no-op highlighter that returns plain text
PlainTextParser
A simple plain text parser (no external dependencies)
RenderHyperBox
RenderHyperBox - The core custom rendering engine
RenderRubyText
Custom RenderObject for Ruby/Furigana text
RubyNode
Ruby annotation node (for Japanese Furigana)
RubySpan
RubySpan - A WidgetSpan that renders Ruby/Furigana text
RubyTextWidget
Widget wrapper for RenderRubyText
SelectionMenuAction
Selection menu action
SimpleInlineStyleParser
Simple inline style parser (no external dependencies)
SkeletonCard
Card skeleton with image and text
SkeletonGrid
Grid of skeleton items
SkeletonListItem
List item skeleton with avatar and text
SkeletonParagraph
Container with multiple skeleton lines
SmartTableWrapper
Wraps HyperTable with a strategy for handling wide tables.
StyleResolver
TableCellNode
Table cell node (td or th)
TableNode
Table node
TableParentData
@deprecated Use the internal _TableCellParentData instead. Kept only for backwards API compatibility.
TableRowNode
Table row node
TextNode
Text content node
UDTNode
Base class for all nodes in the Unified Document Tree (UDT)

Enums

AlignItems
Align items for CSS align-items property (cross axis alignment)
CodeTheme
Available syntax highlighting themes.
ContentType
Input type for content parsers
DisplayType
Display type for CSS display property
FlexDirection
Flex direction for CSS flex-direction property
FlexWrap
Flex wrap for CSS flex-wrap property
FragmentType
Fragment type for inline layout
HyperAnimationDirection
CSS animation direction
HyperAnimationFillMode
CSS animation fill mode
HyperBorderStyle
Border style for CSS border-style property
HyperClear
Clear behavior for CSS clear property
HyperErrorType
Type of error for styling purposes
HyperFloat
Float behavior for CSS float property
HyperOverflow
Overflow behavior for CSS overflow property
HyperTextAlign
Text alignment for CSS text-align property
HyperTextDirection
Text direction for CSS direction property
HyperTimingFunction
CSS timing function for animations and transitions
HyperVerticalAlign
Vertical alignment for CSS vertical-align property
ImageAction
Image action types for context menu
ImageLoadState
Image load state
JustifyContent
Justify content for CSS justify-content property (main axis alignment)
MediaType
Type of media element
NodeType
Node type in the Unified Document Tree (UDT)
SkeletonShape
Shape of the skeleton loader
TableStrategy
Strategy for tables wider than the available viewport.

Extensions

AtomicNodeAudioFactory on AtomicNode
Factory for creating AtomicNode for audio elements
AtomicNodeMediaExtension on AtomicNode
Convenience extension on AtomicNode for media-related helpers.
FormulaParser on Map<String, dynamic>
Extension to parse formula from Quill Delta
HtmlToSpanConverterWidgets on HtmlToSpanConverter
Extension to build widgets from converter
HyperAnimationExtension on Widget
Extension to easily animate widgets
HyperRenderWidgetSelectionExtension on HyperRenderWidget
Extension to easily use HyperSelectionOverlay
KinsokuStringExtension on String
Extension for String to apply kinsoku processing
MediaNodeExtension on AtomicNode
Extension to add media factory to AtomicNode
RenderHyperBoxSelection on RenderHyperBox
RubySpanBuilder on RubySpan
Extension to easily create RubySpan from a node

Functions

defaultImageLoader(String src, void onLoad(Image image), void onError(Object error)) → void
Default image loader using Flutter's NetworkImage
detectLanguageFromClass(String? classAttr) String?
Detect programming language from a CSS class attribute value.
gridItemSpan(UDTNode node) int
Detect column span from a UDT node's grid-column style.

Typedefs

FormulaBuilder = Widget Function(BuildContext context, String formula)
LaTeX formula rendering support
HyperImageLoader = void Function(String src, void onLoad(Image image), void onError(Object error))
Callback for loading images.
HyperLinkTapCallback = void Function(String url)
Callback for handling link taps
HyperWidgetBuilder = Widget? Function(UDTNode node)
Callback for building custom widgets for embedded content
ImageActionCallback = Future<bool> Function(ImageAction action, String imageUrl, BuildContext context)
Callback for custom image action handling Return true if the action was handled, false to use default behavior
ImageBuilder = Widget Function(String src, String? alt, double? width, double? height)
Callback for handling image loading
ImageLoadCallback = void Function(String src, ImageLoadState state)
Callback when image loading state changes
LinkTapCallback = void Function(String url)
Callback for handling link taps
MediaWidgetBuilder = Widget Function(BuildContext context, MediaInfo mediaInfo)
Callback for building custom media widgets.
PerformanceReportCallback = void Function(PerformanceReport report)
Callback for performance reports

Exceptions / Errors

ImageLoadCancelledException
Thrown by LazyImageQueue.clearPending when a queued load is dropped before it starts, so widgets waiting on the result can show a placeholder.