@pairdraw/core 0.16.0 → 0.16.2

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 (145) hide show
  1. package/README.md +1 -1
  2. package/dist/ai/providers.d.ts +6 -1
  3. package/dist/ai/providers.d.ts.map +1 -1
  4. package/dist/ai/providers.js +9 -0
  5. package/dist/ai/providers.js.map +1 -1
  6. package/dist/canvas/highlight-rect.d.ts +10 -1
  7. package/dist/canvas/highlight-rect.d.ts.map +1 -1
  8. package/dist/canvas/highlight-rect.js +16 -8
  9. package/dist/canvas/highlight-rect.js.map +1 -1
  10. package/dist/canvas/index.d.ts +2 -3
  11. package/dist/canvas/index.js +1 -2
  12. package/dist/canvas/issues/draw.d.ts +2 -6
  13. package/dist/canvas/issues/draw.d.ts.map +1 -1
  14. package/dist/canvas/issues/draw.js +2 -99
  15. package/dist/canvas/issues/draw.js.map +1 -1
  16. package/dist/canvas/issues/types.d.ts +2 -33
  17. package/dist/canvas/issues/types.d.ts.map +1 -1
  18. package/dist/canvas/overlays/{ai.d.ts → ai/draw.d.ts} +3 -3
  19. package/dist/canvas/overlays/ai/draw.d.ts.map +1 -0
  20. package/dist/canvas/overlays/ai/draw.js +102 -0
  21. package/dist/canvas/overlays/ai/draw.js.map +1 -0
  22. package/dist/canvas/overlays/ai/motion.d.ts +23 -0
  23. package/dist/canvas/overlays/ai/motion.d.ts.map +1 -0
  24. package/dist/canvas/overlays/ai/motion.js +32 -0
  25. package/dist/canvas/overlays/ai/motion.js.map +1 -0
  26. package/dist/canvas/renderer/methods.js +1 -1
  27. package/dist/canvas/renderer/methods.js.map +1 -1
  28. package/dist/canvas/renderer/overlay-pass.d.ts.map +1 -1
  29. package/dist/canvas/renderer/overlay-pass.js +2 -47
  30. package/dist/canvas/renderer/overlay-pass.js.map +1 -1
  31. package/dist/canvas/renderer/pipeline.js +1 -1
  32. package/dist/canvas/renderer/pipeline.js.map +1 -1
  33. package/dist/canvas/renderer/state.d.ts +5 -3
  34. package/dist/canvas/renderer/state.d.ts.map +1 -1
  35. package/dist/canvas/renderer/state.js +18 -6
  36. package/dist/canvas/renderer/state.js.map +1 -1
  37. package/dist/canvas/renderer/types.d.ts +2 -2
  38. package/dist/canvas/renderer/types.d.ts.map +1 -1
  39. package/dist/canvas/renderer.d.ts +12 -8
  40. package/dist/canvas/renderer.d.ts.map +1 -1
  41. package/dist/canvas/renderer.js +9 -9
  42. package/dist/canvas/renderer.js.map +1 -1
  43. package/dist/canvas/text/preparation/cache.d.ts +5 -0
  44. package/dist/canvas/text/preparation/cache.d.ts.map +1 -1
  45. package/dist/canvas/text/preparation/cache.js +8 -1
  46. package/dist/canvas/text/preparation/cache.js.map +1 -1
  47. package/dist/constants.d.ts +13 -18
  48. package/dist/constants.d.ts.map +1 -1
  49. package/dist/constants.js +16 -21
  50. package/dist/constants.js.map +1 -1
  51. package/dist/design-jsx/index.d.ts +2 -2
  52. package/dist/design-jsx/index.js +2 -2
  53. package/dist/design-jsx/preview/picture.d.ts +12 -5
  54. package/dist/design-jsx/preview/picture.d.ts.map +1 -1
  55. package/dist/design-jsx/preview/picture.js +40 -15
  56. package/dist/design-jsx/preview/picture.js.map +1 -1
  57. package/dist/editor/bridges/undo.d.ts +1 -1
  58. package/dist/editor/create.d.ts +3 -6
  59. package/dist/editor/create.d.ts.map +1 -1
  60. package/dist/editor/history/atomic-tool.d.ts.map +1 -1
  61. package/dist/editor/history/atomic-tool.js +11 -8
  62. package/dist/editor/history/atomic-tool.js.map +1 -1
  63. package/dist/editor/history/document-change.d.ts +9 -1
  64. package/dist/editor/history/document-change.d.ts.map +1 -1
  65. package/dist/editor/history/document-change.js +100 -2
  66. package/dist/editor/history/document-change.js.map +1 -1
  67. package/dist/editor/history/snapshot/graph.d.ts +15 -3
  68. package/dist/editor/history/snapshot/graph.d.ts.map +1 -1
  69. package/dist/editor/history/snapshot/graph.js +29 -8
  70. package/dist/editor/history/snapshot/graph.js.map +1 -1
  71. package/dist/editor/index.d.ts +3 -3
  72. package/dist/editor/index.js +3 -3
  73. package/dist/editor/issues.d.ts +1 -4
  74. package/dist/editor/issues.d.ts.map +1 -1
  75. package/dist/editor/issues.js +5 -44
  76. package/dist/editor/issues.js.map +1 -1
  77. package/dist/editor/nudge.js +3 -2
  78. package/dist/editor/nudge.js.map +1 -1
  79. package/dist/editor/read-only/actions.js +0 -3
  80. package/dist/editor/read-only/actions.js.map +1 -1
  81. package/dist/editor/state/shared.js +1 -1
  82. package/dist/editor/state/shared.js.map +1 -1
  83. package/dist/editor/types.d.ts +7 -4
  84. package/dist/editor/types.d.ts.map +1 -1
  85. package/dist/index.d.ts +3 -3
  86. package/dist/index.js +3 -3
  87. package/dist/io/subgraph.d.ts +5 -2
  88. package/dist/io/subgraph.d.ts.map +1 -1
  89. package/dist/io/subgraph.js +6 -2
  90. package/dist/io/subgraph.js.map +1 -1
  91. package/dist/layout/mutations.d.ts +1 -1
  92. package/dist/layout/mutations.d.ts.map +1 -1
  93. package/dist/layout/mutations.js +1 -1
  94. package/dist/layout/mutations.js.map +1 -1
  95. package/dist/text/font/faces.js +1 -1
  96. package/dist/text/font/faces.js.map +1 -1
  97. package/dist/text/web-font/providers.d.ts +2 -11
  98. package/dist/text/web-font/providers.d.ts.map +1 -1
  99. package/dist/text/web-font/providers.js +8 -7
  100. package/dist/text/web-font/providers.js.map +1 -1
  101. package/dist/tools/analyze/diff/jsx.d.ts +2 -1
  102. package/dist/tools/analyze/diff/jsx.d.ts.map +1 -1
  103. package/dist/tools/analyze/diff/jsx.js +4 -2
  104. package/dist/tools/analyze/diff/jsx.js.map +1 -1
  105. package/package.json +24 -9
  106. package/src/ai/providers.ts +15 -1
  107. package/src/canvas/highlight-rect.ts +30 -9
  108. package/src/canvas/index.ts +1 -15
  109. package/src/canvas/issues/draw.ts +2 -165
  110. package/src/canvas/issues/types.ts +1 -36
  111. package/src/canvas/overlays/ai/draw.ts +129 -0
  112. package/src/canvas/overlays/ai/motion.ts +46 -0
  113. package/src/canvas/renderer/methods.ts +1 -1
  114. package/src/canvas/renderer/overlay-pass.ts +2 -49
  115. package/src/canvas/renderer/pipeline.ts +1 -1
  116. package/src/canvas/renderer/state.ts +20 -5
  117. package/src/canvas/renderer/types.ts +2 -2
  118. package/src/canvas/renderer.ts +9 -10
  119. package/src/canvas/text/preparation/cache.ts +9 -1
  120. package/src/constants.ts +12 -17
  121. package/src/design-jsx/index.ts +1 -1
  122. package/src/design-jsx/preview/picture.ts +55 -18
  123. package/src/editor/history/atomic-tool.ts +15 -8
  124. package/src/editor/history/document-change.ts +117 -1
  125. package/src/editor/history/snapshot/graph.ts +48 -8
  126. package/src/editor/index.ts +10 -2
  127. package/src/editor/issues.ts +6 -36
  128. package/src/editor/nudge.ts +4 -2
  129. package/src/editor/read-only/actions.ts +0 -3
  130. package/src/editor/state/shared.ts +1 -1
  131. package/src/editor/types.ts +6 -4
  132. package/src/io/subgraph.ts +10 -5
  133. package/src/layout/mutations.ts +2 -2
  134. package/src/text/font/faces.ts +1 -1
  135. package/src/text/web-font/providers.ts +19 -13
  136. package/src/tools/analyze/diff/jsx.ts +10 -5
  137. package/dist/canvas/issues/layout.d.ts +0 -37
  138. package/dist/canvas/issues/layout.d.ts.map +0 -1
  139. package/dist/canvas/issues/layout.js +0 -303
  140. package/dist/canvas/issues/layout.js.map +0 -1
  141. package/dist/canvas/overlays/ai.d.ts.map +0 -1
  142. package/dist/canvas/overlays/ai.js +0 -26
  143. package/dist/canvas/overlays/ai.js.map +0 -1
  144. package/src/canvas/issues/layout.ts +0 -376
  145. package/src/canvas/overlays/ai.ts +0 -34
package/README.md CHANGED
@@ -18,7 +18,7 @@ await compileScript(`
18
18
  `)(new FigmaAPI(graph))
19
19
  ```
20
20
 
21
- - Programmable overview and SDK docs: https://github.com/BadryansahBangsawan/pairdraw/blob/master/packages/docs/programmable/index.md
21
+ - Programmable overview and SDK docs: https://github.com/BadryansahBangsawan/pairdraw/blob/main/packages/docs/programmable/index.md
22
22
  - Source and issues: https://github.com/BadryansahBangsawan/pairdraw
23
23
 
24
24
  MIT License.
@@ -1,6 +1,6 @@
1
1
  //#region src/ai/providers.d.ts
2
2
  /** ACP agents, direct AI providers, and the models each provider recommends. */
3
- type ACPAgentID = 'claude-code' | 'codex' | 'gemini-cli';
3
+ type ACPAgentID = 'claude-code' | 'codex' | 'gemini-cli' | 'omp';
4
4
  interface ACPAgentDef {
5
5
  id: ACPAgentID;
6
6
  name: string;
@@ -26,6 +26,11 @@ interface ACPAgentDef {
26
26
  method: string;
27
27
  args: string[];
28
28
  };
29
+ /**
30
+ * The agent runs on the providers and keys already set up in its own configuration and has no
31
+ * account to sign in to, so setup shows no sign-in step.
32
+ */
33
+ ownCredentials?: boolean;
29
34
  }
30
35
  declare const ACP_AGENTS: ACPAgentDef[];
31
36
  type AIProviderID = 'openrouter' | 'anthropic' | 'openai' | 'chatgpt' | 'google' | 'deepseek' | 'openai-compatible' | 'zai' | 'minimax' | 'xai' | 'meta' | 'kimi-for-coding' | 'moonshot' | 'together' | 'fireworks' | 'opencode-zen' | 'opencode-go' | 'anthropic-compatible' | 'amazon-bedrock' | 'google-vertex' | 'pairdraw' | 'harness:pi' | `acp:${ACPAgentID}`;
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.ts","names":[],"sources":["../../src/ai/providers.ts"],"mappings":";;KAIY;UAEK;EACf,IAAI;EACJ;EACA;EACA;;EAEA;;EAEA;;EAEA;EACA;;;;;;EAMA;IAAW;IAAY;;IAAqB;IAAiB;IAAgB;;;cAGlE,YAAY;KAqCb,oVAuBD;cAEE;KACD,0BAA0B;UAErB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,qBAAqB;;UAGN;EACf,IAAI;EACJ;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;;EAEA;;cAmDW;cAEA,cAAc;cAoSd,qBAAqB;cACrB"}
1
+ {"version":3,"file":"providers.d.ts","names":[],"sources":["../../src/ai/providers.ts"],"mappings":";;KAIY;UAEK;EACf,IAAI;EACJ;EACA;EACA;;EAEA;;EAEA;;EAEA;EACA;;;;;;EAMA;IAAW;IAAY;;IAAqB;IAAiB;IAAgB;;;;;;EAK7E;;cAGW,YAAY;KA8Cb,oVAuBD;cAEE;KACD,0BAA0B;UAErB;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,qBAAqB;;UAGN;EACf,IAAI;EACJ;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;;EAEA;;cAmDW;cAEA,cAAc;cAoSd,qBAAqB;cACrB"}
@@ -43,6 +43,15 @@ const ACP_AGENTS = [
43
43
  args: ["--acp"],
44
44
  setupURL: "https://geminicli.com/docs/get-started/installation/",
45
45
  installCommand: "npm i -g @google/gemini-cli"
46
+ },
47
+ {
48
+ id: "omp",
49
+ name: "omp",
50
+ command: "omp",
51
+ args: ["acp"],
52
+ setupURL: "https://omp.sh",
53
+ installCommand: "bun i -g @oh-my-pi/pi-coding-agent",
54
+ ownCredentials: true
46
55
  }
47
56
  ];
48
57
  const REASONING_EFFORTS = [
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","names":[],"sources":["../../src/ai/providers.ts"],"sourcesContent":["/** ACP agents, direct AI providers, and the models each provider recommends. */\n\nimport { OPENAI_COMPATIBLE_PRESETS } from './presets'\n\nexport type ACPAgentID = 'claude-code' | 'codex' | 'gemini-cli'\n\nexport interface ACPAgentDef {\n id: ACPAgentID\n name: string\n command: string\n args: string[]\n /** The agent's own CLI, when the ACP program is a separate adapter for it. */\n cliCommand?: string\n /** npm package that provides `command` when it is an adapter. */\n adapterPackage?: string\n /** The vendor's installation guide for the agent itself. */\n setupURL?: string\n installCommand?: string\n /**\n * The ACP auth method setup signs in with, once the agent offers it. `acp` methods run inside\n * the agent through `authenticate`; `terminal` methods run the agent's command with `args`,\n * which the desktop shell scope pins under `<command>-sign-in`.\n */\n signIn?: { via: 'acp'; method: string } | { via: 'terminal'; method: string; args: string[] }\n}\n\nexport const ACP_AGENTS: ACPAgentDef[] = [\n {\n id: 'claude-code',\n name: 'Claude Code',\n command: 'claude-agent-acp',\n args: [],\n cliCommand: 'claude',\n adapterPackage: '@agentclientprotocol/claude-agent-acp',\n setupURL: 'https://code.claude.com/docs/en/setup',\n installCommand: 'npm i -g @agentclientprotocol/claude-agent-acp',\n signIn: {\n via: 'terminal',\n method: 'claude-ai-login',\n args: ['--cli', 'auth', 'login', '--claudeai']\n }\n },\n {\n id: 'codex',\n name: 'Codex',\n command: 'codex-acp',\n args: [],\n cliCommand: 'codex',\n adapterPackage: '@agentclientprotocol/codex-acp',\n setupURL: 'https://developers.openai.com/codex/cli',\n installCommand: 'npm i -g @agentclientprotocol/codex-acp',\n signIn: { via: 'acp', method: 'chat-gpt' }\n },\n {\n id: 'gemini-cli',\n name: 'Gemini CLI',\n command: 'gemini',\n args: ['--acp'],\n setupURL: 'https://geminicli.com/docs/get-started/installation/',\n installCommand: 'npm i -g @google/gemini-cli'\n }\n]\n\nexport type AIProviderID =\n | 'openrouter'\n | 'anthropic'\n | 'openai'\n | 'chatgpt'\n | 'google'\n | 'deepseek'\n | 'openai-compatible'\n | 'zai'\n | 'minimax'\n | 'xai'\n | 'meta'\n | 'kimi-for-coding'\n | 'moonshot'\n | 'together'\n | 'fireworks'\n | 'opencode-zen'\n | 'opencode-go'\n | 'anthropic-compatible'\n | 'amazon-bedrock'\n | 'google-vertex'\n | 'pairdraw'\n | 'harness:pi'\n | `acp:${ACPAgentID}`\n\nexport const REASONING_EFFORTS = ['minimal', 'low', 'medium', 'high', 'xhigh'] as const\nexport type ReasoningEffort = (typeof REASONING_EFFORTS)[number]\n\nexport interface ModelOption {\n id: string\n name: string\n tag?: string\n capabilities?: readonly ('tools' | 'vision')[]\n recommendedMaxOutputTokens?: number\n releaseDate?: string\n status?: 'active' | 'beta' | 'deprecated'\n /** Lowest reasoning effort the model accepts; lower thinking levels, Off included, use it. */\n minReasoningEffort?: ReasoningEffort\n}\n\nexport interface AIProviderDef {\n id: AIProviderID\n name: string\n keyPlaceholder: string\n keyURL: string\n models: ModelOption[]\n defaultModel: string\n supportsCustomBaseURL?: boolean\n supportsCustomModel?: boolean\n /** The credential comes from signing in to an account; there is no key to paste. */\n signInOnly?: boolean\n}\n\nconst OPENAI_MODELS: ModelOption[] = [\n {\n id: 'gpt-6.1-sol',\n name: 'GPT-6.1 Sol',\n tag: 'Best',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'gpt-6-astra',\n name: 'GPT-6 Astra',\n tag: 'Smartest',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n { id: 'gpt-6-luna', name: 'GPT-6 Luna', tag: 'Fast', capabilities: ['tools', 'vision'] }\n]\n\n/** Claude on a cloud platform: the same models under the platform's own IDs. */\nfunction claudeModels(prefix: string): ModelOption[] {\n return [\n {\n id: `${prefix}claude-sonnet-5-5`,\n name: 'Claude Sonnet 5.5',\n tag: 'Best for design',\n capabilities: ['tools', 'vision']\n },\n {\n id: `${prefix}claude-opus-5-5`,\n name: 'Claude Opus 5.5',\n tag: 'Deep reasoning',\n capabilities: ['tools', 'vision']\n },\n {\n id: `${prefix}claude-fable-5-1`,\n name: 'Claude Fable 5.1',\n tag: 'Most capable',\n capabilities: ['tools', 'vision']\n },\n {\n id: `${prefix}claude-haiku-5-5`,\n name: 'Claude Haiku 5.5',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n }\n ]\n}\n\nexport const HARNESS_PROVIDER_ID = 'harness:pi' as const\n\nexport const AI_PROVIDERS: AIProviderDef[] = [\n {\n id: HARNESS_PROVIDER_ID,\n name: 'Pi',\n keyPlaceholder: 'AI Gateway key (optional)',\n keyURL: '',\n defaultModel: '',\n supportsCustomModel: true,\n models: []\n },\n {\n id: 'openrouter',\n name: 'OpenRouter',\n keyPlaceholder: 'sk-or-…',\n keyURL: 'https://openrouter.ai/keys',\n defaultModel: 'anthropic/claude-sonnet-5.5',\n supportsCustomModel: true,\n models: [\n {\n id: 'anthropic/claude-sonnet-5.5',\n name: 'Claude Sonnet 5.5',\n tag: 'Best for design',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'anthropic/claude-opus-5.5',\n name: 'Claude Opus 5.5',\n tag: 'Deep reasoning',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'anthropic/claude-fable-5.1',\n name: 'Claude Fable 5.1',\n tag: 'Most capable',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'anthropic/claude-haiku-5.5',\n name: 'Claude Haiku 5.5',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'openai/gpt-6.1-sol',\n name: 'GPT-6.1 Sol',\n tag: 'Latest OpenAI',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'google/gemini-3.8-flash',\n name: 'Gemini 3.8 Flash',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n },\n { id: 'z-ai/glm-5.3', name: 'GLM-5.3', capabilities: ['tools'] },\n {\n id: 'deepseek/deepseek-v4-pro',\n name: 'DeepSeek V4 Pro',\n tag: 'Reasoning',\n capabilities: ['tools']\n },\n {\n id: 'moonshotai/kimi-k3',\n name: 'Kimi K3',\n tag: 'Vision + code',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'minimax/minimax-m3.1-flash:free',\n name: 'MiniMax-M3.1-Flash',\n tag: 'Free',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'google/gemma-4-31b-it:free',\n name: 'Gemma 4 31B',\n tag: 'Free',\n capabilities: ['tools', 'vision']\n }\n ]\n },\n {\n id: 'anthropic',\n name: 'Anthropic',\n keyPlaceholder: 'sk-ant-…',\n keyURL: 'https://console.anthropic.com/settings/keys',\n defaultModel: 'claude-sonnet-5-5',\n models: [\n {\n id: 'claude-sonnet-5-5',\n name: 'Claude Sonnet 5.5',\n tag: 'Best for design',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'claude-opus-5-5',\n name: 'Claude Opus 5.5',\n tag: 'Deep reasoning',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'claude-fable-5-1',\n name: 'Claude Fable 5.1',\n tag: 'Most capable',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'claude-haiku-5-5',\n name: 'Claude Haiku 5.5',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n }\n ]\n },\n {\n id: 'openai',\n name: 'OpenAI',\n keyPlaceholder: 'sk-…',\n keyURL: 'https://platform.openai.com/api-keys',\n defaultModel: 'gpt-6.1-sol',\n models: OPENAI_MODELS\n },\n {\n id: 'chatgpt',\n name: 'ChatGPT',\n keyPlaceholder: '',\n keyURL: '',\n defaultModel: 'gpt-6.1-sol',\n signInOnly: true,\n // The Codex backend rejects minimal effort on every model.\n models: OPENAI_MODELS.map((model) => ({ ...model, minReasoningEffort: 'low' }))\n },\n {\n id: 'google',\n name: 'Google AI',\n keyPlaceholder: 'AIza…',\n keyURL: 'https://aistudio.google.com/apikey',\n defaultModel: 'gemini-3.8-flash',\n models: [\n {\n id: 'gemini-3.8-flash',\n name: 'Gemini 3.8 Flash',\n tag: 'Best',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'gemini-4-argon',\n name: 'Gemini 4 Argon',\n tag: 'Most capable',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'gemini-flash-latest',\n name: 'Gemini Flash Latest',\n tag: 'Alias',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'gemini-3.1-pro-preview',\n name: 'Gemini 3.1 Pro',\n tag: 'Pro',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n }\n ]\n },\n {\n id: 'deepseek',\n name: 'DeepSeek',\n keyPlaceholder: 'sk-…',\n keyURL: 'https://platform.deepseek.com/api_keys',\n defaultModel: 'deepseek-flash',\n models: [\n { id: 'deepseek-flash', name: 'DeepSeek Flash', tag: 'Fast' },\n { id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro', tag: 'Reasoning' }\n ]\n },\n {\n id: 'zai',\n name: 'Z.ai',\n keyPlaceholder: 'API key',\n keyURL: 'https://docs.z.ai/devpack/quick-start',\n defaultModel: 'glm-5.3',\n models: [\n { id: 'glm-5.3', name: 'GLM-5.3', tag: 'Best', minReasoningEffort: 'low' },\n {\n id: 'glm-5.3-flash',\n name: 'GLM-5.3-Flash',\n tag: 'Fast',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'glm-5.3-flashx',\n name: 'GLM-5.3-FlashX',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'glm-5v-turbo',\n name: 'GLM-5V-Turbo',\n tag: 'Vision',\n capabilities: ['tools', 'vision']\n },\n { id: 'glm-5.2', name: 'GLM-5.2' },\n { id: 'glm-4.7-flash', name: 'GLM-4.7-Flash', tag: 'Free' }\n ]\n },\n {\n id: 'minimax',\n name: 'MiniMax',\n keyPlaceholder: 'API key',\n keyURL: 'https://platform.minimax.io/user-center/basic-information/interface-key',\n defaultModel: 'MiniMax-M3.1-Flash',\n models: [\n {\n id: 'MiniMax-M3.1-Flash',\n name: 'MiniMax-M3.1-Flash',\n tag: 'Best',\n minReasoningEffort: 'low'\n },\n { id: 'MiniMax-M3', name: 'MiniMax-M3' }\n ]\n },\n ...OPENAI_COMPATIBLE_PRESETS,\n {\n id: 'openai-compatible',\n name: 'OpenAI-compatible',\n keyPlaceholder: 'API key',\n keyURL: '',\n defaultModel: '',\n models: [],\n supportsCustomBaseURL: true,\n supportsCustomModel: true\n },\n {\n id: 'anthropic-compatible',\n name: 'Anthropic-compatible',\n keyPlaceholder: 'API key',\n keyURL: '',\n defaultModel: '',\n models: [],\n supportsCustomBaseURL: true,\n supportsCustomModel: true\n },\n {\n // Claude in Amazon Bedrock: the Messages API at `bedrock-mantle.<region>.api.aws`, reached\n // with a Bedrock API key or AWS access keys. The connection's base URL holds the region.\n id: 'amazon-bedrock',\n name: 'Amazon Bedrock',\n keyPlaceholder: 'ABSK… / bedrock-api-key-…',\n keyURL: 'https://console.aws.amazon.com/bedrock/home#/api-keys',\n defaultModel: 'anthropic.claude-sonnet-5-5',\n supportsCustomModel: true,\n models: claudeModels('anthropic.')\n },\n {\n // Vertex AI serves Claude through `:rawPredict` and Gemini through `:generateContent`. The\n // connection's base URL holds the project and location.\n id: 'google-vertex',\n name: 'Google Vertex AI',\n keyPlaceholder: 'ya29.… / AIza…',\n keyURL: 'https://console.cloud.google.com/vertex-ai',\n defaultModel: 'claude-sonnet-5-5',\n supportsCustomModel: true,\n models: [\n ...claudeModels(''),\n {\n id: 'gemini-3.8-flash',\n name: 'Gemini 3.8 Flash',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'gemini-4-argon',\n name: 'Gemini 4 Argon',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n }\n ]\n },\n {\n id: 'pairdraw',\n name: 'Pairdraw Cloud',\n keyPlaceholder: '',\n keyURL: '',\n defaultModel: '',\n models: []\n }\n]\n\nexport const DEFAULT_AI_PROVIDER: AIProviderID = 'openai-compatible'\nexport const DEFAULT_AI_MODEL =\n AI_PROVIDERS.find((provider) => provider.id === DEFAULT_AI_PROVIDER)?.defaultModel ?? ''\n"],"mappings":";;;AA0BA,MAAa,aAA4B;CACvC;EACE,IAAI;EACJ,MAAM;EACN,SAAS;EACT,MAAM,CAAC;EACP,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACV,gBAAgB;EAChB,QAAQ;GACN,KAAK;GACL,QAAQ;GACR,MAAM;IAAC;IAAS;IAAQ;IAAS;GAAY;EAC/C;CACF;CACA;EACE,IAAI;EACJ,MAAM;EACN,SAAS;EACT,MAAM,CAAC;EACP,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACV,gBAAgB;EAChB,QAAQ;GAAE,KAAK;GAAO,QAAQ;EAAW;CAC3C;CACA;EACE,IAAI;EACJ,MAAM;EACN,SAAS;EACT,MAAM,CAAC,OAAO;EACd,UAAU;EACV,gBAAgB;CAClB;AACF;AA2BA,MAAa,oBAAoB;CAAC;CAAW;CAAO;CAAU;CAAQ;AAAO;AA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AC;EACT,uBAAuB;EACvB,qBAAqB;CACvB;CACA;EACE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,QAAQ,CAAC;EACT,uBAAuB;EACvB,qBAAqB;CACvB;CACA;EAGE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,qBAAqB;EACrB,QAAQ,aAAa,YAAY;CACnC;CACA;EAGE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,qBAAqB;EACrB,QAAQ;GACN,GAAG,aAAa,EAAE;GAClB;IACE,IAAI;IACJ,MAAM;IACN,KAAK;IACL,cAAc,CAAC,SAAS,QAAQ;GAClC;GACA;IACE,IAAI;IACJ,MAAM;IACN,cAAc,CAAC,SAAS,QAAQ;IAChC,oBAAoB;GACtB;EACF;CACF;CACA;EACE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,QAAQ,CAAC;CACX;AACF;AAEA,MAAa,sBAAoC;AACjD,MAAa,mBACX,aAAa,MAAM,aAAa,SAAS,OAAA,mBAA0B,CAAC,EAAE,gBAAgB"}
1
+ {"version":3,"file":"providers.js","names":[],"sources":["../../src/ai/providers.ts"],"sourcesContent":["/** ACP agents, direct AI providers, and the models each provider recommends. */\n\nimport { OPENAI_COMPATIBLE_PRESETS } from './presets'\n\nexport type ACPAgentID = 'claude-code' | 'codex' | 'gemini-cli' | 'omp'\n\nexport interface ACPAgentDef {\n id: ACPAgentID\n name: string\n command: string\n args: string[]\n /** The agent's own CLI, when the ACP program is a separate adapter for it. */\n cliCommand?: string\n /** npm package that provides `command` when it is an adapter. */\n adapterPackage?: string\n /** The vendor's installation guide for the agent itself. */\n setupURL?: string\n installCommand?: string\n /**\n * The ACP auth method setup signs in with, once the agent offers it. `acp` methods run inside\n * the agent through `authenticate`; `terminal` methods run the agent's command with `args`,\n * which the desktop shell scope pins under `<command>-sign-in`.\n */\n signIn?: { via: 'acp'; method: string } | { via: 'terminal'; method: string; args: string[] }\n /**\n * The agent runs on the providers and keys already set up in its own configuration and has no\n * account to sign in to, so setup shows no sign-in step.\n */\n ownCredentials?: boolean\n}\n\nexport const ACP_AGENTS: ACPAgentDef[] = [\n {\n id: 'claude-code',\n name: 'Claude Code',\n command: 'claude-agent-acp',\n args: [],\n cliCommand: 'claude',\n adapterPackage: '@agentclientprotocol/claude-agent-acp',\n setupURL: 'https://code.claude.com/docs/en/setup',\n installCommand: 'npm i -g @agentclientprotocol/claude-agent-acp',\n signIn: {\n via: 'terminal',\n method: 'claude-ai-login',\n args: ['--cli', 'auth', 'login', '--claudeai']\n }\n },\n {\n id: 'codex',\n name: 'Codex',\n command: 'codex-acp',\n args: [],\n cliCommand: 'codex',\n adapterPackage: '@agentclientprotocol/codex-acp',\n setupURL: 'https://developers.openai.com/codex/cli',\n installCommand: 'npm i -g @agentclientprotocol/codex-acp',\n signIn: { via: 'acp', method: 'chat-gpt' }\n },\n {\n id: 'gemini-cli',\n name: 'Gemini CLI',\n command: 'gemini',\n args: ['--acp'],\n setupURL: 'https://geminicli.com/docs/get-started/installation/',\n installCommand: 'npm i -g @google/gemini-cli'\n },\n {\n id: 'omp',\n name: 'omp',\n command: 'omp',\n args: ['acp'],\n setupURL: 'https://omp.sh',\n installCommand: 'bun i -g @oh-my-pi/pi-coding-agent',\n ownCredentials: true\n }\n]\n\nexport type AIProviderID =\n | 'openrouter'\n | 'anthropic'\n | 'openai'\n | 'chatgpt'\n | 'google'\n | 'deepseek'\n | 'openai-compatible'\n | 'zai'\n | 'minimax'\n | 'xai'\n | 'meta'\n | 'kimi-for-coding'\n | 'moonshot'\n | 'together'\n | 'fireworks'\n | 'opencode-zen'\n | 'opencode-go'\n | 'anthropic-compatible'\n | 'amazon-bedrock'\n | 'google-vertex'\n | 'pairdraw'\n | 'harness:pi'\n | `acp:${ACPAgentID}`\n\nexport const REASONING_EFFORTS = ['minimal', 'low', 'medium', 'high', 'xhigh'] as const\nexport type ReasoningEffort = (typeof REASONING_EFFORTS)[number]\n\nexport interface ModelOption {\n id: string\n name: string\n tag?: string\n capabilities?: readonly ('tools' | 'vision')[]\n recommendedMaxOutputTokens?: number\n releaseDate?: string\n status?: 'active' | 'beta' | 'deprecated'\n /** Lowest reasoning effort the model accepts; lower thinking levels, Off included, use it. */\n minReasoningEffort?: ReasoningEffort\n}\n\nexport interface AIProviderDef {\n id: AIProviderID\n name: string\n keyPlaceholder: string\n keyURL: string\n models: ModelOption[]\n defaultModel: string\n supportsCustomBaseURL?: boolean\n supportsCustomModel?: boolean\n /** The credential comes from signing in to an account; there is no key to paste. */\n signInOnly?: boolean\n}\n\nconst OPENAI_MODELS: ModelOption[] = [\n {\n id: 'gpt-6.1-sol',\n name: 'GPT-6.1 Sol',\n tag: 'Best',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'gpt-6-astra',\n name: 'GPT-6 Astra',\n tag: 'Smartest',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n { id: 'gpt-6-luna', name: 'GPT-6 Luna', tag: 'Fast', capabilities: ['tools', 'vision'] }\n]\n\n/** Claude on a cloud platform: the same models under the platform's own IDs. */\nfunction claudeModels(prefix: string): ModelOption[] {\n return [\n {\n id: `${prefix}claude-sonnet-5-5`,\n name: 'Claude Sonnet 5.5',\n tag: 'Best for design',\n capabilities: ['tools', 'vision']\n },\n {\n id: `${prefix}claude-opus-5-5`,\n name: 'Claude Opus 5.5',\n tag: 'Deep reasoning',\n capabilities: ['tools', 'vision']\n },\n {\n id: `${prefix}claude-fable-5-1`,\n name: 'Claude Fable 5.1',\n tag: 'Most capable',\n capabilities: ['tools', 'vision']\n },\n {\n id: `${prefix}claude-haiku-5-5`,\n name: 'Claude Haiku 5.5',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n }\n ]\n}\n\nexport const HARNESS_PROVIDER_ID = 'harness:pi' as const\n\nexport const AI_PROVIDERS: AIProviderDef[] = [\n {\n id: HARNESS_PROVIDER_ID,\n name: 'Pi',\n keyPlaceholder: 'AI Gateway key (optional)',\n keyURL: '',\n defaultModel: '',\n supportsCustomModel: true,\n models: []\n },\n {\n id: 'openrouter',\n name: 'OpenRouter',\n keyPlaceholder: 'sk-or-…',\n keyURL: 'https://openrouter.ai/keys',\n defaultModel: 'anthropic/claude-sonnet-5.5',\n supportsCustomModel: true,\n models: [\n {\n id: 'anthropic/claude-sonnet-5.5',\n name: 'Claude Sonnet 5.5',\n tag: 'Best for design',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'anthropic/claude-opus-5.5',\n name: 'Claude Opus 5.5',\n tag: 'Deep reasoning',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'anthropic/claude-fable-5.1',\n name: 'Claude Fable 5.1',\n tag: 'Most capable',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'anthropic/claude-haiku-5.5',\n name: 'Claude Haiku 5.5',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'openai/gpt-6.1-sol',\n name: 'GPT-6.1 Sol',\n tag: 'Latest OpenAI',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'google/gemini-3.8-flash',\n name: 'Gemini 3.8 Flash',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n },\n { id: 'z-ai/glm-5.3', name: 'GLM-5.3', capabilities: ['tools'] },\n {\n id: 'deepseek/deepseek-v4-pro',\n name: 'DeepSeek V4 Pro',\n tag: 'Reasoning',\n capabilities: ['tools']\n },\n {\n id: 'moonshotai/kimi-k3',\n name: 'Kimi K3',\n tag: 'Vision + code',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'minimax/minimax-m3.1-flash:free',\n name: 'MiniMax-M3.1-Flash',\n tag: 'Free',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'google/gemma-4-31b-it:free',\n name: 'Gemma 4 31B',\n tag: 'Free',\n capabilities: ['tools', 'vision']\n }\n ]\n },\n {\n id: 'anthropic',\n name: 'Anthropic',\n keyPlaceholder: 'sk-ant-…',\n keyURL: 'https://console.anthropic.com/settings/keys',\n defaultModel: 'claude-sonnet-5-5',\n models: [\n {\n id: 'claude-sonnet-5-5',\n name: 'Claude Sonnet 5.5',\n tag: 'Best for design',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'claude-opus-5-5',\n name: 'Claude Opus 5.5',\n tag: 'Deep reasoning',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'claude-fable-5-1',\n name: 'Claude Fable 5.1',\n tag: 'Most capable',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'claude-haiku-5-5',\n name: 'Claude Haiku 5.5',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n }\n ]\n },\n {\n id: 'openai',\n name: 'OpenAI',\n keyPlaceholder: 'sk-…',\n keyURL: 'https://platform.openai.com/api-keys',\n defaultModel: 'gpt-6.1-sol',\n models: OPENAI_MODELS\n },\n {\n id: 'chatgpt',\n name: 'ChatGPT',\n keyPlaceholder: '',\n keyURL: '',\n defaultModel: 'gpt-6.1-sol',\n signInOnly: true,\n // The Codex backend rejects minimal effort on every model.\n models: OPENAI_MODELS.map((model) => ({ ...model, minReasoningEffort: 'low' }))\n },\n {\n id: 'google',\n name: 'Google AI',\n keyPlaceholder: 'AIza…',\n keyURL: 'https://aistudio.google.com/apikey',\n defaultModel: 'gemini-3.8-flash',\n models: [\n {\n id: 'gemini-3.8-flash',\n name: 'Gemini 3.8 Flash',\n tag: 'Best',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'gemini-4-argon',\n name: 'Gemini 4 Argon',\n tag: 'Most capable',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'gemini-flash-latest',\n name: 'Gemini Flash Latest',\n tag: 'Alias',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'gemini-3.1-pro-preview',\n name: 'Gemini 3.1 Pro',\n tag: 'Pro',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n }\n ]\n },\n {\n id: 'deepseek',\n name: 'DeepSeek',\n keyPlaceholder: 'sk-…',\n keyURL: 'https://platform.deepseek.com/api_keys',\n defaultModel: 'deepseek-flash',\n models: [\n { id: 'deepseek-flash', name: 'DeepSeek Flash', tag: 'Fast' },\n { id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro', tag: 'Reasoning' }\n ]\n },\n {\n id: 'zai',\n name: 'Z.ai',\n keyPlaceholder: 'API key',\n keyURL: 'https://docs.z.ai/devpack/quick-start',\n defaultModel: 'glm-5.3',\n models: [\n { id: 'glm-5.3', name: 'GLM-5.3', tag: 'Best', minReasoningEffort: 'low' },\n {\n id: 'glm-5.3-flash',\n name: 'GLM-5.3-Flash',\n tag: 'Fast',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'glm-5.3-flashx',\n name: 'GLM-5.3-FlashX',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n },\n {\n id: 'glm-5v-turbo',\n name: 'GLM-5V-Turbo',\n tag: 'Vision',\n capabilities: ['tools', 'vision']\n },\n { id: 'glm-5.2', name: 'GLM-5.2' },\n { id: 'glm-4.7-flash', name: 'GLM-4.7-Flash', tag: 'Free' }\n ]\n },\n {\n id: 'minimax',\n name: 'MiniMax',\n keyPlaceholder: 'API key',\n keyURL: 'https://platform.minimax.io/user-center/basic-information/interface-key',\n defaultModel: 'MiniMax-M3.1-Flash',\n models: [\n {\n id: 'MiniMax-M3.1-Flash',\n name: 'MiniMax-M3.1-Flash',\n tag: 'Best',\n minReasoningEffort: 'low'\n },\n { id: 'MiniMax-M3', name: 'MiniMax-M3' }\n ]\n },\n ...OPENAI_COMPATIBLE_PRESETS,\n {\n id: 'openai-compatible',\n name: 'OpenAI-compatible',\n keyPlaceholder: 'API key',\n keyURL: '',\n defaultModel: '',\n models: [],\n supportsCustomBaseURL: true,\n supportsCustomModel: true\n },\n {\n id: 'anthropic-compatible',\n name: 'Anthropic-compatible',\n keyPlaceholder: 'API key',\n keyURL: '',\n defaultModel: '',\n models: [],\n supportsCustomBaseURL: true,\n supportsCustomModel: true\n },\n {\n // Claude in Amazon Bedrock: the Messages API at `bedrock-mantle.<region>.api.aws`, reached\n // with a Bedrock API key or AWS access keys. The connection's base URL holds the region.\n id: 'amazon-bedrock',\n name: 'Amazon Bedrock',\n keyPlaceholder: 'ABSK… / bedrock-api-key-…',\n keyURL: 'https://console.aws.amazon.com/bedrock/home#/api-keys',\n defaultModel: 'anthropic.claude-sonnet-5-5',\n supportsCustomModel: true,\n models: claudeModels('anthropic.')\n },\n {\n // Vertex AI serves Claude through `:rawPredict` and Gemini through `:generateContent`. The\n // connection's base URL holds the project and location.\n id: 'google-vertex',\n name: 'Google Vertex AI',\n keyPlaceholder: 'ya29.… / AIza…',\n keyURL: 'https://console.cloud.google.com/vertex-ai',\n defaultModel: 'claude-sonnet-5-5',\n supportsCustomModel: true,\n models: [\n ...claudeModels(''),\n {\n id: 'gemini-3.8-flash',\n name: 'Gemini 3.8 Flash',\n tag: 'Fast',\n capabilities: ['tools', 'vision']\n },\n {\n id: 'gemini-4-argon',\n name: 'Gemini 4 Argon',\n capabilities: ['tools', 'vision'],\n minReasoningEffort: 'low'\n }\n ]\n },\n {\n id: 'pairdraw',\n name: 'Pairdraw Cloud',\n keyPlaceholder: '',\n keyURL: '',\n defaultModel: '',\n models: []\n }\n]\n\nexport const DEFAULT_AI_PROVIDER: AIProviderID = 'openai-compatible'\nexport const DEFAULT_AI_MODEL =\n AI_PROVIDERS.find((provider) => provider.id === DEFAULT_AI_PROVIDER)?.defaultModel ?? ''\n"],"mappings":";;;AA+BA,MAAa,aAA4B;CACvC;EACE,IAAI;EACJ,MAAM;EACN,SAAS;EACT,MAAM,CAAC;EACP,YAAY;EACZ,gBAAgB;EAChB,UAAU;EACV,gBAAgB;EAChB,QAAQ;GACN,KAAK;GACL,QAAQ;GACR,MAAM;IAAC;IAAS;IAAQ;IAAS;GAAY;EAC/C;CACF;CACA;EACE,IAAI;EACJ,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,cAAc,CAAC,SAAS,QAAQ;GAClC;GACA;IAAE,IAAI;IAAW,MAAM;GAAU;GACjC;IAAE,IAAI;IAAiB,MAAM;IAAiB,KAAK;GAAO;EAC5D;CACF;CACA;EACE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,QAAQ,CACN;GACE,IAAI;GACJ,MAAM;GACN,KAAK;GACL,oBAAoB;EACtB,GACA;GAAE,IAAI;GAAc,MAAM;EAAa,CACzC;CACF;CACA,GAAG;CACH;EACE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,QAAQ,CAAC;EACT,uBAAuB;EACvB,qBAAqB;CACvB;CACA;EACE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,QAAQ,CAAC;EACT,uBAAuB;EACvB,qBAAqB;CACvB;CACA;EAGE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,qBAAqB;EACrB,QAAQ,aAAa,YAAY;CACnC;CACA;EAGE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,qBAAqB;EACrB,QAAQ;GACN,GAAG,aAAa,EAAE;GAClB;IACE,IAAI;IACJ,MAAM;IACN,KAAK;IACL,cAAc,CAAC,SAAS,QAAQ;GAClC;GACA;IACE,IAAI;IACJ,MAAM;IACN,cAAc,CAAC,SAAS,QAAQ;IAChC,oBAAoB;GACtB;EACF;CACF;CACA;EACE,IAAI;EACJ,MAAM;EACN,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,QAAQ,CAAC;CACX;AACF;AAEA,MAAa,sBAAoC;AACjD,MAAa,mBACX,aAAa,MAAM,aAAa,SAAS,OAAA,mBAA0B,CAAC,EAAE,gBAAgB"}
@@ -3,11 +3,20 @@ import { Canvas, Paint } from "canvaskit-wasm";
3
3
  import { SceneGraph } from "@pairdraw/scene-graph";
4
4
  //#region src/canvas/highlight-rect.d.ts
5
5
  declare function ensureFlashPaint(r: SkiaRenderer): Paint;
6
+ /** A node's box on screen: its centre, half its size, and its rotation in degrees. */
7
+ interface ScreenBox {
8
+ cx: number;
9
+ cy: number;
10
+ hw: number;
11
+ hh: number;
12
+ rotation: number;
13
+ }
14
+ declare function nodeScreenBox(r: SkiaRenderer, graph: SceneGraph, nodeId: string): ScreenBox | null;
6
15
  declare function drawNodeHighlightRect(r: SkiaRenderer, canvas: Canvas, graph: SceneGraph, nodeId: string, color: {
7
16
  r: number;
8
17
  g: number;
9
18
  b: number;
10
19
  }, opacity: number, extraPad?: number): boolean;
11
20
  //#endregion
12
- export { drawNodeHighlightRect, ensureFlashPaint };
21
+ export { ScreenBox, drawNodeHighlightRect, ensureFlashPaint, nodeScreenBox };
13
22
  //# sourceMappingURL=highlight-rect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"highlight-rect.d.ts","names":[],"sources":["../../src/canvas/highlight-rect.ts"],"mappings":";;;;iBAQgB,iBAAiB,GAAG,eAAe;iBASnC,sBACd,GAAG,cACH,QAAQ,QACR,OAAO,YACP,gBACA;EAAS;EAAW;EAAW;GAC/B,iBACA"}
1
+ {"version":3,"file":"highlight-rect.d.ts","names":[],"sources":["../../src/canvas/highlight-rect.ts"],"mappings":";;;;iBAQgB,iBAAiB,GAAG,eAAe;;UAUlC;EACf;EACA;EACA;EACA;EACA;;iBAGc,cACd,GAAG,cACH,OAAO,YACP,iBACC;iBAaa,sBACd,GAAG,cACH,QAAQ,QACR,OAAO,YACP,gBACA;EAAS;EAAW;EAAW;GAC/B,iBACA"}
@@ -8,26 +8,34 @@ function ensureFlashPaint(r) {
8
8
  }
9
9
  return r._flashPaint;
10
10
  }
11
- function drawNodeHighlightRect(r, canvas, graph, nodeId, color, opacity, extraPad = 0) {
11
+ function nodeScreenBox(r, graph, nodeId) {
12
12
  const node = graph.getNode(nodeId);
13
- if (!node) return false;
13
+ if (!node) return null;
14
14
  const abs = graph.getAbsolutePosition(nodeId);
15
- const cx = (abs.x + node.width / 2) * r.zoom + r.panX;
16
- const cy = (abs.y + node.height / 2) * r.zoom + r.panY;
17
- const hw = node.width / 2 * r.zoom;
18
- const hh = node.height / 2 * r.zoom;
15
+ return {
16
+ cx: (abs.x + node.width / 2) * r.zoom + r.panX,
17
+ cy: (abs.y + node.height / 2) * r.zoom + r.panY,
18
+ hw: node.width / 2 * r.zoom,
19
+ hh: node.height / 2 * r.zoom,
20
+ rotation: node.rotation
21
+ };
22
+ }
23
+ function drawNodeHighlightRect(r, canvas, graph, nodeId, color, opacity, extraPad = 0) {
24
+ const box = nodeScreenBox(r, graph, nodeId);
25
+ if (!box) return false;
26
+ const { cx, cy, hw, hh } = box;
19
27
  const pad = 5 + extraPad;
20
28
  const paint = ensureFlashPaint(r);
21
29
  paint.setColor(r.ck.Color4f(color.r, color.g, color.b, opacity));
22
30
  paint.setStrokeWidth(2);
23
31
  canvas.save();
24
- if (node.rotation !== 0) canvas.rotate(node.rotation, cx, cy);
32
+ if (box.rotation !== 0) canvas.rotate(box.rotation, cx, cy);
25
33
  const rect = r.ck.RRectXY(r.ck.LTRBRect(cx - hw - pad, cy - hh - pad, cx + hw + pad, cy + hh + pad), 4, 4);
26
34
  canvas.drawRRect(rect, paint);
27
35
  canvas.restore();
28
36
  return true;
29
37
  }
30
38
  //#endregion
31
- export { drawNodeHighlightRect, ensureFlashPaint };
39
+ export { drawNodeHighlightRect, ensureFlashPaint, nodeScreenBox };
32
40
 
33
41
  //# sourceMappingURL=highlight-rect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"highlight-rect.js","names":[],"sources":["../../src/canvas/highlight-rect.ts"],"sourcesContent":["import type { Canvas, Paint } from 'canvaskit-wasm'\n\nimport type { SceneGraph } from '@pairdraw/scene-graph'\n\nimport { FLASH_PADDING, FLASH_STROKE_WIDTH, FLASH_RADIUS } from '#core/constants'\n\nimport type { SkiaRenderer } from './renderer'\n\nexport function ensureFlashPaint(r: SkiaRenderer): Paint {\n if (!r._flashPaint) {\n r._flashPaint = new r.ck.Paint()\n r._flashPaint.setStyle(r.ck.PaintStyle.Stroke)\n r._flashPaint.setAntiAlias(true)\n }\n return r._flashPaint\n}\n\nexport function drawNodeHighlightRect(\n r: SkiaRenderer,\n canvas: Canvas,\n graph: SceneGraph,\n nodeId: string,\n color: { r: number; g: number; b: number },\n opacity: number,\n extraPad = 0\n): boolean {\n const node = graph.getNode(nodeId)\n if (!node) return false\n\n const abs = graph.getAbsolutePosition(nodeId)\n const cx = (abs.x + node.width / 2) * r.zoom + r.panX\n const cy = (abs.y + node.height / 2) * r.zoom + r.panY\n const hw = (node.width / 2) * r.zoom\n const hh = (node.height / 2) * r.zoom\n const pad = FLASH_PADDING + extraPad\n\n const paint = ensureFlashPaint(r)\n paint.setColor(r.ck.Color4f(color.r, color.g, color.b, opacity))\n paint.setStrokeWidth(FLASH_STROKE_WIDTH)\n\n canvas.save()\n if (node.rotation !== 0) canvas.rotate(node.rotation, cx, cy)\n const rect = r.ck.RRectXY(\n r.ck.LTRBRect(cx - hw - pad, cy - hh - pad, cx + hw + pad, cy + hh + pad),\n FLASH_RADIUS,\n FLASH_RADIUS\n )\n canvas.drawRRect(rect, paint)\n canvas.restore()\n return true\n}\n"],"mappings":";;AAQA,SAAgB,iBAAiB,GAAwB;CACvD,IAAI,CAAC,EAAE,aAAa;EAClB,EAAE,cAAc,IAAI,EAAE,GAAG,MAAM;EAC/B,EAAE,YAAY,SAAS,EAAE,GAAG,WAAW,MAAM;EAC7C,EAAE,YAAY,aAAa,IAAI;CACjC;CACA,OAAO,EAAE;AACX;AAEA,SAAgB,sBACd,GACA,QACA,OACA,QACA,OACA,SACA,WAAW,GACF;CACT,MAAM,OAAO,MAAM,QAAQ,MAAM;CACjC,IAAI,CAAC,MAAM,OAAO;CAElB,MAAM,MAAM,MAAM,oBAAoB,MAAM;CAC5C,MAAM,MAAM,IAAI,IAAI,KAAK,QAAQ,KAAK,EAAE,OAAO,EAAE;CACjD,MAAM,MAAM,IAAI,IAAI,KAAK,SAAS,KAAK,EAAE,OAAO,EAAE;CAClD,MAAM,KAAM,KAAK,QAAQ,IAAK,EAAE;CAChC,MAAM,KAAM,KAAK,SAAS,IAAK,EAAE;CACjC,MAAM,MAAA,IAAsB;CAE5B,MAAM,QAAQ,iBAAiB,CAAC;CAChC,MAAM,SAAS,EAAE,GAAG,QAAQ,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC/D,MAAM,eAAA,CAAiC;CAEvC,OAAO,KAAK;CACZ,IAAI,KAAK,aAAa,GAAG,OAAO,OAAO,KAAK,UAAU,IAAI,EAAE;CAC5D,MAAM,OAAO,EAAE,GAAG,QAChB,EAAE,GAAG,SAAS,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG,GAAA,GAAA,CAG1E;CACA,OAAO,UAAU,MAAM,KAAK;CAC5B,OAAO,QAAQ;CACf,OAAO;AACT"}
1
+ {"version":3,"file":"highlight-rect.js","names":[],"sources":["../../src/canvas/highlight-rect.ts"],"sourcesContent":["import type { Canvas, Paint } from 'canvaskit-wasm'\n\nimport type { SceneGraph } from '@pairdraw/scene-graph'\n\nimport { FLASH_PADDING, FLASH_STROKE_WIDTH, FLASH_RADIUS } from '#core/constants'\n\nimport type { SkiaRenderer } from './renderer'\n\nexport function ensureFlashPaint(r: SkiaRenderer): Paint {\n if (!r._flashPaint) {\n r._flashPaint = new r.ck.Paint()\n r._flashPaint.setStyle(r.ck.PaintStyle.Stroke)\n r._flashPaint.setAntiAlias(true)\n }\n return r._flashPaint\n}\n\n/** A node's box on screen: its centre, half its size, and its rotation in degrees. */\nexport interface ScreenBox {\n cx: number\n cy: number\n hw: number\n hh: number\n rotation: number\n}\n\nexport function nodeScreenBox(\n r: SkiaRenderer,\n graph: SceneGraph,\n nodeId: string\n): ScreenBox | null {\n const node = graph.getNode(nodeId)\n if (!node) return null\n const abs = graph.getAbsolutePosition(nodeId)\n return {\n cx: (abs.x + node.width / 2) * r.zoom + r.panX,\n cy: (abs.y + node.height / 2) * r.zoom + r.panY,\n hw: (node.width / 2) * r.zoom,\n hh: (node.height / 2) * r.zoom,\n rotation: node.rotation\n }\n}\n\nexport function drawNodeHighlightRect(\n r: SkiaRenderer,\n canvas: Canvas,\n graph: SceneGraph,\n nodeId: string,\n color: { r: number; g: number; b: number },\n opacity: number,\n extraPad = 0\n): boolean {\n const box = nodeScreenBox(r, graph, nodeId)\n if (!box) return false\n const { cx, cy, hw, hh } = box\n const pad = FLASH_PADDING + extraPad\n\n const paint = ensureFlashPaint(r)\n paint.setColor(r.ck.Color4f(color.r, color.g, color.b, opacity))\n paint.setStrokeWidth(FLASH_STROKE_WIDTH)\n\n canvas.save()\n if (box.rotation !== 0) canvas.rotate(box.rotation, cx, cy)\n const rect = r.ck.RRectXY(\n r.ck.LTRBRect(cx - hw - pad, cy - hh - pad, cx + hw + pad, cy + hh + pad),\n FLASH_RADIUS,\n FLASH_RADIUS\n )\n canvas.drawRRect(rect, paint)\n canvas.restore()\n return true\n}\n"],"mappings":";;AAQA,SAAgB,iBAAiB,GAAwB;CACvD,IAAI,CAAC,EAAE,aAAa;EAClB,EAAE,cAAc,IAAI,EAAE,GAAG,MAAM;EAC/B,EAAE,YAAY,SAAS,EAAE,GAAG,WAAW,MAAM;EAC7C,EAAE,YAAY,aAAa,IAAI;CACjC;CACA,OAAO,EAAE;AACX;AAWA,SAAgB,cACd,GACA,OACA,QACkB;CAClB,MAAM,OAAO,MAAM,QAAQ,MAAM;CACjC,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,MAAM,MAAM,oBAAoB,MAAM;CAC5C,OAAO;EACL,KAAK,IAAI,IAAI,KAAK,QAAQ,KAAK,EAAE,OAAO,EAAE;EAC1C,KAAK,IAAI,IAAI,KAAK,SAAS,KAAK,EAAE,OAAO,EAAE;EAC3C,IAAK,KAAK,QAAQ,IAAK,EAAE;EACzB,IAAK,KAAK,SAAS,IAAK,EAAE;EAC1B,UAAU,KAAK;CACjB;AACF;AAEA,SAAgB,sBACd,GACA,QACA,OACA,QACA,OACA,SACA,WAAW,GACF;CACT,MAAM,MAAM,cAAc,GAAG,OAAO,MAAM;CAC1C,IAAI,CAAC,KAAK,OAAO;CACjB,MAAM,EAAE,IAAI,IAAI,IAAI,OAAO;CAC3B,MAAM,MAAA,IAAsB;CAE5B,MAAM,QAAQ,iBAAiB,CAAC;CAChC,MAAM,SAAS,EAAE,GAAG,QAAQ,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAC/D,MAAM,eAAA,CAAiC;CAEvC,OAAO,KAAK;CACZ,IAAI,IAAI,aAAa,GAAG,OAAO,OAAO,IAAI,UAAU,IAAI,EAAE;CAC1D,MAAM,OAAO,EAAE,GAAG,QAChB,EAAE,GAAG,SAAS,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,KAAK,GAAG,GAAA,GAAA,CAG1E;CACA,OAAO,UAAU,MAAM,KAAK;CAC5B,OAAO,QAAQ;CACf,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { GuideOverlayState, GuidePreview, GuideSelection } from "./guides/types.js";
2
- import { DesignIssueHighlight, DesignIssueMarker, DesignIssueOverlay, DesignIssueSeverity, PlacedIssueMarker } from "./issues/types.js";
2
+ import { DesignIssueHighlight, DesignIssueSeverity } from "./issues/types.js";
3
3
  import { canMakeBooleanSourceNode, canMakeBooleanSourcePath, nodeHasVisibleStroke } from "./boolean.js";
4
4
  import { VectorFlattenProps, flattenNodesToVectorProps } from "./flatten.js";
5
5
  import { OutlinePiece, OutlinedLayer, canOutlineStroke, layersToOutline, outlineStrokeLayer } from "./outline-stroke.js";
@@ -8,11 +8,10 @@ import { computeGuideRedline } from "./guides/redlines.js";
8
8
  import { GuideHit, hitTestGuides } from "./guides/hit-test.js";
9
9
  import { canvasLabelForeground } from "./labels/color.js";
10
10
  import { ImagePreview, ImagePreviewDecoder } from "./images/previews.js";
11
- import { IssueMarkerLayoutOptions, IssueMarkerView, hitTestIssueMarkers, issueMarkerLabel, issueSeverityRank, layoutIssueMarkers } from "./issues/layout.js";
12
11
  import { PlacedStatusLabel, hitTestStatusLabels } from "./labels/status.js";
13
12
  import { CachedComponent, CachedSection, LabelCache } from "./labels/cache.js";
14
13
  import { withFigExportRuntime } from "./text/shape.js";
15
14
  import { DrawnFontAxes, DrawnFontAxis, drawnFontAxes } from "./text/font-families.js";
16
15
  import { PresenceCursor, RenderOverlays, RulerTheme, SelectionTheme } from "./renderer/types.js";
17
16
  import { SkiaRenderer } from "./renderer.js";
18
- export { type CachedComponent, type CachedSection, type DesignIssueHighlight, type DesignIssueMarker, type DesignIssueOverlay, type DesignIssueSeverity, type DrawnFontAxes, type DrawnFontAxis, type GuideHit, type GuideOverlayState, type GuidePreview, type GuideScreenSegment, type GuideSelection, type GuideViewport, type ImagePreview, type ImagePreviewDecoder, type IssueMarkerLayoutOptions, type IssueMarkerView, LabelCache, type OutlinePiece, type OutlinedLayer, type PlacedIssueMarker, type PlacedStatusLabel, type PresenceCursor, type RenderOverlays, type RulerTheme, type SelectionTheme, SkiaRenderer, type VectorFlattenProps, canMakeBooleanSourceNode, canMakeBooleanSourcePath, canOutlineStroke, canvasLabelForeground, computeGuideRedline, distanceToGuideSegment, drawnFontAxes, flattenNodesToVectorProps, getGuideScreenSegment, hitTestGuides, hitTestIssueMarkers, hitTestStatusLabels, issueMarkerLabel, issueSeverityRank, layersToOutline, layoutIssueMarkers, nodeHasVisibleStroke, outlineStrokeLayer, withFigExportRuntime };
17
+ export { type CachedComponent, type CachedSection, type DesignIssueHighlight, type DesignIssueSeverity, type DrawnFontAxes, type DrawnFontAxis, type GuideHit, type GuideOverlayState, type GuidePreview, type GuideScreenSegment, type GuideSelection, type GuideViewport, type ImagePreview, type ImagePreviewDecoder, LabelCache, type OutlinePiece, type OutlinedLayer, type PlacedStatusLabel, type PresenceCursor, type RenderOverlays, type RulerTheme, type SelectionTheme, SkiaRenderer, type VectorFlattenProps, canMakeBooleanSourceNode, canMakeBooleanSourcePath, canOutlineStroke, canvasLabelForeground, computeGuideRedline, distanceToGuideSegment, drawnFontAxes, flattenNodesToVectorProps, getGuideScreenSegment, hitTestGuides, hitTestStatusLabels, layersToOutline, nodeHasVisibleStroke, outlineStrokeLayer, withFigExportRuntime };
@@ -9,6 +9,5 @@ import { hitTestGuides } from "./guides/hit-test.js";
9
9
  import { canvasLabelForeground } from "./labels/color.js";
10
10
  import { LabelCache } from "./labels/cache.js";
11
11
  import { hitTestStatusLabels } from "./labels/status.js";
12
- import { hitTestIssueMarkers, issueMarkerLabel, issueSeverityRank, layoutIssueMarkers } from "./issues/layout.js";
13
12
  import { SkiaRenderer } from "./renderer.js";
14
- export { LabelCache, SkiaRenderer, canMakeBooleanSourceNode, canMakeBooleanSourcePath, canOutlineStroke, canvasLabelForeground, computeGuideRedline, distanceToGuideSegment, drawnFontAxes, flattenNodesToVectorProps, getGuideScreenSegment, hitTestGuides, hitTestIssueMarkers, hitTestStatusLabels, issueMarkerLabel, issueSeverityRank, layersToOutline, layoutIssueMarkers, nodeHasVisibleStroke, outlineStrokeLayer, withFigExportRuntime };
13
+ export { LabelCache, SkiaRenderer, canMakeBooleanSourceNode, canMakeBooleanSourcePath, canOutlineStroke, canvasLabelForeground, computeGuideRedline, distanceToGuideSegment, drawnFontAxes, flattenNodesToVectorProps, getGuideScreenSegment, hitTestGuides, hitTestStatusLabels, layersToOutline, nodeHasVisibleStroke, outlineStrokeLayer, withFigExportRuntime };
@@ -1,15 +1,11 @@
1
- import { DesignIssueHighlight, DesignIssueSeverity, PlacedIssueMarker } from "./types.js";
1
+ import { DesignIssueHighlight } from "./types.js";
2
2
  import { RotationPreview } from "../../geometry/types.js";
3
3
  import "../../geometry/index.js";
4
4
  import { SkiaRenderer } from "../renderer.js";
5
5
  import { Canvas } from "canvaskit-wasm";
6
6
  import { SceneGraph } from "@pairdraw/scene-graph";
7
- import { Color as Color$1 } from "@pairdraw/scene-graph/primitives";
8
7
  //#region src/canvas/issues/draw.d.ts
9
- declare function issueSeverityColor(severity: DesignIssueSeverity): Color$1;
10
8
  declare function drawIssueHighlight(r: SkiaRenderer, canvas: Canvas, graph: SceneGraph, highlight: DesignIssueHighlight | null | undefined, preview?: RotationPreview | null): void;
11
- /** Draws placed markers so the first placed, most severe marker ends up on top. */
12
- declare function drawIssueMarkers(r: SkiaRenderer, canvas: Canvas, placed: readonly PlacedIssueMarker[], hoveredKey: string | null | undefined): void;
13
9
  //#endregion
14
- export { drawIssueHighlight, drawIssueMarkers, issueSeverityColor };
10
+ export { drawIssueHighlight };
15
11
  //# sourceMappingURL=draw.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"draw.d.ts","names":[],"sources":["../../../src/canvas/issues/draw.ts"],"mappings":";;;;;;;;iBAgCgB,mBAAmB,UAAU,sBAAsB;iBAenD,mBACd,GAAG,cACH,QAAQ,QACR,OAAO,YACP,WAAW,yCACX,UAAU;;iBAgKI,iBACd,GAAG,cACH,QAAQ,QACR,iBAAiB,qBACjB"}
1
+ {"version":3,"file":"draw.d.ts","names":[],"sources":["../../../src/canvas/issues/draw.ts"],"mappings":";;;;;;;iBA8BgB,mBACd,GAAG,cACH,QAAQ,QACR,OAAO,YACP,WAAW,yCACX,UAAU"}
@@ -1,37 +1,13 @@
1
- import { ISSUE_ERROR_COLOR, ISSUE_HIGHLIGHT_FILL_ALPHA, ISSUE_HIGHLIGHT_STROKE_WIDTH, ISSUE_INFO_COLOR, ISSUE_MARKER_RING_WIDTH, ISSUE_WARNING_COLOR } from "../../constants.js";
1
+ import { ISSUE_ERROR_COLOR, ISSUE_HIGHLIGHT_FILL_ALPHA, ISSUE_HIGHLIGHT_STROKE_WIDTH, ISSUE_INFO_COLOR, ISSUE_WARNING_COLOR } from "../../constants.js";
2
2
  import { createSceneGeometry } from "../../geometry/scene.js";
3
3
  import { inNodeSpace, withScreenStroke } from "../overlays/outline.js";
4
- import { issueMarkerLabel } from "./layout.js";
5
4
  //#region src/canvas/issues/draw.ts
6
- const MARKER_SHADOW_SIGMA = 1.5;
7
- /** Half the base of an edge pin's chevron. */
8
- const EDGE_ARROW_HALF_WIDTH = 4;
9
- const MARKER_SHADOW_OFFSET_Y = 1;
10
- const MARKER_SHADOW_ALPHA = .3;
11
- const MARKER_HOVER_HALO = 3;
12
- const MARKER_HOVER_HALO_ALPHA = .28;
13
- /** Baseline below the vertical center for 10px Inter digits and the exclamation mark. */
14
- const MARKER_TEXT_BASELINE = 3.5;
15
5
  const TARGET_DASH = 3;
16
6
  function issueSeverityColor(severity) {
17
7
  if (severity === "error") return ISSUE_ERROR_COLOR;
18
8
  if (severity === "warning") return ISSUE_WARNING_COLOR;
19
9
  return ISSUE_INFO_COLOR;
20
10
  }
21
- /** Amber needs dark text; red and gray read best with white. */
22
- function issueSeverityForeground(severity) {
23
- return severity === "warning" ? {
24
- r: 0,
25
- g: 0,
26
- b: 0,
27
- a: .85
28
- } : {
29
- r: 1,
30
- g: 1,
31
- b: 1,
32
- a: 1
33
- };
34
- }
35
11
  function color4f(r, color, alpha = color.a) {
36
12
  return r.ck.Color4f(color.r, color.g, color.b, alpha);
37
13
  }
@@ -61,80 +37,7 @@ function drawIssueHighlight(r, canvas, graph, highlight, preview) {
61
37
  }
62
38
  });
63
39
  }
64
- /**
65
- * The chevron an edge pin points with: a triangle from the pill's border toward the issues,
66
- * outlined in white like the pill so it reads on any canvas.
67
- */
68
- function drawEdgeArrow(r, canvas, marker, color, ring) {
69
- const { rect, direction } = marker;
70
- if (!direction) return;
71
- const center = {
72
- x: rect.x + rect.width / 2,
73
- y: rect.y + rect.height / 2
74
- };
75
- const tx = direction.x === 0 ? Infinity : rect.width / 2 / Math.abs(direction.x);
76
- const ty = direction.y === 0 ? Infinity : rect.height / 2 / Math.abs(direction.y);
77
- const border = Math.min(tx, ty);
78
- const normal = {
79
- x: -direction.y,
80
- y: direction.x
81
- };
82
- const triangle = (reach, half) => {
83
- const path = new r.ck.PathBuilder();
84
- const base = border - 1;
85
- path.moveTo(center.x + direction.x * (border + reach), center.y + direction.y * (border + reach));
86
- path.lineTo(center.x + direction.x * base + normal.x * half, center.y + direction.y * base + normal.y * half);
87
- path.lineTo(center.x + direction.x * base - normal.x * half, center.y + direction.y * base - normal.y * half);
88
- path.close();
89
- return path.detachAndDelete();
90
- };
91
- const outline = triangle(5 + ring * 2, EDGE_ARROW_HALF_WIDTH + ring);
92
- const fill = triangle(5, EDGE_ARROW_HALF_WIDTH);
93
- r.auxFill.setColor(r.ck.WHITE);
94
- canvas.drawPath(outline, r.auxFill);
95
- r.auxFill.setColor(color4f(r, color));
96
- canvas.drawPath(fill, r.auxFill);
97
- outline.delete();
98
- fill.delete();
99
- }
100
- function drawMarker(r, canvas, marker, hovered) {
101
- const { rect } = marker;
102
- const radius = rect.height / 2;
103
- const color = issueSeverityColor(marker.severity);
104
- const ring = ISSUE_MARKER_RING_WIDTH;
105
- const shadow = r.ck.RRectXY(r.ck.LTRBRect(rect.x - ring, rect.y - ring + MARKER_SHADOW_OFFSET_Y, rect.x + rect.width + ring, rect.y + rect.height + ring + MARKER_SHADOW_OFFSET_Y), radius + ring, radius + ring);
106
- r.auxFill.setColor(r.ck.Color4f(0, 0, 0, MARKER_SHADOW_ALPHA));
107
- r.auxFill.setMaskFilter(r.getCachedMaskBlur(MARKER_SHADOW_SIGMA));
108
- canvas.drawRRect(shadow, r.auxFill);
109
- r.auxFill.setMaskFilter(null);
110
- if (hovered) {
111
- const halo = ring + MARKER_HOVER_HALO;
112
- r.auxFill.setColor(color4f(r, color, MARKER_HOVER_HALO_ALPHA));
113
- canvas.drawRRect(r.ck.RRectXY(r.ck.LTRBRect(rect.x - halo, rect.y - halo, rect.x + rect.width + halo, rect.y + rect.height + halo), radius + halo, radius + halo), r.auxFill);
114
- }
115
- if (marker.direction) drawEdgeArrow(r, canvas, marker, color, ring);
116
- r.auxFill.setColor(r.ck.WHITE);
117
- canvas.drawRRect(r.ck.RRectXY(r.ck.LTRBRect(rect.x - ring, rect.y - ring, rect.x + rect.width + ring, rect.y + rect.height + ring), radius + ring, radius + ring), r.auxFill);
118
- r.auxFill.setColor(color4f(r, color));
119
- canvas.drawRRect(r.ck.RRectXY(r.ck.LTRBRect(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height), radius, radius), r.auxFill);
120
- const font = r.sizeFont;
121
- if (!font) return;
122
- const label = issueMarkerLabel(marker.count);
123
- let textWidth = 0;
124
- for (const width of font.getGlyphWidths(font.getGlyphIDs(label))) textWidth += width;
125
- font.setEmbolden(true);
126
- r.auxFill.setColor(color4f(r, issueSeverityForeground(marker.severity)));
127
- canvas.drawText(label, rect.x + (rect.width - textWidth) / 2, rect.y + rect.height / 2 + MARKER_TEXT_BASELINE, r.auxFill, font);
128
- font.setEmbolden(false);
129
- }
130
- /** Draws placed markers so the first placed, most severe marker ends up on top. */
131
- function drawIssueMarkers(r, canvas, placed, hoveredKey) {
132
- for (let index = placed.length - 1; index >= 0; index--) {
133
- const marker = placed[index];
134
- drawMarker(r, canvas, marker, marker.key === hoveredKey);
135
- }
136
- }
137
40
  //#endregion
138
- export { drawIssueHighlight, drawIssueMarkers, issueSeverityColor };
41
+ export { drawIssueHighlight };
139
42
 
140
43
  //# sourceMappingURL=draw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"draw.js","names":[],"sources":["../../../src/canvas/issues/draw.ts"],"sourcesContent":["import type { Canvas } from 'canvaskit-wasm'\n\nimport type { SceneGraph } from '@pairdraw/scene-graph'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport { inNodeSpace, withScreenStroke } from '#core/canvas/overlays/outline'\nimport type { SkiaRenderer } from '#core/canvas/renderer'\nimport {\n ISSUE_EDGE_ARROW,\n ISSUE_ERROR_COLOR,\n ISSUE_HIGHLIGHT_FILL_ALPHA,\n ISSUE_HIGHLIGHT_STROKE_WIDTH,\n ISSUE_INFO_COLOR,\n ISSUE_MARKER_RING_WIDTH,\n ISSUE_WARNING_COLOR\n} from '#core/constants'\nimport { createSceneGeometry, type RotationPreview } from '#core/geometry'\n\nimport { issueMarkerLabel } from './layout'\nimport type { DesignIssueHighlight, DesignIssueSeverity, PlacedIssueMarker } from './types'\n\nconst MARKER_SHADOW_SIGMA = 1.5\n/** Half the base of an edge pin's chevron. */\nconst EDGE_ARROW_HALF_WIDTH = 4\nconst MARKER_SHADOW_OFFSET_Y = 1\nconst MARKER_SHADOW_ALPHA = 0.3\nconst MARKER_HOVER_HALO = 3\nconst MARKER_HOVER_HALO_ALPHA = 0.28\n/** Baseline below the vertical center for 10px Inter digits and the exclamation mark. */\nconst MARKER_TEXT_BASELINE = 3.5\nconst TARGET_DASH = 3\n\nexport function issueSeverityColor(severity: DesignIssueSeverity): Color {\n if (severity === 'error') return ISSUE_ERROR_COLOR\n if (severity === 'warning') return ISSUE_WARNING_COLOR\n return ISSUE_INFO_COLOR\n}\n\n/** Amber needs dark text; red and gray read best with white. */\nfunction issueSeverityForeground(severity: DesignIssueSeverity): Color {\n return severity === 'warning' ? { r: 0, g: 0, b: 0, a: 0.85 } : { r: 1, g: 1, b: 1, a: 1 }\n}\n\nfunction color4f(r: SkiaRenderer, color: Color, alpha = color.a) {\n return r.ck.Color4f(color.r, color.g, color.b, alpha)\n}\n\nexport function drawIssueHighlight(\n r: SkiaRenderer,\n canvas: Canvas,\n graph: SceneGraph,\n highlight: DesignIssueHighlight | null | undefined,\n preview?: RotationPreview | null\n): void {\n const node = highlight ? graph.getNode(highlight.nodeId) : undefined\n if (!highlight || !node) return\n const color = issueSeverityColor(highlight.severity)\n\n inNodeSpace(r, canvas, createSceneGeometry(graph, preview), node, () => {\n r.auxFill.setColor(color4f(r, color, ISSUE_HIGHLIGHT_FILL_ALPHA))\n canvas.drawRect(r.ck.LTRBRect(0, 0, node.width, node.height), r.auxFill)\n const stroke = { color: color4f(r, color), width: ISSUE_HIGHLIGHT_STROKE_WIDTH }\n withScreenStroke(r, stroke, (paint) => r.strokeNodeShape(canvas, node, paint))\n\n const minSize = highlight.minSize\n if (minSize && (node.width < minSize.width || node.height < minSize.height)) {\n const width = Math.max(node.width, minSize.width)\n const height = Math.max(node.height, minSize.height)\n const left = (node.width - width) / 2\n const top = (node.height - height) / 2\n const target = { color: color4f(r, color), dash: [TARGET_DASH, TARGET_DASH] as const }\n withScreenStroke(r, target, (paint) =>\n canvas.drawRect(r.ck.LTRBRect(left, top, left + width, top + height), paint)\n )\n }\n })\n}\n\n/**\n * The chevron an edge pin points with: a triangle from the pill's border toward the issues,\n * outlined in white like the pill so it reads on any canvas.\n */\nfunction drawEdgeArrow(\n r: SkiaRenderer,\n canvas: Canvas,\n marker: PlacedIssueMarker,\n color: Color,\n ring: number\n): void {\n const { rect, direction } = marker\n if (!direction) return\n const center = { x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 }\n const tx = direction.x === 0 ? Infinity : rect.width / 2 / Math.abs(direction.x)\n const ty = direction.y === 0 ? Infinity : rect.height / 2 / Math.abs(direction.y)\n const border = Math.min(tx, ty)\n const normal = { x: -direction.y, y: direction.x }\n const triangle = (reach: number, half: number) => {\n const path = new r.ck.PathBuilder()\n const base = border - 1\n path.moveTo(\n center.x + direction.x * (border + reach),\n center.y + direction.y * (border + reach)\n )\n path.lineTo(\n center.x + direction.x * base + normal.x * half,\n center.y + direction.y * base + normal.y * half\n )\n path.lineTo(\n center.x + direction.x * base - normal.x * half,\n center.y + direction.y * base - normal.y * half\n )\n path.close()\n return path.detachAndDelete()\n }\n const outline = triangle(ISSUE_EDGE_ARROW + ring * 2, EDGE_ARROW_HALF_WIDTH + ring)\n const fill = triangle(ISSUE_EDGE_ARROW, EDGE_ARROW_HALF_WIDTH)\n r.auxFill.setColor(r.ck.WHITE)\n canvas.drawPath(outline, r.auxFill)\n r.auxFill.setColor(color4f(r, color))\n canvas.drawPath(fill, r.auxFill)\n outline.delete()\n fill.delete()\n}\n\nfunction drawMarker(\n r: SkiaRenderer,\n canvas: Canvas,\n marker: PlacedIssueMarker,\n hovered: boolean\n): void {\n const { rect } = marker\n const radius = rect.height / 2\n const color = issueSeverityColor(marker.severity)\n const ring = ISSUE_MARKER_RING_WIDTH\n\n const shadow = r.ck.RRectXY(\n r.ck.LTRBRect(\n rect.x - ring,\n rect.y - ring + MARKER_SHADOW_OFFSET_Y,\n rect.x + rect.width + ring,\n rect.y + rect.height + ring + MARKER_SHADOW_OFFSET_Y\n ),\n radius + ring,\n radius + ring\n )\n r.auxFill.setColor(r.ck.Color4f(0, 0, 0, MARKER_SHADOW_ALPHA))\n r.auxFill.setMaskFilter(r.getCachedMaskBlur(MARKER_SHADOW_SIGMA))\n canvas.drawRRect(shadow, r.auxFill)\n r.auxFill.setMaskFilter(null)\n\n if (hovered) {\n const halo = ring + MARKER_HOVER_HALO\n r.auxFill.setColor(color4f(r, color, MARKER_HOVER_HALO_ALPHA))\n canvas.drawRRect(\n r.ck.RRectXY(\n r.ck.LTRBRect(\n rect.x - halo,\n rect.y - halo,\n rect.x + rect.width + halo,\n rect.y + rect.height + halo\n ),\n radius + halo,\n radius + halo\n ),\n r.auxFill\n )\n }\n\n if (marker.direction) drawEdgeArrow(r, canvas, marker, color, ring)\n\n r.auxFill.setColor(r.ck.WHITE)\n canvas.drawRRect(\n r.ck.RRectXY(\n r.ck.LTRBRect(\n rect.x - ring,\n rect.y - ring,\n rect.x + rect.width + ring,\n rect.y + rect.height + ring\n ),\n radius + ring,\n radius + ring\n ),\n r.auxFill\n )\n r.auxFill.setColor(color4f(r, color))\n canvas.drawRRect(\n r.ck.RRectXY(\n r.ck.LTRBRect(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height),\n radius,\n radius\n ),\n r.auxFill\n )\n\n const font = r.sizeFont\n if (!font) return\n const label = issueMarkerLabel(marker.count)\n let textWidth = 0\n for (const width of font.getGlyphWidths(font.getGlyphIDs(label))) textWidth += width\n font.setEmbolden(true)\n r.auxFill.setColor(color4f(r, issueSeverityForeground(marker.severity)))\n canvas.drawText(\n label,\n rect.x + (rect.width - textWidth) / 2,\n rect.y + rect.height / 2 + MARKER_TEXT_BASELINE,\n r.auxFill,\n font\n )\n font.setEmbolden(false)\n}\n\n/** Draws placed markers so the first placed, most severe marker ends up on top. */\nexport function drawIssueMarkers(\n r: SkiaRenderer,\n canvas: Canvas,\n placed: readonly PlacedIssueMarker[],\n hoveredKey: string | null | undefined\n): void {\n for (let index = placed.length - 1; index >= 0; index--) {\n const marker = placed[index]\n drawMarker(r, canvas, marker, marker.key === hoveredKey)\n }\n}\n"],"mappings":";;;;;AAqBA,MAAM,sBAAsB;;AAE5B,MAAM,wBAAwB;AAC9B,MAAM,yBAAyB;AAC/B,MAAM,sBAAsB;AAC5B,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;;AAEhC,MAAM,uBAAuB;AAC7B,MAAM,cAAc;AAEpB,SAAgB,mBAAmB,UAAsC;CACvE,IAAI,aAAa,SAAS,OAAO;CACjC,IAAI,aAAa,WAAW,OAAO;CACnC,OAAO;AACT;;AAGA,SAAS,wBAAwB,UAAsC;CACrE,OAAO,aAAa,YAAY;EAAE,GAAG;EAAG,GAAG;EAAG,GAAG;EAAG,GAAG;CAAK,IAAI;EAAE,GAAG;EAAG,GAAG;EAAG,GAAG;EAAG,GAAG;CAAE;AAC3F;AAEA,SAAS,QAAQ,GAAiB,OAAc,QAAQ,MAAM,GAAG;CAC/D,OAAO,EAAE,GAAG,QAAQ,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK;AACtD;AAEA,SAAgB,mBACd,GACA,QACA,OACA,WACA,SACM;CACN,MAAM,OAAO,YAAY,MAAM,QAAQ,UAAU,MAAM,IAAI,KAAA;CAC3D,IAAI,CAAC,aAAa,CAAC,MAAM;CACzB,MAAM,QAAQ,mBAAmB,UAAU,QAAQ;CAEnD,YAAY,GAAG,QAAQ,oBAAoB,OAAO,OAAO,GAAG,YAAY;EACtE,EAAE,QAAQ,SAAS,QAAQ,GAAG,OAAO,0BAA0B,CAAC;EAChE,OAAO,S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,IACF;CACA,KAAK,YAAY,KAAK;AACxB;;AAGA,SAAgB,iBACd,GACA,QACA,QACA,YACM;CACN,KAAK,IAAI,QAAQ,OAAO,SAAS,GAAG,SAAS,GAAG,SAAS;EACvD,MAAM,SAAS,OAAO;EACtB,WAAW,GAAG,QAAQ,QAAQ,OAAO,QAAQ,UAAU;CACzD;AACF"}
1
+ {"version":3,"file":"draw.js","names":[],"sources":["../../../src/canvas/issues/draw.ts"],"sourcesContent":["import type { Canvas } from 'canvaskit-wasm'\n\nimport type { SceneGraph } from '@pairdraw/scene-graph'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport { inNodeSpace, withScreenStroke } from '#core/canvas/overlays/outline'\nimport type { SkiaRenderer } from '#core/canvas/renderer'\nimport {\n ISSUE_ERROR_COLOR,\n ISSUE_HIGHLIGHT_FILL_ALPHA,\n ISSUE_HIGHLIGHT_STROKE_WIDTH,\n ISSUE_INFO_COLOR,\n ISSUE_WARNING_COLOR\n} from '#core/constants'\nimport { createSceneGeometry, type RotationPreview } from '#core/geometry'\n\nimport type { DesignIssueHighlight, DesignIssueSeverity } from './types'\n\nconst TARGET_DASH = 3\n\nfunction issueSeverityColor(severity: DesignIssueSeverity): Color {\n if (severity === 'error') return ISSUE_ERROR_COLOR\n if (severity === 'warning') return ISSUE_WARNING_COLOR\n return ISSUE_INFO_COLOR\n}\n\nfunction color4f(r: SkiaRenderer, color: Color, alpha = color.a) {\n return r.ck.Color4f(color.r, color.g, color.b, alpha)\n}\n\nexport function drawIssueHighlight(\n r: SkiaRenderer,\n canvas: Canvas,\n graph: SceneGraph,\n highlight: DesignIssueHighlight | null | undefined,\n preview?: RotationPreview | null\n): void {\n const node = highlight ? graph.getNode(highlight.nodeId) : undefined\n if (!highlight || !node) return\n const color = issueSeverityColor(highlight.severity)\n\n inNodeSpace(r, canvas, createSceneGeometry(graph, preview), node, () => {\n r.auxFill.setColor(color4f(r, color, ISSUE_HIGHLIGHT_FILL_ALPHA))\n canvas.drawRect(r.ck.LTRBRect(0, 0, node.width, node.height), r.auxFill)\n const stroke = { color: color4f(r, color), width: ISSUE_HIGHLIGHT_STROKE_WIDTH }\n withScreenStroke(r, stroke, (paint) => r.strokeNodeShape(canvas, node, paint))\n\n const minSize = highlight.minSize\n if (minSize && (node.width < minSize.width || node.height < minSize.height)) {\n const width = Math.max(node.width, minSize.width)\n const height = Math.max(node.height, minSize.height)\n const left = (node.width - width) / 2\n const top = (node.height - height) / 2\n const target = { color: color4f(r, color), dash: [TARGET_DASH, TARGET_DASH] as const }\n withScreenStroke(r, target, (paint) =>\n canvas.drawRect(r.ck.LTRBRect(left, top, left + width, top + height), paint)\n )\n }\n })\n}\n"],"mappings":";;;;AAkBA,MAAM,cAAc;AAEpB,SAAS,mBAAmB,UAAsC;CAChE,IAAI,aAAa,SAAS,OAAO;CACjC,IAAI,aAAa,WAAW,OAAO;CACnC,OAAO;AACT;AAEA,SAAS,QAAQ,GAAiB,OAAc,QAAQ,MAAM,GAAG;CAC/D,OAAO,EAAE,GAAG,QAAQ,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK;AACtD;AAEA,SAAgB,mBACd,GACA,QACA,OACA,WACA,SACM;CACN,MAAM,OAAO,YAAY,MAAM,QAAQ,UAAU,MAAM,IAAI,KAAA;CAC3D,IAAI,CAAC,aAAa,CAAC,MAAM;CACzB,MAAM,QAAQ,mBAAmB,UAAU,QAAQ;CAEnD,YAAY,GAAG,QAAQ,oBAAoB,OAAO,OAAO,GAAG,YAAY;EACtE,EAAE,QAAQ,SAAS,QAAQ,GAAG,OAAO,0BAA0B,CAAC;EAChE,OAAO,SAAS,EAAE,GAAG,SAAS,GAAG,GAAG,KAAK,OAAO,KAAK,MAAM,GAAG,EAAE,OAAO;EACvE,MAAM,SAAS;GAAE,OAAO,QAAQ,GAAG,KAAK;GAAG,OAAO;EAA6B;EAC/E,iBAAiB,GAAG,SAAS,UAAU,EAAE,gBAAgB,QAAQ,MAAM,KAAK,CAAC;EAE7E,MAAM,UAAU,UAAU;EAC1B,IAAI,YAAY,KAAK,QAAQ,QAAQ,SAAS,KAAK,SAAS,QAAQ,SAAS;GAC3E,MAAM,QAAQ,KAAK,IAAI,KAAK,OAAO,QAAQ,KAAK;GAChD,MAAM,SAAS,KAAK,IAAI,KAAK,QAAQ,QAAQ,MAAM;GACnD,MAAM,QAAQ,KAAK,QAAQ,SAAS;GACpC,MAAM,OAAO,KAAK,SAAS,UAAU;GACrC,MAAM,SAAS;IAAE,OAAO,QAAQ,GAAG,KAAK;IAAG,MAAM,CAAC,aAAa,WAAW;GAAW;GACrF,iBAAiB,GAAG,SAAS,UAC3B,OAAO,SAAS,EAAE,GAAG,SAAS,MAAM,KAAK,OAAO,OAAO,MAAM,MAAM,GAAG,KAAK,CAC7E;EACF;CACF,CAAC;AACH"}
@@ -1,13 +1,6 @@
1
- import { Rect, Vector } from "@pairdraw/scene-graph/primitives";
2
1
  //#region src/canvas/issues/types.d.ts
3
2
  type DesignIssueSeverity = 'error' | 'warning' | 'info';
4
- /** Issues reported on one layer, collapsed to what the canvas marker shows. */
5
- interface DesignIssueMarker {
6
- nodeId: string;
7
- severity: DesignIssueSeverity;
8
- count: number;
9
- }
10
- /** A layer the user is inspecting through a marker or an issue row. */
3
+ /** A layer the user is inspecting through an issue row. */
11
4
  interface DesignIssueHighlight {
12
5
  nodeId: string;
13
6
  severity: DesignIssueSeverity;
@@ -17,30 +10,6 @@ interface DesignIssueHighlight {
17
10
  height: number;
18
11
  };
19
12
  }
20
- interface DesignIssueOverlay {
21
- /** Layers to mark on the canvas; empty while markers are turned off. */
22
- markers: readonly DesignIssueMarker[];
23
- highlight: DesignIssueHighlight | null;
24
- /** `key` of the placed marker under the pointer. */
25
- hoveredMarkerKey: string | null;
26
- }
27
- /** A marker placed in screen space; nearby layers share one marker. */
28
- interface PlacedIssueMarker {
29
- /** Stable while the leading layer stays the same, for hover state. */
30
- key: string;
31
- nodeIds: string[];
32
- severity: DesignIssueSeverity;
33
- count: number;
34
- /** Screen-space rectangle in CSS pixels. */
35
- rect: Rect;
36
- /** Screen-space corner of the layer the marker is attached to. */
37
- anchor: Vector;
38
- /**
39
- * Set for an edge pin: issues outside the viewport, pinned to its edge. A unit vector from the
40
- * viewport center toward them; `nodeIds` are ordered most severe first, then nearest.
41
- */
42
- direction?: Vector;
43
- }
44
13
  //#endregion
45
- export { DesignIssueHighlight, DesignIssueMarker, DesignIssueOverlay, DesignIssueSeverity, PlacedIssueMarker };
14
+ export { DesignIssueHighlight, DesignIssueSeverity };
46
15
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/canvas/issues/types.ts"],"mappings":";;KAEY;;UAGK;EACf;EACA,UAAU;EACV;;;UAIe;EACf;EACA,UAAU;;EAEV;IAAY;IAAe;;;UAGZ;;EAEf,kBAAkB;EAClB,WAAW;;EAEX;;;UAIe;;EAEf;EACA;EACA,UAAU;EACV;;EAEA,MAAM;;EAEN,QAAQ;;;;;EAKR,YAAY"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/canvas/issues/types.ts"],"mappings":";KAAY;;UAGK;EACf;EACA,UAAU;;EAEV;IAAY;IAAe"}
@@ -1,8 +1,8 @@
1
- import { SkiaRenderer } from "../renderer.js";
1
+ import { SkiaRenderer } from "../../renderer.js";
2
2
  import { Canvas } from "canvaskit-wasm";
3
3
  import { SceneGraph } from "@pairdraw/scene-graph";
4
- //#region src/canvas/overlays/ai.d.ts
4
+ //#region src/canvas/overlays/ai/draw.d.ts
5
5
  declare function drawAIOverlays(r: SkiaRenderer, canvas: Canvas, graph: SceneGraph): void;
6
6
  //#endregion
7
7
  export { drawAIOverlays };
8
- //# sourceMappingURL=ai.d.ts.map
8
+ //# sourceMappingURL=draw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draw.d.ts","names":[],"sources":["../../../../src/canvas/overlays/ai/draw.ts"],"mappings":";;;;iBAgGgB,eAAe,GAAG,cAAc,QAAQ,QAAQ,OAAO"}