Skip to main content

Crate k2f_core

Crate k2f_core 

Source

Re-exports§

pub use visual_primitives::*;

Modules§

effects
Deterministic pixel-domain effects used by renderers.
visual_primitives

Structs§

AppearanceHashInput
CellAlign
Default per-cell alignment for grid children.
Clipboard
Official clipboard: node id + semantic JSON. Plain text is derived, never a source.
CompositingSpec
Canonical compositing policy for executing a render plan.
FillRect
Solid fill rectangle in page coordinates (millipt). Used for math fraction/radical rules.
FixedSizeHint
Optional deterministic fixed outer size for container layout hints.
FormFieldSpec
Fillable field payload. Outer box size is declared (width/height/lines); value is authority for what is written in the box and must not drive measure.
GeometryNode
Represents a geometry node in the K2F layout tree (State C).
GlyphPosition
Hit
Leaf-first hit: innermost geometry box, then ancestors. Children are tested back-to-front (last child wins when boxes overlap). A box is hittable over its full rectangle, including padding.
LayoutResult
LockFile
A “Geometry Lock” file representing the final compiled state of a document. It cryptographically binds the semantic input (Content Hash) to the geometric output.
Manifest
Modifier
Page
PageConfig
PageRenderPlan
Pt
Fixed-point coordinate type (1/1000th of a point). Wraps an i128 to prevent overflow and ensure determinism.
Rect
RenderPlan
A deterministic sequence of paint operations per page.
RunningBlockNode
Selection
SemanticNode
Represents a semantic node in the K2F document tree (State A).
TableCellSlot
Visual start column and occupancy of one authored cell.
TableSpec
Strict table payload for content.type = "table" (State A).
TextGlyphRun
A contiguous glyph slice (within GeometryNode.glyphs) that shares one paint style.
TextPaintStyle
A concrete, resolved text style for paint.
ThemeVocab
Minimal theme vocabulary used for validating role/variant usage in semantic content.

Enums§

Align
AlphaMode
Defines the alpha representation policy expected by the render executor.
BlendMode
Blend mode for an operation group.
BreakBefore
Whether a node must start on a new page.
BreakInside
Whether a node may split across pages. Agents pick an enum; they do not invent an algorithm.
CanvasMode
CodeBlockValue
Code block payload value. Supports either a single string (may include ‘\n’) or a flat array of lines.
ColumnSpan
Whether a node spans all columns of an enclosing columns container.
CompositingColorSpace
Defines how colors must be blended when executing a render plan.
FormFieldKind
GridTrack
Explicit deterministic track sizes (pt, fr, or content-sized auto).
ImageFit
How a bitmap maps into its already-declared DrawImage box.
JustifyContent
K2FError
LayoutHint
Deterministic layout hint for container nodes.
ListMarkerType
Marker style for list items.
NodeContent
NodeEditError
PaintOp
RunningBlockPosition
StackDirection
TableDataSource

Constants§

CHECKBOX_CHECKED
CHECKBOX_UNCHECKED
NODE_ID_PATTERN
Allowed node IDs: dotted segments of ASCII letters, digits, and underscore. Examples: root, contract.clause_4.amount.
ROLE_FORM_FIELD
Semantic role for fillable form fields (lock-size boxes; value does not reflow).
ROLE_MATH
Semantic role for display math formulas.
SVG_TEXT_FORBIDDEN_MSG
Detect SVG bytes that contain a real text-bearing element.

Functions§

apply_role
Surgical role change. Theme vocab is checked by the SDK; this only mutates the node.
box_contains
canonical_json_string
Canonical JSON (sorted object keys) used for hashing and lock serialization.
canonicalize_json_value
clipboard_of
clusters_usable
collapse_tables_to_assets
Write expanded inline rows back to their asset files and restore content.data.type = asset.
collect_boxes
collect_ids_under
Collect every node id under node (including node itself).
collect_sorted_node_ids
engine_commit_sha
engine_version
expand_manifest_tables_with_assets
find_in_trees
find_in_trees_mut
find_node
find_node_mut
for_each_form_field
Visit every FormField node in document order (containers, then table cells).
for_each_form_field_in_trees
Root plus running blocks. Running blocks must not contain fields (validated elsewhere).
for_each_node
for_each_node_mut
grid_rows_for_children
When rows is omitted (empty), synthesize {auto:true} tracks so every child has a cell: max(1, ceil(n_children / n_columns)). Declared rows are used as-is (not CSS implicit growth).
hash_appearance_binding
Appearance binding: semantic hash + canonical theme + embedded font digests
hash_content
Hash a single semantic node (tests and callers that do not have a Manifest).
hash_manifest_semantic
Hashes semantic inputs bound to the lock: the main tree, running blocks, and the sorted stable node-ID set.
hit_char_range
Character range for the glyph whose advance box contains (x, y).
hit_geometry
hit_layout
hit_page
hyperlink_href
link modifier intent is a URL (spec). Theme variant keys such as default are style lookups, not hrefs, and must not become Office targets.
insert_child
Insert child into parent_id at index (index == len appends).
is_font_face_path
True when path is a TrueType/OpenType face (filename .ttf / .otf), case-insensitive. Sidecar files such as licenses/Roboto-Apache.txt are not faces. The in-memory key "default" used by compile/paint helpers counts as a face.
is_valid_node_id
looks_like_svg
nfc
node_text
normalize_manifest_nfc
remove_node
Remove node id. Cannot delete root.
render_plan_has_unknown_ops
replace_node_text
Replace a text node’s string. NFC first. Drop modifiers that no longer fit.
search_tree
Tree search. Hits are stable node IDs, not a flat string index. Empty query matches nothing.
search_trees
selection_of
selection_with_ids
semantic_ids
Semantic IDs only: drop synthetic page roots such as root_page_0.
semantic_tree_needs_assets
sha256_hex
svg_bytes_contain_text_element
svg_image_path
table_asset_sources
Table node id → asset path, before expand turns those tables inline.
table_cell_colspan
Occupancy of an authored table cell (colspan, default 1).
table_row_cover
Sum of cell occupancy on a row (default 1 per cell).
table_row_slots
Row-major slots: each cell starts where the previous occupancy ended.
table_rows_on_page
Semantic rows whose every authored cell id is present on this page fragment.
tree_contains_id
True if id exists anywhere in the semantic trees.
validate_manifest_node_ids
validate_manifest_running_blocks
validate_semantic_tree
Structural validation that is required by the spec:
validate_semantic_tree_with_theme_vocab
Validate that every node’s role exists in the theme and that variant (if present) is allowed for that role.
validate_svg_assets
Reject package images that still contain SVG text-bearing elements (compile/pack).
with_text_range

Type Aliases§

AssetsMap