Design kit command

inspect.componentCode

Component code

Answers a component's code in a language with its properties as parameters.

Kit
Design 0.1.0 (.kdesign)
Changes the document
no
Acts on
id (one id), which a run step’s on fills

Parameters

Parameters of inspect.componentCode
NameTypeRequiredDescription
idinteger | stringnoan id; component, set or instance; default the selection
language"react" | "leptos" | "vue" | "swiftui" | "compose" | "arkui"nodefault react

Call through design_run

text
design_run {
  "path": "<file>.kdesign",
  "steps": [{ "command": "inspect.componentCode" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: id, language. design_run answers the step’s result in completed[i].result.

Result

Result of inspect.componentCode
NameTypeRequiredDescription
componentanyno
connectedobjectno
definitionanyno
nameanyno
propertiesany[]no
setanyno
usageanyno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "component": {},
    "connected": {
      "additionalProperties": true,
      "type": "object"
    },
    "definition": {},
    "name": {},
    "properties": {
      "type": "array"
    },
    "set": {},
    "usage": {}
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "an id; component, set or instance; default the selection",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-types": [
        "Node"
      ]
    },
    "language": {
      "description": "default react",
      "enum": [
        "react",
        "leptos",
        "vue",
        "swiftui",
        "compose",
        "arkui"
      ],
      "type": "string"
    }
  },
  "returns": "{component, name, set, properties: [{name, param, type, default, value? (instances)}], definition, usage? (instances; the connected snippet when the component is connected to code), connected: {importPath, name, template, import, code} | null}",
  "type": "object"
}

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