Vector kit command

css.selection

CSS Properties

Answers CSS rules for the selected objects (fills, strokes, type, opacity, optionally positions and sizes) in a unit.

Kit
Vector 0.1.0 (.kvector)
Changes the document
no
Acts on
ids (a list of ids), which a run step’s on fills

Parameters

Parameters of css.selection
NameTypeRequiredDescription
dimensionsbooleannowidth, height
idintegernoobject ID
idsinteger[]noobject IDs
imagebooleannoread by the command beside its listed parameters
positionbooleannoposition: absolute, left and top from the artboard's top-left
ppinumbernoread by the command beside its listed parameters
rasterizebooleannoart CSS can't describe as background-image: url(<class>.png), its picture, which css.export writes
scopestringnoread by the command beside its listed parameters
units"px" | "pt" | "mm" | "cm" | "in"no
unnamedbooleannounnamed objects too, classes named after their kind; false: named objects only

Call through vector_run

text
vector_run {
  "path": "<file>.kvector",
  "steps": [{ "command": "css.selection" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: dimensions, id, ids, image, position, ppi, rasterize, scope, units, unnamed. vector_run answers the step’s result in completed[i].result.

Result

Result of css.selection
NameTypeRequiredDescription
cssstringno
rulesobject[]no
skippednumberno
warningsany[]no
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "css": {
      "type": "string"
    },
    "rules": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "css": {
            "type": "string"
          },
          "id": {
            "type": "number"
          },
          "selector": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "skipped": {
      "type": "number"
    },
    "warnings": {
      "type": "array"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "dimensions": {
      "default": true,
      "description": "width, height",
      "type": "boolean"
    },
    "id": {
      "description": "object ID",
      "type": "integer",
      "x-khp-types": [
        "Node"
      ]
    },
    "ids": {
      "description": "object IDs",
      "items": {
        "type": "integer"
      },
      "type": "array",
      "x-khp-types": [
        "Node"
      ]
    },
    "image": {
      "description": "read by the command beside its listed parameters",
      "type": "boolean"
    },
    "position": {
      "default": false,
      "description": "position: absolute, left and top from the artboard's top-left",
      "type": "boolean"
    },
    "ppi": {
      "description": "read by the command beside its listed parameters",
      "type": "number"
    },
    "rasterize": {
      "default": false,
      "description": "art CSS can't describe as background-image: url(<class>.png), its picture, which css.export writes",
      "type": "boolean"
    },
    "scope": {
      "description": "read by the command beside its listed parameters",
      "type": "string"
    },
    "units": {
      "enum": [
        "px",
        "pt",
        "mm",
        "cm",
        "in"
      ],
      "type": "string"
    },
    "unnamed": {
      "default": true,
      "description": "unnamed objects too, classes named after their kind; false: named objects only",
      "type": "boolean"
    }
  },
  "returns": "{css, rules: [{id, selector, css, unsupported?: why CSS can't describe the art exactly (without rasterize it is written as its box), image?: the PNG it refers to}], skipped: n unnamed objects left out, warnings}",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (vector_commands through @kition/[email protected], built from KitionAI/kition-vector@7cf908f). As data: commands.jsonl.