Skip to content

Editor

Widget Kit

The widget kit is the library every editor surface and every module panel draws with: the tokens a theme resolves to, the ten type roles and their code ligatures, the vector icons, the painter, widget_scope, the pure layout core, the frame record, the stock style that keeps ImGui's own look out, and the controls, fields, containers, popups, data views and colour editors built on them. Its headers live in engine/include/conjure/editor/kit/, its sources in engine/src/editor/kit/, and modules include the umbrella header conjure/editor/kit/kit.h.

The kit wraps Dear ImGui for the rest of the editor. ImGui keeps input, ids, keyboard focus, text editing, docking and the popup stack; the kit alone draws, from tokens, so every surface looks the same in every theme. The public API is described in The widget kit, themes in Themes and the bundled fonts in Fonts and code ligatures. The panels and the shell drawn with the kit are on User Interface.

Headers

File Description Provides
catalogue.h The widget catalogue: one description per kit widget, as data. A description names the widget (its C++ function or class), its version, the kind the frame record holds for it and the kinds of the parts it records, its props with their kind, default, enumeration values and the bindable and two-way flags, the events it reports, the children it holds, a summary and an example. The UI authoring concepts (a palette, property editors, a document validator, a generated schema) and the Widget gallery are drawn from it. kit::event_desc
kit::item_desc
kit::prop_desc
kit::widget_desc
colour_picker.h The kit's colour editors: the colour picker a colour swatch opens (fields.h), and the gradient stop editor of the Theme editor's chrome fills. kit::colour_picker_parts
kit::colour_picker_props
kit::gradient_stops_parts
kit::gradient_stops_props
kit::hsv_colour
containers.h The kit's containers: the viewport bars and the screen, the toolbar strip with its groups, the status strip, the panel shell with the dock chrome, the property containers (grid, section, row, group), the overlay cards and banners, and the picture. Containers are scopes that cannot be copied or moved. kit::banner
kit::banner_props
kit::dock_chrome
kit::dock_chrome::pending_undock
kit::dockspace_scope
kit::header_action_state
kit::overlay_anchor
kit::overlay_arrangement
kit::overlay_card
kit::overlay_card_props
kit::overlay_span
kit::panel_chrome
kit::panel_shell
kit::picture_props
kit::picture_reply
kit::property_grid
kit::property_grid_props
kit::property_group
kit::property_group_props
kit::property_reveal
kit::property_row
kit::property_row_props
kit::property_row_slots
kit::property_section
kit::property_section_props
kit::row_marks
kit::screen
kit::screen_props
kit::status_arrangement
kit::status_segment
kit::status_strip
kit::tab_decoration
kit::toolbar_group
kit::toolbar_strip
kit::viewport_bar
controls.h The kit's controls: buttons, icon buttons, toggles, the segmented control, the checkbox, the pin toggle, badges, dots, labels, separators and the dropdown, at the mockup's sizes and in its tokens. kit::badge_props
kit::button_props
kit::checkbox_props
kit::dot_props
kit::dropdown_props
kit::icon_button_props
kit::label_props
kit::pin_toggle_props
kit::progress_parts
kit::progress_props
kit::segment_item
kit::segmented_props
kit::separator_props
kit::sparkline_props
kit::toggle_props
fields.h The kit's fields: text, search, number, vector and angle fields, the enum and reference fields, the colour swatch and the asset slot, with the field marks (widget.h). kit::angle_field_props
kit::asset_slot_props
kit::colour_swatch_props
kit::enum_field_props
kit::number_field_props
kit::reference_field_props
kit::search_field_props
kit::text_field_props
kit::vector_field_props
icons.h The kit's icons: vector icons in a strict SVG subset, parsed once, flattened once per pixel size into a mesh and copied into a draw list with an offset and a colour. kit::icon_command
kit::icon_definition
kit::icon_element
kit::icon_paint
kit::icon_parse_result
kit::icon_problem
kit::icon_registry
kit::icon_registry::entry
input.h The pointer and the keyboard as the current ImGui frame sees them, for the surfaces that read more than a widget_scope reports: a picture that orbits, pans and zooms a camera under a drag or the wheel, picks with a modifier held, and takes single-key tools while the pointer is over it (the Scene view). A widget_scope still decides who has the pointer (hovered, held, pressed); these say what the pointer and the keys did. Read-only but for leave_input_to_engine(), which gives the next frame's events to the engine: nothing here claims a key, an item or a route (kit::shortcut does that).
kit.h The editor widget kit: the one header modules include to draw editor UI with the kit. Widgets and panels are drawn through the kit's tokens, painter and widget_scope, never with ImGui's stock widgets, so every panel looks like the approved mockup in every theme.
kit_context.h The kit context: what every kit widget draws with. It owns the tokens of the shown theme, the typography of the ten type roles, the icon registry with its mesh cache, the one edit session text fields share and the frame record. editor_layer owns one and makes it current while it draws (set_current, current_kit_scope); modules reach the same one through the shared library. kit::canary_report
kit::current_kit_scope
kit::kit_context
kit::stock_canary_scope
kit::stock_colour
layout.h The kit's pure layout core: the rectangle every kit signature uses, and a row of slots arranged along one axis with no ImGui, so rows, strips and table columns are measured and placed the same way in tests and in the editor. A slot is FIXED (its size), FILL (a share of what the fixed slots and gaps leave, by weight) or FIT (its measured content, which a FILL never takes from). Gaps go between slots, padding before the first and after the last. kit::rect
kit::row_arrangement
kit::row_layout
kit::slot
kit::slot_box
paint.h Painting with tokens: the painter every kit widget and every module widget draws through, and the text metrics their measure() functions take. kit::clip_scope
kit::fixed_text_metrics
kit::painter
kit::text_metrics
popups.h The kit's popups: the main menu bar, menus with hover-open submenus, menu items, separators, context menus, a widget's popup menu, the popup list of rows, modal dialogs and the tooltip. They live on ImGui's popup stack and keep ImGui's behaviour: keyboard navigation, moving between the menu bar's menus with the pointer, hover-open submenus with ImGui's aim triangle, a click outside closing them, Escape closing the top one and giving the focus back to the window that had it. The kit alone draws them, from tokens: ImGui draws no fill, edge, text, check mark, arrow or close button of its own. kit::context_menu
kit::context_menu_props
kit::dialog_buttons
kit::dialog_props
kit::list_row
kit::list_row_parts
kit::menu
kit::menu_bar
kit::menu_columns
kit::menu_item_props
kit::menu_props
kit::menu_row_parts
kit::modal_dialog
kit::popup_list_props
kit::popup_menu
kit::popup_menu_props
record.h The frame record: every kit widget submitted in a frame, in submission order, with its kind, ImGui id, key, rectangle, state, the tokens it was drawn with and the text it drew (the source text, never the private glyphs of a ligature). Tests compare it against the mockup's geometry; later the AI protocol's inspection and an accessibility bridge read it. kit_context keeps one and clears it at every begin_frame; clearing keeps the capacity, so steady frames record without allocating. kit::frame_record
kit::record_item
tokens.h The widget kit's tokens: the names widgets draw with instead of values. A colour token is a colour role of the theme, one of the derived states (never authored: a hovered fill moves towards the side its content lies on and a held fill away from it, each as far as everything drawn on it stays readable and visibly apart from the others, the disabled content and edge are dimmed towards the panel, and the accent fill is accent darkened or lightened until accentText reads on it, hovered included) or a fixed constant (the axis colours, which no theme changes). A metric is one of the mockup's sizes in pixels at 100 % (bar heights, control sizes, paddings, gaps and the radii, which scale with the theme's metrics.rounding), a type role one of the ten text styles and a fill token one of the chrome fills. make_token_set() resolves all of them for one theme at one scale; nothing here includes ImGui. kit::accent_fill_colours
kit::content_contrast
kit::state_steps
kit::token_set
kit::tone_colours
kit::type_spec
views.h The kit's data views: the tree view (the hierarchy), the grid view (thumbnails), the list view (the console's log lines and the history's entries), the table view (the Persist table) and the empty state. kit::empty_state_parts
kit::empty_state_props
kit::grid_tile
kit::grid_tile_parts
kit::grid_view
kit::grid_view_events
kit::grid_view_props
kit::history_entry
kit::list_view
kit::list_view_props
kit::log_level_colours
kit::log_line
kit::log_line_columns
kit::table_column
kit::table_row
kit::table_row_props
kit::table_sort
kit::table_view
kit::table_view_props
kit::text_run
kit::tree_drop
kit::tree_row
kit::tree_row_parts
kit::tree_select
kit::tree_toggle
kit::tree_view
kit::tree_view_events
kit::tree_view_props
widget.h The widget authoring API, used by the kit's own widgets and by modules alike. Every widget has four parts: a props struct, a pure measure, a draw through a widget_scope, and a free function that ties them together. kit::disabled_scope
kit::edit_result
kit::id_scope
kit::layout_guard
kit::layout_host
kit::layout_state
kit::state_preview_scope
kit::widget_options
kit::widget_scope

Breakdown

Library shape

engine/src/editor/CMakeLists.txt declares two targets for the kit, both guarded by CONJURE_BUILD_EDITOR:

Target Declared as Depends on
conjure_editor_kit (alias conjure::editor_kit) conjure_add_module(editor_kit ...) public conjure::editor_core (for theme.h); private conjure::thirdparty::imgui and conjure::editor_kit_hooks
conjure_editor_kit_hooks (alias conjure::editor_kit_hooks) a plain static archive, declared before the editor libraries whenever the ImGui target exists ImGui's include directories and compile definitions only, so it never links ImGui back

The kit never sees editor_context: it takes a theme, a scale, and data. Like every engine library it is whole-archived into conjure_shared, so the editor and every loaded module share one kit and one current kit context. conjure_editor_ui depends on it publicly. Its sources are organised as follows:

Part Files under engine/src/editor/kit/ Notes
Core tokens.cpp, layout.cpp, record.cpp, paint.cpp, widget.cpp, input.cpp, kit_context.cpp, stock_style.cpp, edit_session.{h,cpp}, widget_look.{h,cpp}, shaded_line.{h,cpp} widget_look.h holds the state rules the widgets share; shaded_line.h draws a line in two literal colours mixed along it (the Scene view's fading grid)
Widgets controls.cpp, fields.cpp, containers.cpp, popups.cpp, views.cpp, tree_view.cpp, list_view.cpp, table_view.cpp, grid_view.cpp, view_frame.{h,cpp}, colour_picker.cpp, gradient_stops.cpp view_frame.h is what the data views share: the scrolling child window, the list clipper, and the row look
Catalogue catalogue.cpp one description per widget, as constant data
Icons icon_svg.cpp, icons.cpp, icons/<name>.svg, icons/embed_builtin_icons.cmake, builtin_icon_data.h the 32 built-in icons are embedded at build time into generated/builtin_icon_data.cpp in the build tree
Typography typography.{h,cpp} and text/ private; typography.h is the contract between the kit core and the font code
Test-engine hooks imgui_test_hooks.cpp, item_probe.h the archive conjure_editor_kit_hooks

No public kit header includes ImGui. containers.h, icons.h, kit_context.h, and paint.h forward-declare the ImGui types they hold or take, which is why they are listed under kit_only_exceptions in tools/style_exceptions.json.

editor_layer owns the editor's kit_context, declared before its theme_applier, which keeps pointers into it. It attaches the context to the applier (attach_kit, and set_typography with the context's typography), makes it current while the workspace draws (kit::current_kit_scope) and brackets that draw with begin_frame and end_frame. The applier keeps the preview, the library revisions, and the font scheduling and hands the styling to kit_context::apply_theme; Themes in the UI describes that side.

Tokens and the optional theme roles

make_token_set(theme, uiScale) in tokens.cpp resolves every token of one theme at one scale, and nothing in tokens.h includes ImGui. The scale is kit_scale(fonts.size, uiScale): kit_font_size(fonts.size) over KIT_BASE_FONT_SIZE (13) times the UI scale, clamped to MIN_KIT_SCALE (0.25) to MAX_KIT_SCALE (6). The tokens and the typography share that clamp, so the kit's text never parts from the sizes measured around it, and a theme whose fonts.size is not a positive finite number draws at the mockup's sizes.

Kind Enumeration Resolved as
Colour token colour_token the theme's 30 colour roles, the status text (chrome.status.text), the derived states, and the fixed constants (AXIS_X_COLOUR #ef5b4f, AXIS_Y_COLOUR #4fcf6a, AXIS_Z_COLOUR #4c8dff, the two axis text colours, and the online dot)
Metric metric the mockup's sizes at 100 %, times the scale and rounded to whole pixels (LINE_WIDTH and OVERLINE at least one pixel); radii times metrics.rounding / MOCKUP_ROUNDING times the scale, unrounded
Type role type_role one of the ten text styles, described in Typography
Fill token fill_token the chrome fills: title, toolbar, status, and the Scene view's backdrop

Token names are the theme file's spellings, which the icon parser reuses for var(--name) paints.

The derived states follow one state rule: under the pointer a fill moves towards the side its content lies on, and held it moves away from it, each only as far as everything drawn on it keeps its contrast (MIN_TEXT_CONTRAST for text, MIN_ICON_CONTRAST for an icon). derive_state_steps computes a family's hovered and held steps and keeps them MIN_STATE_STEP (2 in CIEDE2000) from rest and from each other; the control, selected, play, and persist families, the theme applier's stock selection look and the stock rows all go through it. derive_accent_fill lightens or darkens accent until ACCENT_FILL_TEXT reads on it. The disabled tokens dim towards panel through colour_math::pull_back_mix (the private core/theme_colour_math.h, the rule behind readable_mix): DISABLED_TEXT keeps the contrast class faint has on each of panel, head, sunken, control, and the popup surface (POPUP, which a disabled menu row lies on), and DISABLED_LINE stays MIN_STATE_STEP from controlLine and the surfaces under it. The popup surface and its edge, the modal shade, the dimmed text, and the tree's drop line are derived the same way. tests/editor/kit/test_tokens.cpp pins the derived values of every built-in theme.

Five roles of theme_colours exist for the kit and are optional in a theme file: prefabSoft, prefabLine, overlay, statusDim, and frame (theme_colour_role::optional). A file written before they existed lacks them, so parse_theme derives the missing ones from the theme's own colours with derive_theme_roles, never from the base theme's values: prefabSoft is panel mixed PREFAB_SOFT_MIX towards prefab and pulled back until strong reads on it, statusDim is the status text mixed towards the status fill and pulled back until it keeps MIN_FAINT_CONTRAST on every colour of that fill, overlay is sunken at OVERLAY_OPACITY, and frame is muted. serialise_theme writes the derived values, and a built-in file must list all five.

The stock style, the canary, and the stock-item counter

stock_style.cpp holds STOCK_COLOURS, one row per ImGuiCol in ImGui's order. Two static_asserts hold the table to ImGuiCol_COUNT and to ImGui's order, and a third holds the stepped header rows to their rest row. Each row is in one stock_group:

  • PRIMITIVE colours are drawn by ImGui's own primitives everywhere and take a token: text, windows, borders, separators and dock splitters, scrollbars, tab and title bars, the docking preview, selection, navigation, and the modal dim.
  • HIDDEN colours are always transparent, such as child and table-row backgrounds, the resize grip, the border shadow, the tab overlines (the dock chrome paints its own) and the collapsed title (panels never collapse).
  • STOCK_WIDGET colours are read only by ImGui's stock widgets, which the kit replaces. In the CANARY style they are CANARY_COLOUR, magenta with alpha 254; in the COMPAT style they take the nearest kit look.

Some rows record how ImGui actually reads its colours. TitleBg and TitleBgActive are PRIMITIVE in the tab-bar colour because ImGui fills dock tab bars with them, floating ones during NewFrame, so they must be in the global style before the frame starts. Dock splitters read Border at rest (line2) and ResizeGripHovered and ResizeGripActive while hovered and held (accent), so only ResizeGrip is hidden. The docking preview's drop boxes read NavWindowingHighlight (accent), and DockingPreview is accent at DOCKING_PREVIEW_ALPHA (0.625) because ImGui multiplies it by 0.4 for the target area. TextDisabled is faint, the kit's hint colour. In COMPAT, rows marked readable mix through readable_mix so that ImGui's one Text colour stays legible on them, and HeaderHovered and HeaderActive are the hovered and held steps of Header (stock_row_steps).

apply_stock_style(theme, uiScale, style, target) replaces an ImGuiStyle with a fresh one: ImGui's defaults scaled by the kit scale, the paddings, spacings, and indent multiplied by density_factor (0.75 for compact, 1 for comfortable, 1.5 for spacious) and rounded, the window, child, popup, frame, and grab rounding at metrics.rounding times the scale, square tabs without borders, no tab-bar line or overline, the scrollbar at the SCROLLBAR metric and fully rounded, one-pixel dock splitters, and every colour from the table. Nothing of the old style survives.

kit_context::apply_theme(theme, uiScale) resolves the tokens at the UI scale, drops the cached icon meshes when the tokens' scale changed and, when an ImGui context is current, writes the global style at the theme's own scale (GLOBAL_STYLE_UI_SCALE is 1 in kit_context.cpp). That style serves stock widgets, which only a legacy module panel draws, and whose fonts ignore the UI scale too, so their text and paddings agree; kit widgets size themselves from the tokens. set_stock_style rewrites the global style the same way, so it changes colours only.

The global style is DEFAULT_STOCK_STYLE: CANARY in Debug builds and COMPAT in the others, where nobody looks for the canary. A legacy module panel draws inside a scope that pushes COMPAT (ui/module_compat.cpp). The editor's own surfaces draw inside a stock_canary_scope, which pushes the canary on every STOCK_WIDGET colour while canary_enabled() holds, whatever the global style. The canary is on by default in Debug builds and tests turn it on.

kit_context::end_frame() counts canary vertices when the canary is enabled. It reads the draw lists drawn in this frame only: those of windows begun in it (window->Active) and the foreground and background lists used in it (BgFgDrawListsLastFrame equal to the frame count), because a list left alone still holds an earlier frame's vertices, which were counted then. A vertex counts when its colour is the canary's and its alpha is neither 0 nor 255, so ImGui's fading of a disabled widget still counts. It logs one WARN per window the first time that window shows the canary; a docked panel's window, whose name starts with the dock chrome's spacer glyphs, is named from its ### identity on. It returns a canary_report.

The stock-item counter tells which items a frame registered outside the kit. ImGui is built with IMGUI_ENABLE_TEST_ENGINE, a public compile definition of conjure_thirdparty_imgui in third_party/CMakeLists.txt, so every link that holds ImGui's objects must define its four test-engine hooks. The engine and renderer tests link ImGui without the editor, so the hooks live in conjure_editor_kit_hooks, which the ImGui target links as an interface dependency; the archive needs only ImGui's headers, so there is no cycle. The hooks forward each item to the probe a test installs (detail::install_item_probe in item_probe.h) and do nothing otherwise. ImGui calls the item hooks only while its context's TestEngineHookItems is set, so a frame without a probe pays one flag test per item. widget_scope brackets its own registration with detail::enter_kit_submission and leave_kit_submission, so the probe sees which items are the kit's (item_event::insideKit); window registrations come through the same hooks and are flagged (item_event::window). ImGui registers no item for ItemAdd with id 0, so stock text such as Text is invisible to the counter: the kit-only rule is what guards it.

Painting

painter (conjure/editor/kit/paint.h) draws into one ImGui draw list with a kit context's tokens: fills (flat, or the theme's linear and radial chrome fills through paint_theme_fill), strokes drawn inside a rectangle, dashed outlines and lines, rings drawn outside a rectangle (the focus ring, the persisted mark), lines, dots and circles, icons, text in a type role, and soft shadows. A clip_scope narrows what a painter draws to a rectangle, without changing ImGui's hit testing. painter::window() paints into the current window's draw list with the current kit context; it reads the window through GetCurrentWindowRead, never GetWindowDrawList, so painting right after Begin() does not mark the window written and IsItemHovered() still answers for the title bar or tab. A painter made without a kit context or a window draws nothing.

  • Exact edges. Shapes are snapped to whole pixels. ImDrawList::AddRect strokes the path through the corners it is given moved half a pixel inwards (ADD_RECT_INSET), so the painter hands it corners that much further out: a one-pixel stroke covers exactly the edge pixel, and a one-pixel ring the pixel just outside. A level or upright line is filled as a rectangle, so it stays crisp.
  • Dashes. for_each_dash counts the dashes of an edge by integer index instead of stepping a float along it, and writes only those inside the clip rectangle the draw list's next command takes (_CmdHeader.ClipRect), at most MAX_DASHES_PER_EDGE (32768) per edge, so a pathological dash or rectangle cannot write millions of vertices.
  • Fitted text. text_in cuts a text with an ellipsis only when it measures more than TEXT_FIT_TOLERANCE (1/16 px) wider than its rectangle, because a rectangle measured for a text comes out a few ulps narrower at most UI scales. A rectangle without width shows none of the text. rect::empty() is also true for a rectangle with an edge that is not finite.
  • Text. Every text goes through the typography, which hands the source text to ImGui's log (LogRenderedText) when logging is on; the painter appends the same text to the frame record's item of the widget being drawn, never the private glyphs of a ligature.

Icons

Icons are vector drawings in a strict SVG subset, parsed once, flattened once per pixel size into a mesh, and copied into a draw list with an offset and a colour. conjure/editor/kit/icons.h declares the parser, icon_registry and the limits; icon_svg.cpp holds the scanner and the parser, and icons.cpp the flattening, the meshing, and the cache. kit_context owns the editor's registry (kit_context::icons()) with the 32 built-ins registered, and painter::icon draws through it.

Parsing. parse_icon_svg(text) is a strict scanner: attributes are quoted, entities and text content are refused, and comments and an XML declaration are skipped. The root is <svg viewBox="x y w h">; the elements are path (every command, arcs converted to cubics), rect, circle, ellipse, line, polyline, polygon, and g, whose transform may only translate and scale. fill, stroke, stroke-width, stroke-linecap, stroke-linejoin, stroke-dasharray, fill-opacity, and stroke-opacity are inherited as SVG inherits them. opacity multiplies into the fill and stroke opacity of the element and its descendants instead of compositing the group, so overlapping shapes show darker where they overlap. A paint is none, currentColor (the colour the widget passes), var(--name) (a colour token by its theme spelling) or a literal #rrggbb. Anything else is refused and reported by its element path, such as svg.g[0].path[1].stroke-miterlimit; a malformed tag, or a count past its limit, stops the scan.

The limits keep a hostile file from exhausting the parser or the mesher:

Limit Value Applies to
ICON_MAX_GROUP_DEPTH 32 nested g elements; a deeper group is reported and skipped without recursion
ICON_MAX_ELEMENTS 1024 elements in a file
ICON_MAX_ATTRIBUTES 64 attributes on one tag
ICON_MAX_COMMANDS 4096 path commands in one icon
ICON_VIEW_BOX_MIN_SIZE, ICON_VIEW_BOX_MAX_EXTENT 0.001, 1e6 the viewBox's size and extent
ICON_MAX_PIXEL_SIZE 1024 the drawn size; a larger or non-positive size draws nothing
ICON_MAX_MESH_POINTS, ICON_MAX_MESH_VERTICES 4096, 32768 one mesh at one size
ICON_MAX_DASHES 1024 dashes on one subpath; more strokes it solid

Every point of a shape must lie inside the viewBox grown by its longer side on each side. A shape with a stroke may have no stroke wider than that side and no dash that is not finite; a fill-only shape is not bounded by the width and dashes it inherits, so SVG's initial stroke width does not refuse a small viewBox.

Flattening. flatten turns an element's commands into subpaths in pixels, per icon and pixel size. Cubics are subdivided by Wang's formula at ICON_FLATTEN_TOLERANCE (0.25 px), with at most 64 chords per cubic, and points within a thousandth of a pixel of the previous one are dropped (push_distinct). A subpath that is only a moveto is neither filled nor stroked, as SVG draws it; one whose segments go nowhere, such as M5 5z, stays as a single point.

Meshing. The flattened shapes are drawn once, in white with the opacity as alpha, into a scratch ImDrawList on the target list's shared data, with ImGui's own anti-aliased fills (AddConcavePolyFilled, each subpath first made clockwise by its signed area, as ImGui's fringe expects) and strokes (AddPolyline). Holes and even-odd fills are not supported: a filled subpath is one simple polygon.

  • Joins are miters within SVG's initial miter limit of 4, a real bevel beyond it or for bevel, and a bevel plus a disc for round where the corner differs from the miter by more than the tolerance. A stroke that turns back on itself ends and starts again.
  • Butt caps end at the points, square caps extend the ends by half the width, and round caps are discs. A single-point subpath shows its caps alone: a disc, a square, or nothing for a butt cap.
  • Dashes are walked by distance along each segment. A single-point subpath is one zero-length dash, so it shows the same caps dashed or not.
  • Discs go through add_disc: a regular polygon of disc_sides(radius) sides, enough that no side strays more than the tolerance from the circle, never fewer than 12, rounded up to a multiple of four so the disc reaches its radius on both axes, and at most 512. The radius is at least half a pixel, because ImGui drops a smaller circle.

The cache and drawing. icon_registry::draw keeps the vertices, indices, and one run per paint for each icon and pixel size. A draw copies them with a whole-pixel offset and the run's colour times each vertex's coverage: currentColor takes the caller's colour, tokens and literals their own, and icon_tint::CALLER gives every run the caller's colour (a disabled widget's content). The mesh holds atlas coordinates, so it is rebuilt when the draw list's atlas changes, and kit_context::apply_theme drops every mesh when the scale changes. A mesh over the point or vertex limit is cached as refused and draws a crossed box in the error token with one WARN each time it is built. A name with no icon draws the same crossed box and warns once per name.

Typography

The typography bakes the ten type roles into ImGui's font atlas, measures and draws text in them, and replays Fira Code's contextual alternates for the code roles. Its files are private to the kit; the public face is type_role, type_spec and spec_of() in conjure/editor/kit/tokens.h, and the font scheduling of conjure/editor/ui/theme_applier.h.

File Holds
typography.{h,cpp} typography: rebuild and try_rebuild, font, measure, draw, cells, edit_cells, fitting_length, the report
text/font_loader.{h,cpp} finding a family's files and weights in font folders, and check_font_data
text/baked_characters.h the 226 characters every role bakes: U+0020 to U+00FF, U+2026, and U+2192
text/byte_reader.h big-endian reads that give 0 outside the data
text/opentype_font.{h,cpp} an sfnt font owning its bytes: tables, metrics, advances, and the character map as stb_truetype selects it
text/glyph_substitution.{h,cpp} one GSUB feature, checked and replayed
text/code_ligatures.{h,cpp} a font's calt closure, the advance check, the private codepoints, and shape()
text/ligature_atlas.{h,cpp} the alternates as custom glyphs of the atlas, and predict_packing
text/shaped_run_cache.{h,cpp} the least-recently-used cache of shaped runs

The ten roles. Each type_role has a face, a weight, a size, and a line height at 100 % with fonts.size 13 (spec_of); a role without a line height of its own takes its font's:

Role Face and weight Size Line height Used for
CAPTION UI 400 11 px 16 px the status bar, footers, captions, overlay text
BODY UI 400 12 px the font's rows, tabs, labels, text-valued fields
CONTROL UI 500 12 px the font's buttons, menu items
HEADING UI 600 12 px the font's panel and section headers
TITLE UI 400 13 px the font's the inspector's entity name
BADGE UI 400 10 px 15 px tab badges
AXIS UI 600 10 px the font's axis tags, the view-axes letters
MONO code 400 12 px the font's values, paths
MONO_SMALL code 400 11 px 16 px the guid, stats and cursor chips, Persist paths
LOG code 400 11.5 px 19 px console lines

Baking. try_rebuild(theme, uiScale, fontFolders, rasterizerDensity, maxTextureSize) needs a current ImGui context and no open frame or locked atlas (INVALID_STATE otherwise; rebuild is the same without the result). It fills the atlas in this order:

  1. Fonts[0], the editor's UI font at fonts.size, and the font tagged MONO_FONT_TAG (conjure-mono), both at the theme's size without the UI scale, for the stock widgets of a legacy module panel drawn in COMPAT.
  2. One font per role in type_role order, named with ROLE_FONT_TAG: the role's face (fonts.ui or fonts.mono, resolved as resolve_theme_fonts says, with one WARN naming every replacement), its weight from the family's Regular, Medium, and SemiBold files (a missing weight falls back to Regular with one WARN per typography and file, listed in report().missingWeights), at its size times kit_scale(fonts.size, uiScale).
  3. The code ligatures' alternates for MONO, MONO_SMALL, and LOG, reserved in a pass of their own once every role's font is in the atlas.
  4. The dock chrome's zero-ink font (CHROME_FONT_TAG), whose spacer glyphs spell a docked panel's tab width in its window name.

Sizes are CSS pixels per em, as the mockup gives them. ImGui's size is the ascender-to-descender height, so a role is added at em x (ascender - descender) / unitsPerEm from the hhea table, and ImGui's truncation of the size to whole pixels when a font is added is undone by writing the exact size back before the atlas builds. The mono roles are baked with OversampleH 1 and PixelSnapH, so every cell is a whole number of pixels wide.

The texture limit. The atlas is one texture, and a GPU refuses a texture larger than its maxTextureDimension2d; without a font texture the editor would show no text at all. Every rebuild therefore foresees the texture ImGui will allocate (text::predict_packing) and gives way, in this order, until it fits maxTextureSize on both sides, with one WARN per step and typography:

  1. the code ligatures' alternates are refused, and their roles draw plainly;
  2. the rasteriser density drops a whole step at a time (4, 3, 2, then 1), so the text keeps its layout and loses sharpness on a display whose framebuffer is finer than its window;
  3. the raster scale drops below the size (densities 1/2, then 1/4, MIN_RASTERIZER_DENSITY), so ImGui rasterises the glyphs smaller and draws them at their size;
  4. ImGui's built-in font serves every role (report().fellBack), as when the atlas does not build at all.

maxTextureSize 0 counts as DEFAULT_MAX_TEXTURE_SIZE (16384). The built atlas is checked as well, since a builder other than ImGui's stb_truetype one is not foreseen. report() says what the rebuild did: the files, sizes and weights of the roles, the ligature state, the scale, the requested and used rasteriser densities, the limit, the built texture's size, and whether it fell back.

font(role) returns the baked font only while the atlas is the current context's and still carries this typography's stamp: every rebuild writes a process-wide serial into ImFontAtlas::UserData, so a rebuild by another typography is noticed even when ImGui's allocator hands the new fonts the old addresses. Otherwise it returns nullptr, so no caller draws with a dangling ImFont *. release() forgets everything; the theme applier calls it from its context shutdown hook.

Font files and their checks. text/font_loader.h finds a family as <Family>-Regular.ttf or <Family>.ttf (.otf alike) in the font folders in order, the family compared without spaces, hyphens, underscores, or ASCII letter case: "Fira Code" is found as FiraCode-Regular.ttf. The Medium and SemiBold files are looked for only in the folder of the chosen Regular file, so a family's weights always come from one place. check_font_data refuses a file, with one WARN naming it, when it is not a font, is truncated, is a collection, has CFF outlines (stb_truetype walks CFF data without bounds) or has no Unicode character map of format 4 or 12. It checks the table directory, the tables the rasteriser reads at load (the em within MIN_UNITS_PER_EM 16 to MAX_UNITS_PER_EM 16384), and every glyph's location: inside the glyph table, in order, and at least the 10-byte header for a glyph that is not empty. It computes the glyph of every baked character as the rasteriser does and requires it below the glyph count. It does not read outlines, so a file that passes is as safe to rasterise as ImGui's own baking of it, no more. A refused file gives way to the family's next one, and files larger than MAX_FONT_FILE_SIZE (32 MiB) are not read.

Code ligatures. ImGui draws one glyph per character and has no shaping, and Fira Code builds its ligatures from contextual alternates that keep every character one cell wide. The kit therefore maps a text's characters to glyphs through the character map, replays the font's calt feature over them, and draws one codepoint per cell: the character itself, or a private-use codepoint from 0xE000 under which the alternate is baked.

  • glyph_substitution::load reads the calt feature under the DFLT script (latn when DFLT has none) and compiles the lookups it reaches: single substitution (type 1), chained contexts (type 6, formats 1 to 3) and extensions (type 7) wrapping either. Every structure a replayed lookup reads is checked first; a failure is INVALID_ARGUMENT and the role draws plainly. Lookups outside the subset are skipped and listed in skipped(). Because offsets can alias one structure many times, loading spends at most MAX_LOAD_WORK (4 Mi units) and a replay at most replay_work_budget(n) (REPLAY_WORK_PER_GLYPH 4096 per glyph, at least MIN_REPLAY_WORK); a run that runs out draws plainly.
  • code_ligatures::build takes the closure of the replayed single substitutions over the baked characters' glyphs, stopping once more alternates appear than the private use area holds, and refuses ligatures when any substitution in the closure changes its input's advance. Any proportional font named as the code font therefore gets none. Fira Code and JetBrains Mono 2.304 both keep every cell, pass the check, and shape (test_code_ligatures.cpp holds the bundled files to it).
  • shape() replaces a literal private-use character an alternate is baked under with U+FFFD, so the role font never shows an alternate the text did not ask for. It leaves text that is not valid UTF-8 alone; typography::cells then masks it with ImGui's own UTF-8 decoder.
  • ligature_glyphs::reserve adds each inked alternate as an AddCustomRectFontGlyph before Build() and refuses them all when one glyph box passes MAX_ALTERNATE_EMS (4 em) or MAX_ALTERNATE_PIXELS (4096) on a side, or when predict_packing finds that they would crowd out ImGui's own glyphs or pass the texture limit. After the build, stbtt_MakeGlyphBitmap fills each rectangle. A refusal is one WARN per typography and font file, naming the roles.

ligature_atlas.cpp compiles imstb_rectpack.h and imstb_truetype.h as static functions of the file, configured exactly as imgui_draw.cpp configures them, so the packing predict_packing foresees and the alternates' pixels come from the same code as ImGui's. stb's implementations are C, and their casts around the macros the file defines are C-style casts. GCC reports a warning inside a macro expansion at the macro's definition, which is in this file rather than in the third-party header, so the file silences -Wold-style-cast for that block alone with #pragma GCC diagnostic push and pop under CONJURE_COMPILER_GCC. Clang counts the expansions as the system header's and stays silent.

Measuring and drawing. measure(role, text) is the advance width and the role's line height; it never shapes, because every alternate keeps its cell. draw(list, role, pos, colour, text, clipWidth) treats pos as the top-left corner of the line box, centres the glyphs in it as CSS does and snaps the origin to whole pixels. With a clip width and a wider text, fitting_length cuts it on whole characters before shaping and it ends in U+2026 (... in a font without it). The mono roles draw cells(), which looks the run up in the shaped_run_cache (keyed by a 64-bit FNV-1a hash of the text seeded by the role, holding the text so a collision is a miss) and shapes it on a miss into the evicted entry's buffers; a hit allocates nothing. The source text, never the shaped cells, goes to ImGui's log. An active text field draws edit_cells(), which keeps the ligature that holds the caret as plain characters.

Scale and settings. The theme applier schedules every rebuild; Themes in the UI gives the order. The rebuild runs at editor_ui_scale(), editor_rasterizer_density(), and the applier's font_texture_limit() (the RHI device's maxTextureDimension2d, lowered by set_font_texture_cap). The user setting codeLigatures reaches the typography through set_code_ligatures every frame; it changes only whether cells() shapes, and rebakes nothing. With the ligatures off the alternates stay baked, so masking still applies.

Widget scopes and the edit session

Every widget follows the pattern of conjure/editor/kit/widget.h: a props struct, a pure measure(props, text_metrics) that needs no ImGui, a draw(widget_scope &, props) that paints through the scope's painter, and a free function that ties them together through submit(key, props, widget_options).

widget_scope takes its rectangle from the current layout position (ImGui's cursor, or the current layout_host) or an explicit one, calls ItemSize and ItemAdd with the key's id, runs ButtonBehavior for an interactive widget (ItemHoverable for a passive one), records the widget in the frame record, and reports hovered, held, pressed, focused, disabled, and visible; its destructor writes the final state and the tokens the widget named. It reads the window with GetCurrentWindowRead. The scope still marks the window written through SetCursorScreenPos and ButtonBehavior, which is harmless because by then its ItemAdd has made it the last item.

  • Disabled. ButtonBehavior presses on a navigation activation whatever ImGuiItemFlags_Disabled says, so a disabled interactive scope never runs it: it runs ItemHoverable alone and clears the active id when the item was held as it became disabled.
  • Options as item flags. widget_options::allowOverlap and focusable = false are pushed as item flags around the registration, so the passive hover test honours them too; repeat presses at ImGui's key-repeat rate, and pressOnClick presses when the button goes down.
  • Ids. Keys hash like ImGui labels in the current id stack, so an interactive widget needs a key unique in its window, and an empty key on an interactive widget asserts. widget_id("") is 0. id_scope(key) asserts on an empty key; id_scope(index) pushes the hash of the index's bytes, so no index can spell ###.
  • Looks. A widget paints from widget_scope::look(), its real state plus what an open state_preview_scope shows, and acts on the real state, so a previewed widget never takes a click.

The edit session (edit_session.h, private) is the one text buffer the kit's fields share, owned by the kit context. A field paints itself until it is activated; then ImGui's TempInputText edits EDIT_BUFFER_SIZE (1 KiB) bytes over the field's whole rectangle with ImGui's own frame made invisible, and the session reports started, changed, committed or cancelled. Only one item is active at a time, but a field drawn earlier in a frame can take the activation from one drawn later: the displaced field's final text, with the text its edit started from, moves to a one-slot pending commit that the field collects the next time it is drawn. A field's id is its hidden label's, ##<key> (field_id), because InputTextEx rehashes its label.

  • A text longer than the buffer is cut on a UTF-8 boundary and edited read-only, so a cut text is never committed; a field with text_field_props::unbounded grows the buffer instead.
  • A number field's drag is a session too: one slot holds the field being dragged and the value its drag started from, as a 64-bit float or a 64-bit integer, which Escape puts back.
  • Given the typography and a mono role, the session draws the edit's text itself, shaped, at ImGui's text origin and scroll, with ImGui's own text and caret drawn transparent; the run of cells that holds the caret is drawn as plain characters, so typing !, =, = shows each step before it joins.
  • The session belongs to the ImGui context it began in and follows it through an ImGuiContextHookType_Shutdown hook: a context destroyed with an edit open forgets the edit, so a later context at the same address never receives it. The first call in another live context forgets the edit too and follows that context.

Controls, fields, containers, and views

The state rules in widget_look.h are shared by every widget. state_fills picks a surface's fill, held over hovered over rest: framed_fills(tone) for the control, accent, play, and persist families and the alert tones, GHOST_FILLS for borderless controls and rows, SUNKEN_FILLS for a clear checkbox's box and a field-style dropdown, and ACCENT_FILLS. A field's edge is field_line: accent while edited or held, then error, then persist, faint under the pointer, otherwise controlLine. Disabled is one look for every tone: the control fill with a DISABLED_LINE edge (neither for a ghost) and DISABLED_TEXT content, and a toggle or pin that is on keeps a plain control fill (disabled_fill, disabled_line). The focus ring is one pixel of FOCUS_RING just outside a widget the keyboard focused.

  • Controls (conjure/editor/kit/controls.h, controls.cpp): buttons, icon buttons, toggles, the segmented control, the checkbox, the pin toggle, badges, dots, labels, separators, the dropdown, progress bars, and the sparkline. Interactive controls need a key; passive ones take none. The segmented control is a composite: a passive frame scope that never takes the hover (detail::frame_options), a layout_guard, then one toggle per item keyed by index. The checkbox's tick is the icon check.tick.
  • Fields (conjure/editor/kit/fields.h, fields.cpp): text, search, number, vector, and angle fields, the enum and reference fields, the colour swatch, and the asset slot. Fields are passive scopes that test the click and the navigation activation themselves, because ButtonBehavior would clear the active id on release and end the edit it started. The value is written only on a commit, and the undo stack coalesces from started to committed. Number fields edit the shortest text that reads back exactly and parse with std::from_chars, never ImGui's TempInputScalar; integer fields keep 64-bit integers throughout, and infinities and NaN are spelt inf, -inf and nan. A keyboard tweak (Space, then the arrows) is a drag, and Enter during it opens the text edit as the same transaction. A number field with joinedLeft paints its frame inside shared_edge_clip, so the control on its left (the toolbar's Snap button) keeps their shared column. The colour swatch opens the colour picker.
  • Colour editors (conjure/editor/kit/colour_picker.h): the colour picker edits 8-bit sRGB colours and float channels, past 1 where a field allows HDR, with a drag on its area or strips as one edit that Escape cancels; the gradient stop editor edits the Theme editor's chrome fills, two to four stops of a linear fill and two to three of a radial one.
  • Containers (conjure/editor/kit/containers.h, containers.cpp): the viewport bars and the screen, the toolbar strip with its groups, the status strip, the panel shell with the dock chrome, the property containers, and the overlay cards, banners, and picture. A toolbar_strip is the kit's layout_host while it is open, and its spacers share the free space from the last frame's totals, kept in the window's state storage: the kit's one previous-frame cache, so a centred cluster lands one frame after a width change and the items after the first spacer are hidden in a strip's first frame. A SEGMENTED group's track is painted under its widgets through a draw-list splitter the kit context lends out per nesting depth. A status_strip is declarative: its segments are data, arranged by the pure arrange_status() when it closes. The panel_shell and the dock chrome begin each panel's window as <spacers>###<registry name> in the chrome font, so ImGui's docking keeps its behaviour while the kit paints every tab, header, and overline at the end of the workspace draw.
  • Property containers. A property_grid holds property_sections, which hold property_rows and property_groups. A property_row arranges the change dot, the label, the values, and the pin (arrange_property_row), is the layout host for the widgets placed in its values, and takes its row marks from row_marks. property_row_props holds label, hint, marks, pinLabel, changeLabel, lines, readOnly, mixed and wrapLabel. With wrapLabel, a label its slot would cut wraps between words onto lines of its own, as many as it needs, so it reads whole; the row grows to fit and its value stays on the first line.
  • Popups (conjure/editor/kit/popups.h, popups.cpp): the menu bar, menus and submenus, menu items, context menus, popup menus, the popup list, modal dialogs, and the tooltip. They live on ImGui's popup stack and keep its keyboard navigation, menu-bar hopping, aim triangle, and Escape handling, while the kit alone draws them. Keys hash as ImGui labels, so a menu item has the id ImGui's MenuItem would give the same label. A tooltip shows by the tooltip rule (kit_context::tooltip_allowed): after ImGui's delay with the pointer resting, or for the keyboard's focus only after a navigation key moved it there, and never while the item is held, a mouse button is down, or the pointer has not moved since a popup closed or a press.
  • Data views (conjure/editor/kit/views.h): the tree view, grid view, list view, table view, and empty state. A view opens a scrolling child window and submits only the rows ImGui's list clipper shows; the caller owns the data, draws the rows the view asks for by index, and applies the events the view reports. A keyed tree keys its rows by the caller's identity, so a drag or rename follows its row when rows above it change. Every view scrolls under the kit's overlay scrollbar, and steady frames allocate nothing.
  • Input (conjure/editor/kit/input.h): the pointer and the keyboard as the current frame sees them, for surfaces that read more than a widget_scope reports, such as the Scene view's camera drags. leave_input_to_engine() gives the next frame's events to the engine; kit::shortcut claims a key route.
  • Layout and record. conjure/editor/kit/layout.h is the pure layout core: rect and row_layout, whose slots are FIXED, FILL, or FIT, held in place up to MAX_ROW_SLOTS so a steady frame lays out without allocating. conjure/editor/kit/record.h is the frame record: every kit widget of a frame in submission order, with its kind, id, key, rectangle, state, tokens, and source text. kit_context clears it at every begin_frame, keeping its capacity.
  • Catalogue. conjure/editor/kit/catalogue.h describes every kit widget as constant data: its C++ name, version, record kinds, props with their kinds, defaults and flags, events, children, a summary, and an example (widget_catalogue(), find_widget_desc, find_prop).

widget_gallery_panel (ui/panels/widget_gallery_panel.cpp, registry name widget_gallery) is a built-in panel in conjure_editor_ui, closed by default and opened from Window > Widget gallery. It shows every widget of the kit in every state the kit derives, in the current theme, so states that the mockup does not draw can be reviewed. It draws with the kit alone inside a stock_canary_scope, and draws nothing without a current kit context.

  • A theme row switches the active theme between the six built-ins by sending editor.theme.set through the dispatcher, as the Theme editor's Set active does.
  • Each section is a table with a row per widget or variant and a column per state: rest, hovered, held, focused and disabled. The rest column holds live widgets; the hovered, held, and focused columns use a state_preview_scope and the disabled column a disabled_scope.
  • Each section opens a file-local gallery_section, which holds an id_scope for the whole body, so two sections' widgets never share an ImGui id.
  • The sections are drawn from the widget catalogue: widget_gallery_panel::sections() names the catalogue widgets each section shows, and every catalogued widget except the frames the gallery is drawn in (FRAME_WIDGETS) appears in one section. A section title's tooltip lists its widgets' names and summaries.

The gallery's sections are also the subjects of the kit's goldens (Testing).

Surfaces and the kit-only rule

Every editor surface draws with the kit: the toolbar, the status bar, the menus and dialogs, the start screen, every built-in panel, and the dock chrome. A module panel registered through kit_panel_desc draws with the kit too; only a legacy panel_desc panel receives the raw ImGui context, and it draws in COMPAT.

The kit-only rule of tools/check_style.py (rule kit-only, class kit_only_rule) keeps it that way. It covers every C++ source under engine/include/conjure/editor/, engine/src/editor/, and editor/, and denies by default:

  • no include of an ImGui header (any imgui*.h, imconfig.h, imstb_*.h, or ImGuizmo.h that is no repository header);
  • no include through a macro, which the rule cannot follow;
  • no include, quoted or in angle brackets, of a repository header that reaches ImGui through its own includes, resolved as the compiler resolves it (a quoted include next to the including file first, then under engine/include and engine/src). reach_of_imgui searches breadth first, so a finding names the shortest chain;
  • no ImGui name in the code: ImGui::, an Im-prefixed type such as ImVec2, or an IM_ or IMGUI_ macro. Comments, string literals, and the text of raw string literals do not count.

The files that must reach ImGui are listed under kit_only_exceptions in tools/style_exceptions.json, each with its reason: the kit's own sources (the folder entry engine/src/editor/kit/), its four public headers that forward-declare ImGui types, the workspace's layout file (ui/editor_workspace_layout.cpp, ImGui's DockBuilder and ini settings), the gizmo bridge to ImGuizmo, imgui_frame_scope, the theme applier, and ui/module_compat.cpp. An entry is a normalised repository-relative path of a C++ source, or a folder ending in /, inside the rule's folders and not under another entry; anything else is a usage error. A whole-repository run reports an entry that matches no checked file and one whose files no longer reach ImGui, so the list stays as small as the code allows. Helpers the panels share without ImGui live in ui/ui_common.h and ui/ui_forms.h. The rule's self-test is tools/tests/test_check_style.py (CTest style.check_tool).

Threading Model

The kit is main-thread only. Every widget, container, popup, and view runs inside an ImGui frame and window with a current kit context; the free functions read the context kit::current() returns. In the editor that is the ImGui context of the engine's imgui_layer, and the kit context is the one editor_layer owns: editor_layer::on_imgui makes it current with a current_kit_scope, calls begin_frame, draws the workspace, and calls end_frame, all inside the frame imgui_layer opened. Modules reach the same kit context through conjure_shared, and the editor calls a module's kit panel or drawer only while it draws that module's panel or row.

Warning

The typography rebuilds the font atlas only outside an ImGui frame, because the atlas is locked inside one. The theme applier calls load_fonts from editor_layer::on_attach and on_frame_end, so a scale or theme change shows the new tokens in the frame it is applied and the new glyphs from the next frame.

State that belongs to one ImGui context follows that context through ImGuiContextHookType_Shutdown hooks: the edit session forgets an edit whose context was destroyed, and the theme applier releases the typography's fonts. A typography's fonts belong to the atlas they were baked into, and font() returns nullptr once another context is current. A project.open restart brings a new ImGui context, a new editor_layer, and a new kit context.

The test-engine hooks forward to a process-wide probe pointer, so a test installs a probe on the main thread only. widget_catalogue() and the stock colour table are constant data, safe to read from any thread.

Extension Points

A kit widget. A widget in the kit or in a module follows the pattern of widget.h:

  1. a props struct with what to show, its state included (the caller owns the state and the widget reports the press);
  2. a pure measure(props, text_metrics) that returns its size, so layout is tested with fixed_text_metrics;
  3. a draw(widget_scope &, props) that paints through scope.paint() in tokens only (colour_token, metric, type_role, fill_token), reading its state from scope.look();
  4. a free function that calls submit(key, props, widget_options{...}) and returns what happened.

A composite opens a passive frame scope and a layout_guard, then submits its parts under an id_scope. A new widget in the kit also gets a widget_desc in catalogue.cpp, a row in a Widget gallery section, cases in tests/editor/kit/test_<header>.cpp, and new golden references for the sections it changes.

Module panels, icons, and drawers. conjure/editor/kit_panel_desc.h holds the three records a module registers with module_registrar::register_extension:

Record Extension point What the editor does with it
kit_panel_desc editor.kit_panel registers the panel as <module>.<name>, the identity of its window and its key in the saved layout; calls draw(kit::panel_shell *, userData) every frame the window shows its contents, inside a stock_canary_scope
kit_icon_desc editor.kit_icon adds the SVG to the kit's icon registry while the module is loaded. An SVG the kit refuses, or a built-in icon's name, is left out with a WARN. An icon without a name or an SVG, one the module names twice, or one named as another attached module's icon fails the module's attach with REGISTRATION_CONFLICT
kit_drawer_desc editor.kit_drawer draws the values of one reflected type in the property row the inspector opened, with draw(kit::property_row *, core::json::document *, userData)

The editor's module consumer copies each record at attach, its texts into strings of its own, removes it on detach and makes it again when a module reloads. Module code never receives the ImGui context and cannot restyle a kit widget. The legacy panel_desc record still loads and draws in COMPAT, and the consumer reports it as deprecated once per attach. Around every module panel's draw the stock items it submits are counted. The records forward-declare the kit's types, so they stay in editor_core, which builds without ImGui.

Icons at run time. icon_registry::add(name, svg) registers a parsed icon (ALREADY_EXISTS for a taken name); built-in icons are files in engine/src/editor/kit/icons/ listed in CONJURE_EDITOR_ICON_FILES.

Tokens and roles. A new colour token is added to colour_token, make_token_set, and to_string; a new theme role is added to theme_colours and theme_colour_roles(), optional only when it can be derived as the five optional roles are.

Testing

The kit's tests are part of conjure_editor_tests (label editor), in suites named editor/kit/.... Where they live, how they run headless, and how they are labelled is described in Editor and widget kit tests; this section says what each part of the kit is held to.

  • Pure code. test_tokens.cpp checks the derived states of every built-in theme and of user themes at their limits, and the sizes at 100, 125, 150, and 200 %; test_layout.cpp checks the row arrangements against the mockup's numbers (the inspector's property row at 340 px gives 6, 78, 198, and 20); test_icons.cpp parses the SVG subset and every refusal by its path; test_record.cpp checks the frame record and its allocation gate; test_catalogue.cpp reads the public headers to hold the catalogue to the widgets' declarations.
  • Headless frames. tests/editor/kit/support/kit_test_support.h gives a kit_test_frame (an ImGui context, a current kit context with a theme applied, one window per frame), kit_probe_scope (the stock-item counter's probe), draw probes over a draw list (count_vertices, vertex_bounds, canary_vertices), rasterise_last_frame, which rasterises the frame with soft_raster, and keyboard input. The widget, container, popup, and view cases measure against the mockup's sizes, drive states through the pointer and the keyboard, check edit_result sequences, read painted pixels back for exact edges, and require steady frames without allocations, no canary vertex, and no stock item.
  • Typography. tests/editor/kit/text/ covers the private font code. ligature_test_font builds a TrueType font with GDEF and GSUB from the public specification, so a case can compose damaged or hostile tables, and bundled_font_support reads the bundled fonts next to the test executable. test_typography.cpp checks every role's face, weight, size, and line height, shaped runs against plain ones, and each step the texture limit takes; test_ligature_atlas.cpp checks predict_packing against ImGui's own build.
  • Conformance. The cases tagged [kit_conformance] sweep every widget family, panel, menu, dialog, and the dock chrome for canary ink and stock items in six themes at 100 and 150 %, and include the stock colour table's cases and the reverse pass; see Conformance.
  • Goldens. The [kit_visual] cases render every Widget gallery section and the default layout on the CPU and compare them with lossless JPEG XL references in tests/editor/data/kit_golden/. Running them, reading their failures, regenerating the references, and building review triptychs with tools/kit_triptych.py are described in Widget kit goldens.
ctest -L kit_conformance
bin/conjure_editor_tests -ts="editor/kit/*"