/** * Short XML references returned by get_drawing_guide with a topic. Each * snippet is the bare mxCell elements of one page, as create_new_diagram * accepts them, and is checked by tests/xml-reference.test.ts. */ import { indent } from "./xml-examples.ts" const TABLE_ROW_STYLE = "shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;strokeColor=inherit;top=0;left=0;bottom=0;right=0;collapsible=0;dropTarget=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" const TABLE_CELL_STYLE = "shape=partialRectangle;html=1;whiteSpace=wrap;connectable=0;strokeColor=inherit;overflow=hidden;fillColor=none;top=0;left=0;bottom=0;right=0;pointerEvents=1;" const TABLES_EXAMPLE = ` ` const LAYERS_EXAMPLE = ` ` const GROUPS_EXAMPLE = ` ` export const XML_REFERENCE: Record<"tables" | "layers" | "groups", string> = { tables: `## Tables A table is three levels of cells, as draw.io's sidebar inserts them: the table container (style "shape=table;startSize=0;container=1;collapsible=0;childLayout=tableLayout;", parent="1", geometry wide enough for all columns), one row per table row (style as below, parent = table id, width = table width, height = row height, y = row offset), and one cell per column inside each row (style as below, parent = row id, x = column offset, y = 0, width = column width, height = row height; the cell text is the value). A header row can use fontStyle=1 on its cells. Example with 2 rows and 2 columns: ${indent(TABLES_EXAMPLE)} `, layers: `## Layers A layer is the one case of a cell with parent="0" and no vertex or edge attribute; id="1" is the default layer. Add a layer cell and give shapes parent="" to put them on it: ${indent(LAYERS_EXAMPLE)} `, groups: `## Groups A group is a container with style="group" (parent="1", geometry enclosing its children). Children use parent="" and coordinates relative to the group; moving the group moves them: ${indent(GROUPS_EXAMPLE)} `, }