@fprad0/skill-master-mcp 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +61 -8
  3. package/VERSION.md +3 -3
  4. package/bin/lib/menu-core.mjs +798 -7
  5. package/bin/skill-master-bootstrap-global.mjs +48 -0
  6. package/bin/skill-master-doctor.mjs +168 -0
  7. package/bin/skill-master-install-global-skills.mjs +97 -0
  8. package/bin/skill-master-menu.mjs +184 -36
  9. package/bin/skill-master-register-clients.mjs +177 -0
  10. package/dist/domain-router.d.ts +11 -0
  11. package/dist/domain-router.d.ts.map +1 -0
  12. package/dist/domain-router.js +79 -0
  13. package/dist/domain-router.js.map +1 -0
  14. package/dist/index.js +159 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/moral-governance.d.ts +24 -0
  17. package/dist/moral-governance.d.ts.map +1 -0
  18. package/dist/moral-governance.js +143 -0
  19. package/dist/moral-governance.js.map +1 -0
  20. package/dist/prompt-router.d.ts +4 -0
  21. package/dist/prompt-router.d.ts.map +1 -1
  22. package/dist/prompt-router.js +18 -2
  23. package/dist/prompt-router.js.map +1 -1
  24. package/docs/planning/V0_0_9_APROVACAO_CRITICA_MENSAGENS_DE_VENDA.md +85 -0
  25. package/docs/planning/V0_0_9_FONTES_E_CRITERIOS_DE_AUTORIDADE.md +139 -0
  26. package/docs/planning/V0_0_9_MATRIZ_SKILLS_MULTIDISCIPLINARES.md +105 -0
  27. package/docs/planning/V0_0_9_POLITICA_MORAL_CATOLICA_PARA_IA.md +181 -0
  28. package/docs/planning/V0_0_9_PROMPTS_EXECUCAO.md +59 -0
  29. package/docs/planning/V0_0_9_ROADMAP_DISCERNIMENTO_E_CONHECIMENTO_AMPLO.md +181 -0
  30. package/docs/skill-candidates/v0.0.10/cli-creator/LICENSE.txt +201 -0
  31. package/docs/skill-candidates/v0.0.10/cli-creator/SKILL.md +160 -0
  32. package/docs/skill-candidates/v0.0.10/cli-creator/agents/openai.yaml +4 -0
  33. package/docs/skill-candidates/v0.0.10/cli-creator/references/agent-cli-patterns.md +154 -0
  34. package/docs/skill-candidates/v0.0.10/developer-workstation-ops/SKILL.md +32 -0
  35. package/docs/skill-candidates/v0.0.10/figma/LICENSE.txt +2 -0
  36. package/docs/skill-candidates/v0.0.10/figma/SKILL.md +42 -0
  37. package/docs/skill-candidates/v0.0.10/figma/agents/openai.yaml +14 -0
  38. package/docs/skill-candidates/v0.0.10/figma/assets/figma-small.svg +3 -0
  39. package/docs/skill-candidates/v0.0.10/figma/assets/figma.png +0 -0
  40. package/docs/skill-candidates/v0.0.10/figma/assets/icon.svg +28 -0
  41. package/docs/skill-candidates/v0.0.10/figma/references/figma-mcp-config.md +35 -0
  42. package/docs/skill-candidates/v0.0.10/figma/references/figma-tools-and-prompts.md +34 -0
  43. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/LICENSE.TXT +2 -0
  44. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/SKILL.md +349 -0
  45. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/agents/openai.yaml +14 -0
  46. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/assets/figma-small.svg +3 -0
  47. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/assets/figma.png +0 -0
  48. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/assets/icon.svg +28 -0
  49. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/references/mapping-checklist.md +7 -0
  50. package/docs/skill-candidates/v0.0.10/figma-code-connect-components/scripts/normalize_node_id.py +25 -0
  51. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/LICENSE.TXT +2 -0
  52. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/SKILL.md +537 -0
  53. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/agents/openai.yaml +14 -0
  54. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/assets/figma-small.svg +3 -0
  55. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/assets/figma.png +0 -0
  56. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/assets/icon.svg +28 -0
  57. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/references/rule-template.md +15 -0
  58. package/docs/skill-candidates/v0.0.10/figma-create-design-system-rules/scripts/check_agents_md.sh +9 -0
  59. package/docs/skill-candidates/v0.0.10/figma-generate-design/LICENSE.TXT +2 -0
  60. package/docs/skill-candidates/v0.0.10/figma-generate-design/SKILL.md +341 -0
  61. package/docs/skill-candidates/v0.0.10/figma-generate-design/agents/openai.yaml +14 -0
  62. package/docs/skill-candidates/v0.0.10/figma-generate-design/assets/figma-small.svg +3 -0
  63. package/docs/skill-candidates/v0.0.10/figma-generate-design/assets/figma.png +0 -0
  64. package/docs/skill-candidates/v0.0.10/figma-generate-design/assets/icon.svg +28 -0
  65. package/docs/skill-candidates/v0.0.10/figma-generate-design/maintainers.yml +1 -0
  66. package/docs/skill-candidates/v0.0.10/figma-generate-library/LICENSE.TXT +2 -0
  67. package/docs/skill-candidates/v0.0.10/figma-generate-library/SKILL.md +314 -0
  68. package/docs/skill-candidates/v0.0.10/figma-generate-library/agents/openai.yaml +14 -0
  69. package/docs/skill-candidates/v0.0.10/figma-generate-library/assets/figma-small.svg +3 -0
  70. package/docs/skill-candidates/v0.0.10/figma-generate-library/assets/figma.png +0 -0
  71. package/docs/skill-candidates/v0.0.10/figma-generate-library/assets/icon.svg +28 -0
  72. package/docs/skill-candidates/v0.0.10/figma-generate-library/maintainers.yml +3 -0
  73. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/code-connect-setup.md +260 -0
  74. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/component-creation.md +1014 -0
  75. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/discovery-phase.md +518 -0
  76. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/documentation-creation.md +834 -0
  77. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/error-recovery.md +540 -0
  78. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/naming-conventions.md +527 -0
  79. package/docs/skill-candidates/v0.0.10/figma-generate-library/references/token-creation.md +962 -0
  80. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/bindVariablesToComponent.js +110 -0
  81. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/cleanupOrphans.js +127 -0
  82. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createComponentWithVariants.js +148 -0
  83. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createDocumentationPage.js +139 -0
  84. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createSemanticTokens.js +108 -0
  85. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/createVariableCollection.js +49 -0
  86. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/inspectFileStructure.js +121 -0
  87. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/rehydrateState.js +92 -0
  88. package/docs/skill-candidates/v0.0.10/figma-generate-library/scripts/validateCreation.js +83 -0
  89. package/docs/skill-candidates/v0.0.10/figma-implement-design/LICENSE.txt +2 -0
  90. package/docs/skill-candidates/v0.0.10/figma-implement-design/SKILL.md +258 -0
  91. package/docs/skill-candidates/v0.0.10/figma-implement-design/agents/openai.yaml +14 -0
  92. package/docs/skill-candidates/v0.0.10/figma-implement-design/assets/figma-small.svg +3 -0
  93. package/docs/skill-candidates/v0.0.10/figma-implement-design/assets/figma.png +0 -0
  94. package/docs/skill-candidates/v0.0.10/figma-implement-design/assets/icon.svg +28 -0
  95. package/docs/skill-candidates/v0.0.10/figma-use/LICENSE.TXT +2 -0
  96. package/docs/skill-candidates/v0.0.10/figma-use/SKILL.md +233 -0
  97. package/docs/skill-candidates/v0.0.10/figma-use/agents/openai.yaml +14 -0
  98. package/docs/skill-candidates/v0.0.10/figma-use/assets/figma-small.svg +3 -0
  99. package/docs/skill-candidates/v0.0.10/figma-use/assets/figma.png +0 -0
  100. package/docs/skill-candidates/v0.0.10/figma-use/assets/icon.svg +28 -0
  101. package/docs/skill-candidates/v0.0.10/figma-use/maintainers.yml +1 -0
  102. package/docs/skill-candidates/v0.0.10/figma-use/references/api-reference.md +301 -0
  103. package/docs/skill-candidates/v0.0.10/figma-use/references/common-patterns.md +512 -0
  104. package/docs/skill-candidates/v0.0.10/figma-use/references/component-patterns.md +488 -0
  105. package/docs/skill-candidates/v0.0.10/figma-use/references/effect-style-patterns.md +123 -0
  106. package/docs/skill-candidates/v0.0.10/figma-use/references/gotchas.md +599 -0
  107. package/docs/skill-candidates/v0.0.10/figma-use/references/maintainers.yml +12 -0
  108. package/docs/skill-candidates/v0.0.10/figma-use/references/plugin-api-patterns.md +513 -0
  109. package/docs/skill-candidates/v0.0.10/figma-use/references/plugin-api-standalone.d.ts +11293 -0
  110. package/docs/skill-candidates/v0.0.10/figma-use/references/plugin-api-standalone.index.md +441 -0
  111. package/docs/skill-candidates/v0.0.10/figma-use/references/text-style-patterns.md +203 -0
  112. package/docs/skill-candidates/v0.0.10/figma-use/references/validation-and-recovery.md +109 -0
  113. package/docs/skill-candidates/v0.0.10/figma-use/references/variable-patterns.md +354 -0
  114. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/maintainers.yml +9 -0
  115. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-components--creating.md +17 -0
  116. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-components--using.md +17 -0
  117. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-components.md +50 -0
  118. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-effect-styles.md +52 -0
  119. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-text-styles.md +90 -0
  120. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-variables--creating.md +13 -0
  121. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-variables--using.md +13 -0
  122. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds-variables.md +64 -0
  123. package/docs/skill-candidates/v0.0.10/figma-use/references/working-with-design-systems/wwds.md +41 -0
  124. package/docs/skill-candidates/v0.0.10/frontend-design/LICENSE.txt +177 -0
  125. package/docs/skill-candidates/v0.0.10/frontend-design/SKILL.md +55 -0
  126. package/docs/skill-candidates/v0.0.10/frontend-ui-ux-systems/SKILL.md +32 -0
  127. package/docs/skill-candidates/v0.0.10/github/SKILL.md +74 -0
  128. package/docs/skill-candidates/v0.0.10/github/agents/openai.yaml +6 -0
  129. package/docs/skill-candidates/v0.0.10/github/assets/github-small.svg +3 -0
  130. package/docs/skill-candidates/v0.0.10/github/assets/github.png +0 -0
  131. package/docs/skill-candidates/v0.0.10/image-graphic-design-rendering/SKILL.md +28 -0
  132. package/docs/skill-candidates/v0.0.10/language-quality-pt-en-fr-it-ru/SKILL.md +28 -0
  133. package/docs/skill-candidates/v0.0.10/math-physics-reasoning/SKILL.md +28 -0
  134. package/docs/skill-candidates/v0.0.10/mcp-builder/LICENSE.txt +202 -0
  135. package/docs/skill-candidates/v0.0.10/mcp-builder/SKILL.md +236 -0
  136. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/evaluation.md +602 -0
  137. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/mcp_best_practices.md +249 -0
  138. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/node_mcp_server.md +970 -0
  139. package/docs/skill-candidates/v0.0.10/mcp-builder/reference/python_mcp_server.md +719 -0
  140. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/connections.py +151 -0
  141. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/evaluation.py +373 -0
  142. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/example_evaluation.xml +22 -0
  143. package/docs/skill-candidates/v0.0.10/mcp-builder/scripts/requirements.txt +2 -0
  144. package/docs/skill-candidates/v0.0.10/mcp-client-readiness/SKILL.md +31 -0
  145. package/docs/skill-candidates/v0.0.10/openai-docs/LICENSE.txt +201 -0
  146. package/docs/skill-candidates/v0.0.10/openai-docs/SKILL.md +161 -0
  147. package/docs/skill-candidates/v0.0.10/openai-docs/agents/openai.yaml +14 -0
  148. package/docs/skill-candidates/v0.0.10/openai-docs/assets/openai-small.svg +3 -0
  149. package/docs/skill-candidates/v0.0.10/openai-docs/assets/openai.png +0 -0
  150. package/docs/skill-candidates/v0.0.10/openai-docs/references/latest-model.md +37 -0
  151. package/docs/skill-candidates/v0.0.10/openai-docs/references/prompting-guide.md +244 -0
  152. package/docs/skill-candidates/v0.0.10/openai-docs/references/upgrade-guide.md +181 -0
  153. package/docs/skill-candidates/v0.0.10/openai-docs/scripts/fetch-codex-manual.mjs +598 -0
  154. package/docs/skill-candidates/v0.0.10/openai-docs/scripts/resolve-latest-model-info.js +147 -0
  155. package/docs/skill-candidates/v0.0.10/playwright/LICENSE.txt +201 -0
  156. package/docs/skill-candidates/v0.0.10/playwright/NOTICE.txt +14 -0
  157. package/docs/skill-candidates/v0.0.10/playwright/SKILL.md +147 -0
  158. package/docs/skill-candidates/v0.0.10/playwright/agents/openai.yaml +6 -0
  159. package/docs/skill-candidates/v0.0.10/playwright/assets/playwright-small.svg +3 -0
  160. package/docs/skill-candidates/v0.0.10/playwright/assets/playwright.png +0 -0
  161. package/docs/skill-candidates/v0.0.10/playwright/references/cli.md +116 -0
  162. package/docs/skill-candidates/v0.0.10/playwright/references/workflows.md +95 -0
  163. package/docs/skill-candidates/v0.0.10/playwright/scripts/playwright_cli.sh +25 -0
  164. package/docs/skill-candidates/v0.0.10/polyglot-backend-engineering/SKILL.md +32 -0
  165. package/docs/skill-candidates/v0.0.10/screenshot/LICENSE.txt +201 -0
  166. package/docs/skill-candidates/v0.0.10/screenshot/SKILL.md +267 -0
  167. package/docs/skill-candidates/v0.0.10/screenshot/agents/openai.yaml +6 -0
  168. package/docs/skill-candidates/v0.0.10/screenshot/assets/screenshot-small.svg +5 -0
  169. package/docs/skill-candidates/v0.0.10/screenshot/assets/screenshot.png +0 -0
  170. package/docs/skill-candidates/v0.0.10/screenshot/scripts/ensure_macos_permissions.sh +54 -0
  171. package/docs/skill-candidates/v0.0.10/screenshot/scripts/macos_display_info.swift +22 -0
  172. package/docs/skill-candidates/v0.0.10/screenshot/scripts/macos_permissions.swift +40 -0
  173. package/docs/skill-candidates/v0.0.10/screenshot/scripts/macos_window_info.swift +126 -0
  174. package/docs/skill-candidates/v0.0.10/screenshot/scripts/take_screenshot.ps1 +163 -0
  175. package/docs/skill-candidates/v0.0.10/screenshot/scripts/take_screenshot.py +585 -0
  176. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/SKILL.md +62 -0
  177. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/agents/openai.yaml +4 -0
  178. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/references/activation-policy.md +77 -0
  179. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/references/human-approval-policy.md +83 -0
  180. package/docs/skill-candidates/v0.0.10/skill-master-orchestrator/references/persona-dev-senior-master.md +46 -0
  181. package/docs/skill-candidates/v0.0.10/terminal-menu-operations/SKILL.md +30 -0
  182. package/docs/skill-candidates/v0.0.10/terminal-pixel-art-tui/SKILL.md +43 -0
  183. package/docs/skill-candidates/v0.0.10/webapp-testing/LICENSE.txt +202 -0
  184. package/docs/skill-candidates/v0.0.10/webapp-testing/SKILL.md +96 -0
  185. package/docs/skill-candidates/v0.0.10/webapp-testing/examples/console_logging.py +35 -0
  186. package/docs/skill-candidates/v0.0.10/webapp-testing/examples/element_discovery.py +40 -0
  187. package/docs/skill-candidates/v0.0.10/webapp-testing/examples/static_html_automation.py +33 -0
  188. package/docs/skill-candidates/v0.0.10/webapp-testing/scripts/with_server.py +106 -0
  189. package/docs/skill-candidates/v0.0.10/winui-app/LICENSE.txt +202 -0
  190. package/docs/skill-candidates/v0.0.10/winui-app/SKILL.md +94 -0
  191. package/docs/skill-candidates/v0.0.10/winui-app/agents/openai.yaml +5 -0
  192. package/docs/skill-candidates/v0.0.10/winui-app/assets/winui.png +0 -0
  193. package/docs/skill-candidates/v0.0.10/winui-app/config.yaml +50 -0
  194. package/docs/skill-candidates/v0.0.10/winui-app/references/_sections.md +96 -0
  195. package/docs/skill-candidates/v0.0.10/winui-app/references/accessibility-input-and-localization.md +51 -0
  196. package/docs/skill-candidates/v0.0.10/winui-app/references/build-run-and-launch-verification.md +72 -0
  197. package/docs/skill-candidates/v0.0.10/winui-app/references/community-toolkit-controls-and-helpers.md +57 -0
  198. package/docs/skill-candidates/v0.0.10/winui-app/references/controls-layout-and-adaptive-ui.md +84 -0
  199. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-environment-audit-and-remediation.md +82 -0
  200. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-setup-and-project-selection.md +67 -0
  201. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-template-first-recovery.md +62 -0
  202. package/docs/skill-candidates/v0.0.10/winui-app/references/foundation-winui-app-structure.md +62 -0
  203. package/docs/skill-candidates/v0.0.10/winui-app/references/motion-animations-and-polish.md +45 -0
  204. package/docs/skill-candidates/v0.0.10/winui-app/references/performance-diagnostics-and-responsiveness.md +46 -0
  205. package/docs/skill-candidates/v0.0.10/winui-app/references/sample-source-map.md +37 -0
  206. package/docs/skill-candidates/v0.0.10/winui-app/references/shell-navigation-and-windowing.md +67 -0
  207. package/docs/skill-candidates/v0.0.10/winui-app/references/styling-theming-materials-and-icons.md +71 -0
  208. package/docs/skill-candidates/v0.0.10/winui-app/references/testing-debugging-and-review-checklists.md +77 -0
  209. package/docs/skill-candidates/v0.0.10/winui-app/references/windows-app-sdk-lifecycle-notifications-and-deployment.md +52 -0
  210. package/docs/skill-candidates/v0.0.9/ai-ethics-human-dignity/SKILL.md +32 -0
  211. package/docs/skill-candidates/v0.0.9/broad-domain-router/SKILL.md +41 -0
  212. package/docs/skill-candidates/v0.0.9/catholic-moral-discernment/SKILL.md +31 -0
  213. package/docs/skill-candidates/v0.0.9/engineering-systems-master/SKILL.md +31 -0
  214. package/docs/skill-candidates/v0.0.9/language-quality-pt-en-fr/SKILL.md +28 -0
  215. package/docs/skill-candidates/v0.0.9/math-science-reasoning/SKILL.md +29 -0
  216. package/docs/skill-candidates/v0.0.9/philosophy-sociology-discernment/SKILL.md +28 -0
  217. package/docs/skill-candidates/v0.0.9/professional-boundary-triage/SKILL.md +40 -0
  218. package/docs/skill-candidates/v0.0.9/release-ethics-gate/SKILL.md +32 -0
  219. package/docs/skill-candidates/v0.0.9/source-authority-reviewer/SKILL.md +31 -0
  220. package/manifests/channels/beta.json +7 -7
  221. package/manifests/channels/stable.json +8 -8
  222. package/network/unapproved-skill-candidates.json +34 -1
  223. package/package.json +7 -1
@@ -0,0 +1,441 @@
1
+ # Plugin API Index
2
+
3
+ > Full typings: `plugin-api-standalone.d.ts` (11,292 lines)
4
+ > Grep by symbol name to jump to definition. All `L#` line numbers refer to that file.
5
+
6
+ ---
7
+
8
+ ## figma.\* — PluginAPI (L24)
9
+
10
+ ### Identity & State
11
+
12
+ | Member | Type |
13
+ | ------------------------------- | -------------------------------------------------------------------------------- |
14
+ | `apiVersion` | `'1.0.0'` |
15
+ | `editorType` | `'figma' \| 'figjam' \| 'dev' \| 'slides' \| 'buzz'` |
16
+ | `mode` | `'default' \| 'textreview' \| 'inspect' \| 'codegen' \| 'linkpreview' \| 'auth'` |
17
+ | `fileKey` | `string \| undefined` |
18
+ | `root` | `DocumentNode` |
19
+ | `currentPage` | `PageNode` — assign via `setCurrentPageAsync` |
20
+ | `currentUser` | `User \| null` |
21
+ | `mixed` | `unique symbol` — sentinel for mixed values in selection |
22
+ | `skipInvisibleInstanceChildren` | `boolean` |
23
+
24
+ ### Navigation & Lookup
25
+
26
+ | Method | Returns |
27
+ | --------------------------- | ------------------------------------------------------- |
28
+ | `setCurrentPageAsync(page)` | `Promise<void>` — **MUST use this**; sync setter throws |
29
+ | `getNodeByIdAsync(id)` | `Promise<BaseNode \| null>` |
30
+ | `getNodeById(id)` | `BaseNode \| null` |
31
+ | `getStyleByIdAsync(id)` | `Promise<BaseStyle \| null>` |
32
+ | `getStyleById(id)` | `BaseStyle \| null` |
33
+
34
+ ### Create Nodes
35
+
36
+ | Method | Returns |
37
+ | ----------------------------------- | --------------------------- |
38
+ | `createFrame()` | `FrameNode` |
39
+ | `createComponent()` | `ComponentNode` |
40
+ | `createComponentFromNode(node)` | `ComponentNode` |
41
+ | `createRectangle()` | `RectangleNode` |
42
+ | `createEllipse()` | `EllipseNode` |
43
+ | `createLine()` | `LineNode` |
44
+ | `createPolygon()` | `PolygonNode` |
45
+ | `createStar()` | `StarNode` |
46
+ | `createVector()` | `VectorNode` |
47
+ | `createText()` | `TextNode` |
48
+ | `createSection()` | `SectionNode` |
49
+ | `createPage()` | `PageNode` |
50
+ | `createSlice()` | `SliceNode` |
51
+ | `createBooleanOperation()` | `BooleanOperationNode` |
52
+ | `createTable(rows?, cols?)` | `TableNode` |
53
+ | `createImage(data: Uint8Array)` | `Image` |
54
+ | `createNodeFromSvg(svg)` | `FrameNode` |
55
+ | `createNodeFromJSXAsync(jsx)` | `Promise<SceneNode>` |
56
+ | `importComponentByKeyAsync(key)` | `Promise<ComponentNode>` |
57
+ | `importComponentSetByKeyAsync(key)` | `Promise<ComponentSetNode>` |
58
+ | `importStyleByKeyAsync(key)` | `Promise<BaseStyle>` |
59
+
60
+ ### Styles (Local)
61
+
62
+ | Method | Returns |
63
+ | ---------------------------------- | --------------- |
64
+ | `createPaintStyle()` | `PaintStyle` |
65
+ | `createTextStyle()` | `TextStyle` |
66
+ | `createEffectStyle()` | `EffectStyle` |
67
+ | `createGridStyle()` | `GridStyle` |
68
+ | `getLocalPaintStyles()` / `Async` | `PaintStyle[]` |
69
+ | `getLocalTextStyles()` / `Async` | `TextStyle[]` |
70
+ | `getLocalEffectStyles()` / `Async` | `EffectStyle[]` |
71
+ | `getLocalGridStyles()` / `Async` | `GridStyle[]` |
72
+
73
+ ### Fonts
74
+
75
+ | Method | Notes |
76
+ | --------------------------- | ---------------------------------- |
77
+ | `loadFontAsync(fontName)` | **MUST call before any text edit** |
78
+ | `listAvailableFontsAsync()` | `Promise<Font[]>` |
79
+ | `hasMissingFont` | `boolean` |
80
+
81
+ ### Plugin Lifecycle
82
+
83
+ | Method | Notes |
84
+ | --------------------------------------- | ------------------------------------------------------------ |
85
+ | `closePlugin(message?)` | **MUST call on success paths** |
86
+ | `closePluginWithFailure(message?)` | **MUST call in catch blocks — never use closePlugin for errors** |
87
+ | `commitUndo()` | Snapshot to undo history |
88
+ | `triggerUndo()` | Revert to last snapshot |
89
+ | `saveVersionHistoryAsync(title, desc?)` | `Promise<VersionHistoryResult>` |
90
+ | `notify(message, options?)` | **throws "not implemented" in use_figma — do not use** |
91
+ | `openExternal(url)` | Opens URL in browser |
92
+
93
+ ### Sub-APIs (properties on figma)
94
+
95
+ | Property | Interface | L# |
96
+ | --------------------- | ------------------------ | ----- |
97
+ | `figma.variables` | `VariablesAPI` | L2016 |
98
+ | `figma.ui` | `UIAPI` | L2604 |
99
+ | `figma.util` | `UtilAPI` | L2691 |
100
+ | `figma.constants` | `ConstantsAPI` | L2809 |
101
+ | `figma.clientStorage` | `ClientStorageAPI` | L2531 |
102
+ | `figma.viewport` | `ViewportAPI` | L3086 |
103
+ | `figma.parameters` | `ParametersAPI` | L3292 |
104
+ | `figma.teamLibrary` | `TeamLibraryAPI` | L2372 |
105
+ | `figma.annotations` | `AnnotationsAPI` | L2187 |
106
+ | `figma.codegen` | `CodegenAPI` | L2871 |
107
+ | `figma.textreview?` | `TextReviewAPI` | L3166 |
108
+ | `figma.payments?` | `PaymentsAPI` | L2420 |
109
+ | `figma.buzz` | `BuzzAPI` | L2211 |
110
+ | `figma.timer?` | `TimerAPI` (FigJam only) | L3053 |
111
+
112
+ ---
113
+
114
+ ## VariablesAPI — figma.variables (L2016)
115
+
116
+ ```
117
+ getVariableById(id) Variable | null
118
+ getVariableByIdAsync(id) Promise<Variable | null>
119
+ getVariableCollectionById(id) VariableCollection | null
120
+ getVariableCollectionByIdAsync(id) Promise<VariableCollection | null>
121
+ getLocalVariables(type?) Variable[] ← sync works; filter by VariableResolvedDataType
122
+ getLocalVariablesAsync(type?) Promise<Variable[]>
123
+ getLocalVariableCollections() VariableCollection[] ← sync works
124
+ getLocalVariableCollectionsAsync() Promise<VariableCollection[]> ← may not be available; use sync
125
+ createVariable(name, collection, type) Variable
126
+ createVariableCollection(name) VariableCollection
127
+ createVariableAlias(variable) VariableAlias
128
+ importVariableByKeyAsync(key) Promise<Variable>
129
+ setBoundVariableForPaint(paint, field, variable) → returns NEW paint — reassign
130
+ setBoundVariableForEffect(effect, field, variable) → returns NEW effect — reassign
131
+ setBoundVariableForLayoutGrid(grid, field, variable)
132
+ ```
133
+
134
+ **Variable (L10204):** `name`, `resolvedType`, `codeSyntax`, `scopes`, `hiddenFromPublishing`, `valuesByMode`, `variableCollectionId`
135
+
136
+ - `setVariableCodeSyntax(platform, value)` — platform: `'WEB' | 'ANDROID' | 'iOS'`
137
+ - `setValueForMode(collectionId, modeId, value)`
138
+ - `remove()`
139
+
140
+ **VariableCollection (L10418):** `name`, `modes`, `variableIds`, `defaultModeId`, `hiddenFromPublishing`
141
+
142
+ - `addMode(name)` → `modeId`; `removeMode(modeId)`; `renameMode(modeId, name)`
143
+
144
+ ---
145
+
146
+ ## Node Types
147
+
148
+ ### Concrete Scene Nodes
149
+
150
+ | Node | L# | Key characteristics |
151
+ | ---------------------- | ------ | -------------------------------------------------- |
152
+ | `DocumentNode` | L8960 | Root; `children: PageNode[]` |
153
+ | `PageNode` | L9119 | `children`, local styles, `backgrounds` |
154
+ | `FrameNode` | L9311 | `DefaultFrameMixin` — auto-layout, clips, children |
155
+ | `GroupNode` | L9321 | Children only, no auto-layout |
156
+ | `ComponentNode` | L9678 | Like Frame + publishable |
157
+ | `ComponentSetNode` | L9653 | Variant set container |
158
+ | `InstanceNode` | L9719 | Like Frame; `mainComponent`, `detach()` |
159
+ | `RectangleNode` | L9378 | `DefaultShapeMixin` + corners |
160
+ | `EllipseNode` | L9410 | + `arcData` |
161
+ | `LineNode` | L9396 | |
162
+ | `PolygonNode` | L9430 | |
163
+ | `StarNode` | L9450 | |
164
+ | `VectorNode` | L9476 | Vector paths |
165
+ | `TextNode` | L9493 | Rich text, fonts, segments |
166
+ | `TextPathNode` | L9564 | Text along path |
167
+ | `BooleanOperationNode` | L9792 | `booleanOperation` property |
168
+ | `SliceNode` | L9368 | Export only |
169
+ | `SectionNode` | L10754 | Grouping + fills |
170
+ | `TableNode` | L9862 | `TableCellNode` children |
171
+
172
+ **FigJam only:** `StickyNode` L9812, `ConnectorNode` L10121, `ShapeWithTextNode` L9999, `StampNode` L9838, `CodeBlockNode` L10080, `EmbedNode` L10661, `LinkUnfurlNode` L10701, `MediaNode` L10721
173
+
174
+ **Slides only:** `SlideNode` L10784, `SlideRowNode` L10809, `SlideGridNode` L10822
175
+
176
+ **Union types:**
177
+
178
+ ```
179
+ type SceneNode (L10917) = FrameNode | GroupNode | SliceNode | RectangleNode | LineNode
180
+ | EllipseNode | PolygonNode | StarNode | VectorNode | TextNode | ComponentSetNode
181
+ | ComponentNode | InstanceNode | BooleanOperationNode | SectionNode | ...
182
+ type BaseNode (L10913) = DocumentNode | PageNode | SceneNode
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Mixin Interfaces
188
+
189
+ | Mixin | L# | Provides |
190
+ | ---------------------------- | ----- | ----------------------------------------------------------------------------------------------- |
191
+ | `BaseNodeMixin` | L5284 | `id`, `name`, `type`, `parent`, `remove()`, plugin data |
192
+ | `SceneNodeMixin` | L5561 | `visible`, `locked`, `opacity`, variable bindings |
193
+ | `ChildrenMixin` | L5773 | `children`, `appendChild()`, `insertChild()`, `findAll()`, `findOne()`, `findAllWithCriteria()` |
194
+ | `LayoutMixin` | L6135 | `x`, `y`, `width`, `height`, `rotation`, `resize()`, `rescale()` |
195
+ | `AutoLayoutMixin` | L6436 | `layoutMode`, axis alignment, padding, `itemSpacing`, `layoutSizingHorizontal/Vertical` |
196
+ | `AutoLayoutChildrenMixin` | L7064 | `layoutAlign`, `layoutGrow`, sizing — **set AFTER `appendChild()`** |
197
+ | `GridLayoutMixin` | L6939 | CSS Grid tracks, gap, template |
198
+ | `GridChildrenMixin` | L7127 | grid child positioning |
199
+ | `GeometryMixin` | L7485 | `fills`, `strokes`, `strokeWeight`, `strokeAlign` |
200
+ | `MinimalFillsMixin` | L7328 | `fills` only |
201
+ | `MinimalStrokesMixin` | L7246 | `strokes`, `strokeWeight` |
202
+ | `BlendMixin` | L6339 | `opacity`, `blendMode`, `isMask`, `effects` |
203
+ | `CornerMixin` | L7537 | `cornerRadius`, `cornerSmoothing` |
204
+ | `RectangleCornerMixin` | L7560 | Per-corner radii |
205
+ | `ExportMixin` | L7577 | `exportSettings`, `exportAsync()` |
206
+ | `ReactionMixin` | L7704 | `reactions` (prototyping) |
207
+ | `PublishableMixin` | L7875 | `description`, `key`, `getPublishStatusAsync()` |
208
+ | `VariantMixin` | L8182 | `variantProperties` |
209
+ | `ComponentPropertiesMixin` | L8229 | `componentProperties`, `addComponentProperty()` |
210
+ | `PluginDataMixin` | L5443 | `getPluginData()`, `setPluginData()`, `getSharedPluginData()` |
211
+ | `FramePrototypingMixin` | L7651 | `overflowDirection`, `numberOfFixedChildren` |
212
+ | `BaseFrameMixin` | L7939 | ChildrenMixin + LayoutMixin + AutoLayoutMixin + GeometryMixin + … |
213
+ | `DefaultFrameMixin` | L7997 | BaseFrameMixin + FramePrototypingMixin + ReactionMixin |
214
+ | `DefaultShapeMixin` | L7928 | BlendMixin + GeometryMixin + LayoutMixin + ExportMixin + ReactionMixin |
215
+ | `ExplicitVariableModesMixin` | L9084 | `setExplicitVariableModeForCollection()` |
216
+
217
+ ---
218
+
219
+ ## Paint & Fill (L4302)
220
+
221
+ | Type | L# | Notes |
222
+ | --------------- | ----- | --------------------------------------------------------------------------------- |
223
+ | `SolidPaint` | L4302 | `type:'SOLID'`, `color: RGB`, `opacity`, `visible`, `blendMode` |
224
+ | `GradientPaint` | L4357 | `type: 'GRADIENT_LINEAR\|RADIAL\|ANGULAR\|DIAMOND'`, `gradientStops: ColorStop[]` |
225
+ | `ImagePaint` | L4377 | `type:'IMAGE'`, `imageHash`, `scaleMode` |
226
+ | `VideoPaint` | L4413 | `type:'VIDEO'` |
227
+ | `PatternPaint` | L4449 | `type:'PATTERN'` |
228
+ | `type Paint` | L4481 | Union of all five |
229
+ | `ColorStop` | L4271 | `{ position: number, color: RGBA }` |
230
+ | `ImageFilters` | L4290 | exposure, contrast, saturation, etc. |
231
+
232
+ > **CRITICAL**: Fills/strokes are **read-only arrays** — clone, modify, reassign.
233
+
234
+ ---
235
+
236
+ ## Effects (L3966)
237
+
238
+ | Type | L# |
239
+ | ---------------------------------- | ----- |
240
+ | `DropShadowEffect` | L3966 |
241
+ | `InnerShadowEffect` | L4009 |
242
+ | `BlurEffect` (Normal/Progressive) | L4048 |
243
+ | `NoiseEffect` (Mono/Duo/Multitone) | L4105 |
244
+ | `TextureEffect` | L4180 |
245
+ | `GlassEffect` | L4209 |
246
+ | `type Effect` | L4250 |
247
+
248
+ ---
249
+
250
+ ## Typography
251
+
252
+ | Type | L# | Notes |
253
+ | ------------------- | ----- | -------------------------------------------------------------------------------------- |
254
+ | `FontName` | L3697 | `{ family: string, style: string }` |
255
+ | `TextNode` | L9493 | `characters`, `textAlignHorizontal`, `fontSize`, `fontName`, `getStyledTextSegments()` |
256
+ | `StyledTextSegment` | L4882 | Per-range text properties |
257
+ | `LetterSpacing` | L4826 | `{ value, unit: 'PIXELS'\|'PERCENT' }` |
258
+ | `LineHeight` | L4830 | `{ value, unit } \| { unit: 'AUTO' }` |
259
+ | `TextCase` | L3701 | `'ORIGINAL'\|'UPPER'\|'LOWER'\|'TITLE'\|'SMALL_CAPS'` |
260
+ | `TextDecoration` | L3702 | `'NONE'\|'UNDERLINE'\|'STRIKETHROUGH'` |
261
+ | `OpenTypeFeature` | L3728 | Ligatures, numerals, etc. |
262
+
263
+ ---
264
+
265
+ ## Variables & Bindings
266
+
267
+ | Type | L# | Notes |
268
+ | ----------------------------- | ------ | ------------------------------------------------------------- |
269
+ | `Variable` | L10204 | Core variable object |
270
+ | `VariableCollection` | L10418 | Collection of variables + modes |
271
+ | `VariableAlias` | L10172 | Reference to another variable |
272
+ | `VariableValue` | L10176 | `boolean \| string \| number \| RGB \| RGBA \| VariableAlias` |
273
+ | `VariableResolvedDataType` | L10171 | `'BOOLEAN' \| 'COLOR' \| 'FLOAT' \| 'STRING'` |
274
+ | `VariableDataType` | L5023 | Includes `'VARIABLE_ALIAS' \| 'EXPRESSION'` |
275
+ | `VariableScope` | L10177 | Where variable can be applied |
276
+ | `CodeSyntaxPlatform` | L10203 | `'WEB' \| 'ANDROID' \| 'iOS'` |
277
+ | `VariableBindableNodeField` | L5712 | Node fields that accept variable binding |
278
+ | `VariableBindableTextField` | L5739 | Text-specific bindable fields |
279
+ | `VariableBindablePaintField` | L5748 | `'color'` |
280
+ | `VariableBindableEffectField` | L5751 | `'color'\|'radius'\|'spread'\|'offsetX'\|'offsetY'` |
281
+
282
+ ---
283
+
284
+ ## Styles
285
+
286
+ | Interface | L# | Notes |
287
+ | ---------------- | ------ | ------------------------------------------------------ |
288
+ | `BaseStyleMixin` | L10977 | `name`, `id`, `key`, `type`, `description`, `remove()` |
289
+ | `PaintStyle` | L11002 | `type:'PAINT'`, `paints: Paint[]` |
290
+ | `TextStyle` | L11018 | `type:'TEXT'`, font properties |
291
+ | `EffectStyle` | L11087 | `type:'EFFECT'`, `effects: Effect[]` |
292
+ | `GridStyle` | L11103 | `type:'GRID'`, `layoutGrids` |
293
+ | `type BaseStyle` | L11119 | Union of all four |
294
+ | `type StyleType` | L10955 | `'PAINT' \| 'TEXT' \| 'EFFECT' \| 'GRID'` |
295
+
296
+ ---
297
+
298
+ ## Primitives & Geometry
299
+
300
+ | Type | L# | Shape |
301
+ | ---------------- | ----- | --------------------------------------------- |
302
+ | `Vector` | L3667 | `{ x: number, y: number }` |
303
+ | `Rect` | L3671 | `{ x, y, width, height }` |
304
+ | `RGB` | L3680 | `{ r, g, b }` — **0–1 range, not 0–255** |
305
+ | `RGBA` | L3688 | `{ r, g, b, a }` — **0–1 range** |
306
+ | `Transform` | L3666 | `[[a,b,tx],[c,d,ty]]` 2×3 affine matrix |
307
+ | `ArcData` | L3958 | `{ startingAngle, endingAngle, innerRadius }` |
308
+ | `Constraints` | L4264 | `{ horizontal, vertical }: ConstraintType` |
309
+ | `ConstraintType` | L4260 | `'MIN'\|'CENTER'\|'MAX'\|'STRETCH'\|'SCALE'` |
310
+ | `VectorPath` | L4792 | `{ windingRule, data: string }` |
311
+ | `VectorNetwork` | L4775 | vertices + segments + regions |
312
+ | `Guide` | L4482 | `{ axis, offset }` |
313
+
314
+ ---
315
+
316
+ ## Prototyping
317
+
318
+ | Type | L# | Notes |
319
+ | --------------------- | ----- | --------------------------------------------------------- |
320
+ | `Reaction` | L5015 | trigger + action pair |
321
+ | `Trigger` | L5146 | what initiates the reaction |
322
+ | `Action` | L5064 | what happens |
323
+ | `Transition` | L5145 | `SimpleTransition \| DirectionalTransition` |
324
+ | `Easing` | L5182 | easing curve definition |
325
+ | `Navigation` | L5178 | `'NAVIGATE'\|'SWAP'\|'OVERLAY'\|'SCROLL_TO'\|'CHANGE_TO'` |
326
+ | `OverflowDirection` | L5215 | `'NONE'\|'HORIZONTAL'\|'VERTICAL'\|'BOTH'` |
327
+ | `OverlayPositionType` | L5219 | overlay placement |
328
+
329
+ ---
330
+
331
+ ## Events & Changes
332
+
333
+ | Type | L# | Notes |
334
+ | --------------------- | ----- | --------------------------------------------------------------- |
335
+ | `ArgFreeEventType` | L11 | `'selectionchange'\|'currentpagechange'\|'close'\|timer events` |
336
+ | `RunEvent` | L3321 | plugin run with parameters |
337
+ | `DropEvent` | L3339 | drag-and-drop |
338
+ | `DocumentChangeEvent` | L3359 | any document change |
339
+ | `NodeChangeEvent` | L3626 | node property changes |
340
+ | `NodeChangeProperty` | L3499 | all watchable property names |
341
+ | `StyleChangeEvent` | L3365 | style create/delete/update |
342
+ | `DocumentChange` | L3489 | `CreateChange \| DeleteChange \| PropertyChange` |
343
+ | `TextReviewEvent` | L3657 | text review mode |
344
+
345
+ ---
346
+
347
+ ## Export
348
+
349
+ | Type | L# | Notes |
350
+ | --------------------------- | ----- | --------------------------------------------- |
351
+ | `ExportSettingsImage` | L4561 | PNG/JPG/WEBP/BMP |
352
+ | `ExportSettingsSVG` | L4634 | |
353
+ | `ExportSettingsPDF` | L4653 | |
354
+ | `ExportSettingsREST` | L4667 | |
355
+ | `ExportSettingsConstraints` | L4554 | `{ type: 'SCALE'\|'WIDTH'\|'HEIGHT', value }` |
356
+
357
+ ---
358
+
359
+ ## Key Sub-API Surfaces
360
+
361
+ **ClientStorageAPI (L2531):** `getAsync(key)`, `setAsync(key, value)`, `keysAsync()`, `deleteAsync(key)`
362
+
363
+ **ViewportAPI (L3086):** `center: Vector`, `zoom: number`, `scrollAndZoomIntoView(nodes)`, `bounds: Rect`
364
+
365
+ **UtilAPI (L2691):** `solidPaint(hex, opacity?)`, `rgba(r,g,b,a?)`, `rgb(r,g,b)`, `colorToHex(color)`, `loadImageAsync(url)`, `clone(val)`
366
+
367
+ **TeamLibraryAPI (L2372):** `getAvailableLibraryVariableCollectionsAsync()`, `importVariableByKeyAsync(key)`
368
+
369
+ **Image (L11120):** `hash`, `getBytesAsync()`, `getSizeAsync()`
370
+
371
+ ---
372
+
373
+ ## All Symbols (flat — grep these against the .d.ts file)
374
+
375
+ To find any symbol: `grep -n "^interface Foo\|^type Foo\|^declare type Foo" plugin-api-standalone.d.ts`
376
+
377
+ ```
378
+ PluginAPI VariablesAPI AnnotationsAPI TeamLibraryAPI
379
+ UIAPI UtilAPI ViewportAPI ClientStorageAPI
380
+ ConstantsAPI CodegenAPI PaymentsAPI TextReviewAPI
381
+ ParametersAPI TimerAPI BuzzAPI DevResourcesAPI
382
+
383
+ DocumentNode PageNode FrameNode GroupNode
384
+ ComponentNode ComponentSetNode InstanceNode RectangleNode
385
+ EllipseNode LineNode PolygonNode StarNode
386
+ VectorNode TextNode TextPathNode BooleanOperationNode
387
+ SliceNode SectionNode TableNode TableCellNode
388
+ StickyNode ConnectorNode ShapeWithTextNode StampNode
389
+ CodeBlockNode EmbedNode LinkUnfurlNode MediaNode
390
+ WidgetNode SlideNode SlideRowNode SlideGridNode
391
+ TransformGroupNode HighlightNode WashiTapeNode
392
+
393
+ BaseNodeMixin SceneNodeMixin ChildrenMixin LayoutMixin
394
+ AutoLayoutMixin AutoLayoutChildrenMixin GridLayoutMixin GridChildrenMixin
395
+ GeometryMixin MinimalFillsMixin MinimalStrokesMixin BlendMixin
396
+ MinimalBlendMixin CornerMixin RectangleCornerMixin ExportMixin
397
+ ReactionMixin PublishableMixin VariantMixin ComponentPropertiesMixin
398
+ PluginDataMixin DevResourcesMixin DevStatusMixin StickableMixin
399
+ ConstraintMixin DimensionAndPositionMixin AspectRatioLockMixin FramePrototypingMixin
400
+ BaseFrameMixin DefaultFrameMixin DefaultShapeMixin OpaqueNodeMixin
401
+ VectorLikeMixin ComplexStrokesMixin IndividualStrokesMixin ContainerMixin
402
+ AnnotationsMixin MeasurementsMixin ExplicitVariableModesMixin
403
+
404
+ Variable VariableCollection VariableAlias ExtendedVariableCollection
405
+ LibraryVariableCollection LibraryVariable
406
+ VariableValue VariableResolvedDataType VariableDataType VariableScope
407
+ CodeSyntaxPlatform VariableBindableNodeField VariableBindableTextField
408
+ VariableBindablePaintField VariableBindableEffectField VariableBindableLayoutGridField
409
+
410
+ SolidPaint GradientPaint ImagePaint VideoPaint
411
+ PatternPaint Paint ColorStop ImageFilters
412
+ DropShadowEffect InnerShadowEffect BlurEffect NoiseEffect
413
+ TextureEffect GlassEffect Effect
414
+ LayoutGrid RowsColsLayoutGrid GridLayoutGrid
415
+
416
+ PaintStyle TextStyle EffectStyle GridStyle
417
+ BaseStyle BaseStyleMixin StyleType
418
+
419
+ FontName Font LetterSpacing LineHeight
420
+ TextCase TextDecoration TextDecorationStyle FontStyle
421
+ OpenTypeFeature StyledTextSegment LeadingTrim
422
+
423
+ Vector Rect RGB RGBA
424
+ Transform ArcData Constraints ConstraintType
425
+ VectorPath VectorNetwork VectorVertex VectorSegment
426
+ VectorRegion Guide BlendMode MaskType
427
+
428
+ Reaction Trigger Action Transition
429
+ Easing Navigation OverflowDirection OverlayPositionType
430
+ OverlayBackground PublishStatus
431
+
432
+ ArgFreeEventType RunEvent DropEvent DocumentChangeEvent
433
+ NodeChangeEvent NodeChangeProperty StyleChangeEvent DocumentChange
434
+ TextReviewEvent SlidesViewChangeEvent CanvasViewChangeEvent
435
+
436
+ ExportSettingsImage ExportSettingsSVG ExportSettingsPDF ExportSettingsREST
437
+ ExportSettingsConstraints
438
+
439
+ User ActiveUser BaseUser Image
440
+ Video VersionHistoryResult FindAllCriteria
441
+ ```
@@ -0,0 +1,203 @@
1
+ # Text Style API Patterns
2
+
3
+ > Part of the [use_figma skill](../SKILL.md). How to create, apply, and inspect text styles using the Plugin API.
4
+ >
5
+ > For design system context (when to create text styles, how they relate to tokens, headless limitations), see [wwds-text-styles](working-with-design-systems/wwds-text-styles.md).
6
+
7
+ ## Contents
8
+
9
+ - Listing Text Styles
10
+ - Creating a Text Style
11
+ - Probing Font Styles
12
+ - Creating a Type Ramp (Multi-Step)
13
+ - Applying Text Styles to Nodes
14
+
15
+ ## Listing Text Styles
16
+
17
+ ```javascript
18
+ /**
19
+ * Lists all local text styles with their key properties.
20
+ *
21
+ * @returns {Promise<Array<{id: string, name: string, key: string, fontSize: number, fontName: FontName, lineHeight: LineHeight, letterSpacing: LetterSpacing}>>}
22
+ */
23
+ async function listTextStyles() {
24
+ const styles = await figma.getLocalTextStylesAsync();
25
+ return styles.map(s => ({
26
+ id: s.id,
27
+ name: s.name,
28
+ key: s.key,
29
+ fontSize: s.fontSize,
30
+ fontName: s.fontName,
31
+ lineHeight: s.lineHeight,
32
+ letterSpacing: s.letterSpacing
33
+ }));
34
+ }
35
+ ```
36
+
37
+ Full runnable script:
38
+
39
+ ```javascript
40
+ (async () => {
41
+ try {
42
+ const results = await listTextStyles();
43
+ figma.closePlugin(JSON.stringify(results));
44
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
45
+ })()
46
+ ```
47
+
48
+ ## Creating a Text Style
49
+
50
+ Font **MUST** be loaded before setting `fontName`. `lineHeight` and `letterSpacing` must be `{value, unit}` objects — bare numbers throw.
51
+
52
+ ```javascript
53
+ /**
54
+ * Creates a text style with all typographic properties set.
55
+ * Font MUST be loaded before calling.
56
+ *
57
+ * @param {string} name - Slash-delimited name, e.g. "body/base"
58
+ * @param {{ family: string, style: string }} fontName
59
+ * @param {number} fontSize - In pixels
60
+ * @param {{ value: number, unit: 'PIXELS' | 'PERCENT' } | { unit: 'AUTO' }} lineHeight
61
+ * @param {{ value: number, unit: 'PIXELS' | 'PERCENT' }} [letterSpacing]
62
+ * @param {string} [description] - e.g. the CSS variable name "CSS: var(--font-body-base)"
63
+ * @returns {TextStyle}
64
+ */
65
+ function createTextStyleFull(name, fontName, fontSize, lineHeight, letterSpacing, description) {
66
+ const style = figma.createTextStyle();
67
+ style.name = name;
68
+ style.fontName = fontName;
69
+ style.fontSize = fontSize;
70
+ style.lineHeight = lineHeight; // { unit: 'AUTO' } | { value, unit: 'PIXELS'|'PERCENT' }
71
+ if (letterSpacing) style.letterSpacing = letterSpacing;
72
+ if (description) style.description = description;
73
+ return style;
74
+ }
75
+ ```
76
+
77
+ ## Probing Font Styles
78
+
79
+ Font style names vary per provider and per file (`"SemiBold"` vs `"Semi Bold"`). Always probe before hardcoding:
80
+
81
+ ```javascript
82
+ /**
83
+ * Probes available font styles for a given family.
84
+ * Useful when font style names are unknown (e.g. "SemiBold" vs "Semi Bold").
85
+ *
86
+ * @param {string} family - Font family name, e.g. "Inter"
87
+ * @param {string[]} stylesToTest - Candidate style names to probe
88
+ * @returns {Promise<string[]>} - Style names that loaded successfully
89
+ */
90
+ async function probeAvailableFontStyles(family, stylesToTest) {
91
+ const available = [];
92
+ for (const style of stylesToTest) {
93
+ try {
94
+ await figma.loadFontAsync({ family, style });
95
+ available.push(style);
96
+ } catch (_) {}
97
+ }
98
+ return available;
99
+ }
100
+ ```
101
+
102
+ ## Creating a Type Ramp (Multi-Step)
103
+
104
+ Handles font loading, deduplication, and idempotency. Each entry: `[name, fontFamily, fontStyle, fontSize_px, lineHeight, cssVar]`.
105
+
106
+ **HEADLESS NOTE:** `setBoundVariable` on `TextStyle` is not supported in `use_figma`. This function sets raw values. To bind variables, do it interactively in Figma after creation.
107
+
108
+ ```javascript
109
+ /**
110
+ * Creates a full type ramp from a token definition array.
111
+ * Handles font loading, deduplication, and idempotency.
112
+ *
113
+ * Each entry: [name, fontFamily, fontStyle, fontSize_px, lineHeight, cssVar]
114
+ * - lineHeight: { unit: 'AUTO' } or { value: number, unit: 'PIXELS' | 'PERCENT' }
115
+ *
116
+ * @param {Array} defs - Array of [name, fontFamily, fontStyle, fontSize, lineHeight, cssVar] tuples
117
+ * @returns {Promise<{ created: string[], skipped: string[] }>}
118
+ */
119
+ async function createTypeRamp(defs) {
120
+ const uniqueFonts = new Set();
121
+ for (const [, family, style] of defs) {
122
+ uniqueFonts.add(JSON.stringify({ family, style }));
123
+ }
124
+ await Promise.all(
125
+ [...uniqueFonts].map(f => figma.loadFontAsync(JSON.parse(f)))
126
+ );
127
+
128
+ const existing = new Set(
129
+ (await figma.getLocalTextStylesAsync()).map(s => s.name)
130
+ );
131
+
132
+ const created = [];
133
+ const skipped = [];
134
+
135
+ for (const [name, family, style, fontSize, lineHeight, cssVar] of defs) {
136
+ if (existing.has(name)) {
137
+ skipped.push(name);
138
+ continue;
139
+ }
140
+ const ts = figma.createTextStyle();
141
+ ts.name = name;
142
+ ts.fontName = { family, style };
143
+ ts.fontSize = fontSize;
144
+ ts.lineHeight = lineHeight ?? { unit: 'AUTO' };
145
+ if (cssVar) ts.description = `CSS: var(${cssVar})`;
146
+ created.push(name);
147
+ }
148
+
149
+ return { created, skipped };
150
+ }
151
+ ```
152
+
153
+ Full runnable script:
154
+
155
+ ```javascript
156
+ (async () => {
157
+ try {
158
+ const defs = [
159
+ ['heading/xl', 'Inter', 'Bold', 48, { unit: 'PIXELS', value: 56 }, '--font-heading-xl'],
160
+ ['heading/lg', 'Inter', 'Bold', 36, { unit: 'PIXELS', value: 44 }, '--font-heading-lg'],
161
+ ['body/base', 'Inter', 'Regular', 16, { unit: 'AUTO' }, '--font-body-base'],
162
+ ['body/sm', 'Inter', 'Regular', 14, { unit: 'AUTO' }, '--font-body-sm'],
163
+ ['code/base', 'Roboto Mono', 'Regular', 14, { unit: 'AUTO' }, '--font-code-base'],
164
+ ];
165
+ const result = await createTypeRamp(defs);
166
+ figma.closePlugin(JSON.stringify(result));
167
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
168
+ })()
169
+ ```
170
+
171
+ ## Applying Text Styles to Nodes
172
+
173
+ ```javascript
174
+ /**
175
+ * Applies a text style to all TEXT nodes on the current page that match a given name pattern.
176
+ *
177
+ * @param {string} styleId - The ID of a TextStyle.
178
+ * @param {string} nodeNamePattern - Substring match against node names.
179
+ * @returns {Promise<number>} - Number of nodes the style was applied to.
180
+ */
181
+ async function applyTextStyleToMatchingNodes(styleId, nodeNamePattern) {
182
+ const textNodes = figma.currentPage.findAllWithCriteria({ types: ['TEXT'] });
183
+ let applied = 0;
184
+ for (const node of textNodes) {
185
+ if (node.name.includes(nodeNamePattern)) {
186
+ await node.setTextStyleIdAsync(styleId);
187
+ applied++;
188
+ }
189
+ }
190
+ return applied;
191
+ }
192
+ ```
193
+
194
+ Full runnable script:
195
+
196
+ ```javascript
197
+ (async () => {
198
+ try {
199
+ const applied = await applyTextStyleToMatchingNodes('STYLE_ID', 'Heading');
200
+ figma.closePlugin(JSON.stringify({ applied }));
201
+ } catch(e) { figma.closePluginWithFailure(e.toString()); }
202
+ })()
203
+ ```