@pairdraw/vue 0.19.2 → 0.21.0

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 (477) hide show
  1. package/dist/canvas/CanvasRoot.vue.js +5 -0
  2. package/dist/canvas/CanvasRoot.vue.js.map +1 -1
  3. package/dist/canvas/auto-layout/value-edit.js +1 -1
  4. package/dist/canvas/auto-layout/value-edit.js.map +1 -1
  5. package/dist/canvas/eyedropper/index.d.ts +26 -0
  6. package/dist/canvas/eyedropper/index.d.ts.map +1 -0
  7. package/dist/canvas/eyedropper/index.js +62 -0
  8. package/dist/canvas/eyedropper/index.js.map +1 -0
  9. package/dist/canvas/eyedropper/sample.js +13 -0
  10. package/dist/canvas/eyedropper/sample.js.map +1 -0
  11. package/dist/canvas/eyedropper/use.d.ts +33 -0
  12. package/dist/canvas/eyedropper/use.d.ts.map +1 -0
  13. package/dist/canvas/eyedropper/use.js +52 -0
  14. package/dist/canvas/eyedropper/use.js.map +1 -0
  15. package/dist/canvas/pointer/drag-move.js +4 -0
  16. package/dist/canvas/pointer/drag-move.js.map +1 -1
  17. package/dist/canvas/surface/color-space.d.ts +1 -0
  18. package/dist/canvas/surface/color-space.d.ts.map +1 -1
  19. package/dist/canvas/surface/gl-surface.js +5 -1
  20. package/dist/canvas/surface/gl-surface.js.map +1 -1
  21. package/dist/canvas/surface/kit-loader.js +2 -3
  22. package/dist/canvas/surface/kit-loader.js.map +1 -1
  23. package/dist/canvas/surface/lifecycle.js +34 -3
  24. package/dist/canvas/surface/lifecycle.js.map +1 -1
  25. package/dist/canvas/surface/origin.js +14 -0
  26. package/dist/canvas/surface/origin.js.map +1 -0
  27. package/dist/canvas/surface/shader/plan.js +40 -0
  28. package/dist/canvas/surface/shader/plan.js.map +1 -0
  29. package/dist/canvas/surface/shader/playback.js +132 -36
  30. package/dist/canvas/surface/shader/playback.js.map +1 -1
  31. package/dist/canvas/surface/shader/stage.d.ts.map +1 -1
  32. package/dist/canvas/surface/shader/stage.js +42 -5
  33. package/dist/canvas/surface/shader/stage.js.map +1 -1
  34. package/dist/canvas/surface/types.d.ts +25 -0
  35. package/dist/canvas/surface/types.d.ts.map +1 -1
  36. package/dist/canvas/surface/use.js +3 -1
  37. package/dist/canvas/surface/use.js.map +1 -1
  38. package/dist/canvas/text-edit/textarea.d.ts +1 -0
  39. package/dist/canvas/text-edit/textarea.d.ts.map +1 -1
  40. package/dist/canvas/tools/registry.js +5 -1
  41. package/dist/canvas/tools/registry.js.map +1 -1
  42. package/dist/canvas/useCanvasInput.d.ts +144 -2
  43. package/dist/canvas/useCanvasInput.d.ts.map +1 -1
  44. package/dist/canvas/useCanvasInput.js +3 -2
  45. package/dist/canvas/useCanvasInput.js.map +1 -1
  46. package/dist/controls/appearance/use.d.ts +1 -1
  47. package/dist/controls/binding-provider/pairdraw.js +1 -1
  48. package/dist/controls/binding-provider/pairdraw.js.map +1 -1
  49. package/dist/controls/color-model/types.d.ts +6 -0
  50. package/dist/controls/color-model/types.d.ts.map +1 -1
  51. package/dist/controls/color-model/use.d.ts.map +1 -1
  52. package/dist/controls/color-model/use.js +5 -3
  53. package/dist/controls/color-model/use.js.map +1 -1
  54. package/dist/controls/document-colors/index.d.ts +2 -0
  55. package/dist/controls/document-colors/index.js +2 -0
  56. package/dist/controls/document-colors/use.d.ts +20 -0
  57. package/dist/controls/document-colors/use.d.ts.map +1 -0
  58. package/dist/controls/document-colors/use.js +35 -0
  59. package/dist/controls/document-colors/use.js.map +1 -0
  60. package/dist/controls/effects/helpers.d.ts +13 -2
  61. package/dist/controls/effects/helpers.d.ts.map +1 -1
  62. package/dist/controls/effects/helpers.js +89 -34
  63. package/dist/controls/effects/helpers.js.map +1 -1
  64. package/dist/controls/effects/index.d.ts +2 -1
  65. package/dist/controls/effects/index.js +2 -1
  66. package/dist/controls/effects/use.d.ts +9 -7
  67. package/dist/controls/effects/use.d.ts.map +1 -1
  68. package/dist/controls/effects/use.js +6 -3
  69. package/dist/controls/effects/use.js.map +1 -1
  70. package/dist/controls/okhcl/use.d.ts +2 -2
  71. package/dist/controls/shader/catalog.d.ts +11 -0
  72. package/dist/controls/shader/catalog.d.ts.map +1 -1
  73. package/dist/controls/shader/catalog.js +35 -6
  74. package/dist/controls/shader/catalog.js.map +1 -1
  75. package/dist/controls/shader/gallery.d.ts +1 -1
  76. package/dist/controls/shader/gallery.d.ts.map +1 -1
  77. package/dist/controls/shader/gallery.js +292 -0
  78. package/dist/controls/shader/gallery.js.map +1 -1
  79. package/dist/controls/shader/index.d.ts +3 -1
  80. package/dist/controls/shader/index.js +3 -1
  81. package/dist/controls/shader/shapes.d.ts +18 -0
  82. package/dist/controls/shader/shapes.d.ts.map +1 -0
  83. package/dist/controls/shader/shapes.js +227 -0
  84. package/dist/controls/shader/shapes.js.map +1 -0
  85. package/dist/controls/shader/stops.d.ts +22 -0
  86. package/dist/controls/shader/stops.d.ts.map +1 -0
  87. package/dist/controls/shader/stops.js +73 -0
  88. package/dist/controls/shader/stops.js.map +1 -0
  89. package/dist/controls/typography/features.d.ts +24 -0
  90. package/dist/controls/typography/features.d.ts.map +1 -0
  91. package/dist/controls/typography/features.js +130 -0
  92. package/dist/controls/typography/features.js.map +1 -0
  93. package/dist/controls/typography/index.d.ts +2 -1
  94. package/dist/controls/typography/index.js +2 -1
  95. package/dist/controls/typography/use.d.ts +6 -0
  96. package/dist/controls/typography/use.d.ts.map +1 -1
  97. package/dist/controls/typography/use.js +4 -1
  98. package/dist/controls/typography/use.js.map +1 -1
  99. package/dist/controls/variable-modes/helpers.d.ts.map +1 -1
  100. package/dist/controls/variable-modes/helpers.js +4 -2
  101. package/dist/controls/variable-modes/helpers.js.map +1 -1
  102. package/dist/editor/commands/registry.d.ts +4 -0
  103. package/dist/editor/commands/registry.d.ts.map +1 -1
  104. package/dist/editor/commands/registry.js +2 -0
  105. package/dist/editor/commands/registry.js.map +1 -1
  106. package/dist/editor/commands/selection.js +22 -0
  107. package/dist/editor/commands/selection.js.map +1 -1
  108. package/dist/editor/commands/types.d.ts +1 -1
  109. package/dist/editor/commands/types.d.ts.map +1 -1
  110. package/dist/editor/menu-model/canvas.d.ts.map +1 -1
  111. package/dist/editor/menu-model/canvas.js +7 -1
  112. package/dist/editor/menu-model/canvas.js.map +1 -1
  113. package/dist/editor/selection-capabilities/use.d.ts +2 -0
  114. package/dist/editor/selection-capabilities/use.js +5 -0
  115. package/dist/editor/selection-capabilities/use.js.map +1 -1
  116. package/dist/editor/selection-state/use.d.ts +1 -0
  117. package/dist/editor/selection-state/use.js +5 -0
  118. package/dist/editor/selection-state/use.js.map +1 -1
  119. package/dist/editor/tool-cursor/index.d.ts.map +1 -1
  120. package/dist/editor/tool-cursor/index.js +5 -1
  121. package/dist/editor/tool-cursor/index.js.map +1 -1
  122. package/dist/i18n/create.d.ts +1 -1
  123. package/dist/i18n/create.d.ts.map +1 -1
  124. package/dist/i18n/create.js +1 -0
  125. package/dist/i18n/create.js.map +1 -1
  126. package/dist/i18n/index.d.ts +5 -2
  127. package/dist/i18n/index.js +5 -2
  128. package/dist/i18n/locale.d.ts +5 -4
  129. package/dist/i18n/locale.d.ts.map +1 -1
  130. package/dist/i18n/locale.js +4 -0
  131. package/dist/i18n/locale.js.map +1 -1
  132. package/dist/i18n/locales/de/ai.json.js +68 -2
  133. package/dist/i18n/locales/de/commands.json.js +2 -0
  134. package/dist/i18n/locales/de/comments.json.js +1 -1
  135. package/dist/i18n/locales/de/design-check.json.js +13 -1
  136. package/dist/i18n/locales/de/design-memory.json.js +82 -0
  137. package/dist/i18n/locales/de/design-memory.json.js.map +1 -0
  138. package/dist/i18n/locales/de/fonts.json.js +10 -0
  139. package/dist/i18n/locales/de/index.js +5 -1
  140. package/dist/i18n/locales/de/index.js.map +1 -1
  141. package/dist/i18n/locales/de/menu.json.js +2 -0
  142. package/dist/i18n/locales/de/panels.json.js +109 -1
  143. package/dist/i18n/locales/de/settings.json.js +1 -0
  144. package/dist/i18n/locales/de/tools.json.js +3 -1
  145. package/dist/i18n/locales/de/variables/panel.json.js +20 -0
  146. package/dist/i18n/locales/de/variations.json.js +23 -0
  147. package/dist/i18n/locales/de/variations.json.js.map +1 -0
  148. package/dist/i18n/locales/es/ai.json.js +67 -1
  149. package/dist/i18n/locales/es/commands.json.js +2 -0
  150. package/dist/i18n/locales/es/comments.json.js +1 -1
  151. package/dist/i18n/locales/es/design-check.json.js +13 -1
  152. package/dist/i18n/locales/es/design-memory.json.js +82 -0
  153. package/dist/i18n/locales/es/design-memory.json.js.map +1 -0
  154. package/dist/i18n/locales/es/fonts.json.js +10 -0
  155. package/dist/i18n/locales/es/index.js +5 -1
  156. package/dist/i18n/locales/es/index.js.map +1 -1
  157. package/dist/i18n/locales/es/menu.json.js +2 -0
  158. package/dist/i18n/locales/es/panels.json.js +109 -1
  159. package/dist/i18n/locales/es/settings.json.js +1 -0
  160. package/dist/i18n/locales/es/tools.json.js +3 -1
  161. package/dist/i18n/locales/es/variables/panel.json.js +20 -0
  162. package/dist/i18n/locales/es/variations.json.js +23 -0
  163. package/dist/i18n/locales/es/variations.json.js.map +1 -0
  164. package/dist/i18n/locales/fr/ai.json.js +68 -2
  165. package/dist/i18n/locales/fr/commands.json.js +2 -0
  166. package/dist/i18n/locales/fr/comments.json.js +1 -1
  167. package/dist/i18n/locales/fr/design-check.json.js +13 -1
  168. package/dist/i18n/locales/fr/design-memory.json.js +82 -0
  169. package/dist/i18n/locales/fr/design-memory.json.js.map +1 -0
  170. package/dist/i18n/locales/fr/fonts.json.js +10 -0
  171. package/dist/i18n/locales/fr/index.js +5 -1
  172. package/dist/i18n/locales/fr/index.js.map +1 -1
  173. package/dist/i18n/locales/fr/menu.json.js +2 -0
  174. package/dist/i18n/locales/fr/panels.json.js +109 -1
  175. package/dist/i18n/locales/fr/settings.json.js +1 -0
  176. package/dist/i18n/locales/fr/tools.json.js +3 -1
  177. package/dist/i18n/locales/fr/variables/panel.json.js +20 -0
  178. package/dist/i18n/locales/fr/variations.json.js +23 -0
  179. package/dist/i18n/locales/fr/variations.json.js.map +1 -0
  180. package/dist/i18n/locales/id/agents.json.js +31 -0
  181. package/dist/i18n/locales/id/agents.json.js.map +1 -0
  182. package/dist/i18n/locales/id/ai.json.js +608 -0
  183. package/dist/i18n/locales/id/ai.json.js.map +1 -0
  184. package/dist/i18n/locales/id/automation.json.js +150 -0
  185. package/dist/i18n/locales/id/automation.json.js.map +1 -0
  186. package/dist/i18n/locales/id/browser.json.js +50 -0
  187. package/dist/i18n/locales/id/browser.json.js.map +1 -0
  188. package/dist/i18n/locales/id/chat-context.json.js +62 -0
  189. package/dist/i18n/locales/id/chat-context.json.js.map +1 -0
  190. package/dist/i18n/locales/id/cloud/editor.json.js +337 -0
  191. package/dist/i18n/locales/id/cloud/editor.json.js.map +1 -0
  192. package/dist/i18n/locales/id/cloud/portal.json.js +435 -0
  193. package/dist/i18n/locales/id/cloud/portal.json.js.map +1 -0
  194. package/dist/i18n/locales/id/code.json.js +43 -0
  195. package/dist/i18n/locales/id/code.json.js.map +1 -0
  196. package/dist/i18n/locales/id/collaboration.json.js +84 -0
  197. package/dist/i18n/locales/id/collaboration.json.js.map +1 -0
  198. package/dist/i18n/locales/id/commands.json.js +111 -0
  199. package/dist/i18n/locales/id/commands.json.js.map +1 -0
  200. package/dist/i18n/locales/id/comments.json.js +37 -0
  201. package/dist/i18n/locales/id/comments.json.js.map +1 -0
  202. package/dist/i18n/locales/id/common.json.js +51 -0
  203. package/dist/i18n/locales/id/common.json.js.map +1 -0
  204. package/dist/i18n/locales/id/credentials.json.js +21 -0
  205. package/dist/i18n/locales/id/credentials.json.js.map +1 -0
  206. package/dist/i18n/locales/id/design-check.json.js +101 -0
  207. package/dist/i18n/locales/id/design-check.json.js.map +1 -0
  208. package/dist/i18n/locales/id/design-memory.json.js +61 -0
  209. package/dist/i18n/locales/id/design-memory.json.js.map +1 -0
  210. package/dist/i18n/locales/id/diagnostics.json.js +78 -0
  211. package/dist/i18n/locales/id/diagnostics.json.js.map +1 -0
  212. package/dist/i18n/locales/id/editor.json.js +62 -0
  213. package/dist/i18n/locales/id/editor.json.js.map +1 -0
  214. package/dist/i18n/locales/id/explore.json.js +30 -0
  215. package/dist/i18n/locales/id/explore.json.js.map +1 -0
  216. package/dist/i18n/locales/id/figjam.json.js +39 -0
  217. package/dist/i18n/locales/id/figjam.json.js.map +1 -0
  218. package/dist/i18n/locales/id/files.json.js +86 -0
  219. package/dist/i18n/locales/id/files.json.js.map +1 -0
  220. package/dist/i18n/locales/id/fonts.json.js +54 -0
  221. package/dist/i18n/locales/id/fonts.json.js.map +1 -0
  222. package/dist/i18n/locales/id/index.js +85 -0
  223. package/dist/i18n/locales/id/index.js.map +1 -0
  224. package/dist/i18n/locales/id/media.json.js +52 -0
  225. package/dist/i18n/locales/id/media.json.js.map +1 -0
  226. package/dist/i18n/locales/id/menu.json.js +118 -0
  227. package/dist/i18n/locales/id/menu.json.js.map +1 -0
  228. package/dist/i18n/locales/id/pages.json.js +16 -0
  229. package/dist/i18n/locales/id/pages.json.js.map +1 -0
  230. package/dist/i18n/locales/id/panels.json.js +838 -0
  231. package/dist/i18n/locales/id/panels.json.js.map +1 -0
  232. package/dist/i18n/locales/id/recovery.json.js +36 -0
  233. package/dist/i18n/locales/id/recovery.json.js.map +1 -0
  234. package/dist/i18n/locales/id/rename.json.js +19 -0
  235. package/dist/i18n/locales/id/rename.json.js.map +1 -0
  236. package/dist/i18n/locales/id/rendering.json.js +18 -0
  237. package/dist/i18n/locales/id/rendering.json.js.map +1 -0
  238. package/dist/i18n/locales/id/settings.json.js +169 -0
  239. package/dist/i18n/locales/id/settings.json.js.map +1 -0
  240. package/dist/i18n/locales/id/shaders.json.js +24 -0
  241. package/dist/i18n/locales/id/shaders.json.js.map +1 -0
  242. package/dist/i18n/locales/id/shapes.json.js +48 -0
  243. package/dist/i18n/locales/id/shapes.json.js.map +1 -0
  244. package/dist/i18n/locales/id/slides.json.js +27 -0
  245. package/dist/i18n/locales/id/slides.json.js.map +1 -0
  246. package/dist/i18n/locales/id/statuses.json.js +38 -0
  247. package/dist/i18n/locales/id/statuses.json.js.map +1 -0
  248. package/dist/i18n/locales/id/storage.json.js +21 -0
  249. package/dist/i18n/locales/id/storage.json.js.map +1 -0
  250. package/dist/i18n/locales/id/tools.json.js +27 -0
  251. package/dist/i18n/locales/id/tools.json.js.map +1 -0
  252. package/dist/i18n/locales/id/updates.json.js +31 -0
  253. package/dist/i18n/locales/id/updates.json.js.map +1 -0
  254. package/dist/i18n/locales/id/variables/panel.json.js +175 -0
  255. package/dist/i18n/locales/id/variables/panel.json.js.map +1 -0
  256. package/dist/i18n/locales/id/variables/types.json.js +15 -0
  257. package/dist/i18n/locales/id/variables/types.json.js.map +1 -0
  258. package/dist/i18n/locales/id/variations.json.js +23 -0
  259. package/dist/i18n/locales/id/variations.json.js.map +1 -0
  260. package/dist/i18n/locales/it/ai.json.js +68 -2
  261. package/dist/i18n/locales/it/commands.json.js +2 -0
  262. package/dist/i18n/locales/it/comments.json.js +1 -1
  263. package/dist/i18n/locales/it/design-check.json.js +13 -1
  264. package/dist/i18n/locales/it/design-memory.json.js +82 -0
  265. package/dist/i18n/locales/it/design-memory.json.js.map +1 -0
  266. package/dist/i18n/locales/it/fonts.json.js +10 -0
  267. package/dist/i18n/locales/it/index.js +5 -1
  268. package/dist/i18n/locales/it/index.js.map +1 -1
  269. package/dist/i18n/locales/it/menu.json.js +2 -0
  270. package/dist/i18n/locales/it/panels.json.js +109 -1
  271. package/dist/i18n/locales/it/settings.json.js +1 -0
  272. package/dist/i18n/locales/it/tools.json.js +3 -1
  273. package/dist/i18n/locales/it/variables/panel.json.js +20 -0
  274. package/dist/i18n/locales/it/variations.json.js +23 -0
  275. package/dist/i18n/locales/it/variations.json.js.map +1 -0
  276. package/dist/i18n/locales/ja/ai.json.js +68 -2
  277. package/dist/i18n/locales/ja/commands.json.js +2 -0
  278. package/dist/i18n/locales/ja/comments.json.js +1 -1
  279. package/dist/i18n/locales/ja/design-check.json.js +13 -1
  280. package/dist/i18n/locales/ja/design-memory.json.js +61 -0
  281. package/dist/i18n/locales/ja/design-memory.json.js.map +1 -0
  282. package/dist/i18n/locales/ja/fonts.json.js +10 -0
  283. package/dist/i18n/locales/ja/index.js +5 -1
  284. package/dist/i18n/locales/ja/index.js.map +1 -1
  285. package/dist/i18n/locales/ja/menu.json.js +2 -0
  286. package/dist/i18n/locales/ja/panels.json.js +106 -1
  287. package/dist/i18n/locales/ja/settings.json.js +1 -0
  288. package/dist/i18n/locales/ja/tools.json.js +3 -1
  289. package/dist/i18n/locales/ja/variables/panel.json.js +20 -0
  290. package/dist/i18n/locales/ja/variations.json.js +23 -0
  291. package/dist/i18n/locales/ja/variations.json.js.map +1 -0
  292. package/dist/i18n/locales/pl/ai.json.js +68 -2
  293. package/dist/i18n/locales/pl/commands.json.js +2 -0
  294. package/dist/i18n/locales/pl/comments.json.js +1 -1
  295. package/dist/i18n/locales/pl/design-check.json.js +13 -1
  296. package/dist/i18n/locales/pl/design-memory.json.js +89 -0
  297. package/dist/i18n/locales/pl/design-memory.json.js.map +1 -0
  298. package/dist/i18n/locales/pl/fonts.json.js +10 -0
  299. package/dist/i18n/locales/pl/index.js +5 -1
  300. package/dist/i18n/locales/pl/index.js.map +1 -1
  301. package/dist/i18n/locales/pl/menu.json.js +2 -0
  302. package/dist/i18n/locales/pl/panels.json.js +110 -1
  303. package/dist/i18n/locales/pl/settings.json.js +1 -0
  304. package/dist/i18n/locales/pl/tools.json.js +3 -1
  305. package/dist/i18n/locales/pl/variables/panel.json.js +20 -0
  306. package/dist/i18n/locales/pl/variations.json.js +23 -0
  307. package/dist/i18n/locales/pl/variations.json.js.map +1 -0
  308. package/dist/i18n/locales/ru/ai.json.js +68 -2
  309. package/dist/i18n/locales/ru/commands.json.js +3 -1
  310. package/dist/i18n/locales/ru/comments.json.js +1 -1
  311. package/dist/i18n/locales/ru/design-check.json.js +13 -1
  312. package/dist/i18n/locales/ru/design-memory.json.js +89 -0
  313. package/dist/i18n/locales/ru/design-memory.json.js.map +1 -0
  314. package/dist/i18n/locales/ru/fonts.json.js +10 -0
  315. package/dist/i18n/locales/ru/index.js +5 -1
  316. package/dist/i18n/locales/ru/index.js.map +1 -1
  317. package/dist/i18n/locales/ru/menu.json.js +2 -0
  318. package/dist/i18n/locales/ru/panels.json.js +110 -1
  319. package/dist/i18n/locales/ru/settings.json.js +1 -0
  320. package/dist/i18n/locales/ru/tools.json.js +3 -1
  321. package/dist/i18n/locales/ru/variables/panel.json.js +20 -0
  322. package/dist/i18n/locales/ru/variations.json.js +23 -0
  323. package/dist/i18n/locales/ru/variations.json.js.map +1 -0
  324. package/dist/i18n/locales/zh-cn/ai.json.js +68 -2
  325. package/dist/i18n/locales/zh-cn/commands.json.js +2 -0
  326. package/dist/i18n/locales/zh-cn/comments.json.js +1 -1
  327. package/dist/i18n/locales/zh-cn/design-check.json.js +13 -1
  328. package/dist/i18n/locales/zh-cn/design-memory.json.js +61 -0
  329. package/dist/i18n/locales/zh-cn/design-memory.json.js.map +1 -0
  330. package/dist/i18n/locales/zh-cn/fonts.json.js +10 -0
  331. package/dist/i18n/locales/zh-cn/index.js +5 -1
  332. package/dist/i18n/locales/zh-cn/index.js.map +1 -1
  333. package/dist/i18n/locales/zh-cn/menu.json.js +2 -0
  334. package/dist/i18n/locales/zh-cn/panels.json.js +106 -1
  335. package/dist/i18n/locales/zh-cn/settings.json.js +1 -0
  336. package/dist/i18n/locales/zh-cn/tools.json.js +3 -1
  337. package/dist/i18n/locales/zh-cn/variables/panel.json.js +20 -0
  338. package/dist/i18n/locales/zh-cn/variations.json.js +23 -0
  339. package/dist/i18n/locales/zh-cn/variations.json.js.map +1 -0
  340. package/dist/i18n/messages/ai.d.ts +98 -2
  341. package/dist/i18n/messages/ai.d.ts.map +1 -1
  342. package/dist/i18n/messages/ai.js +70 -2
  343. package/dist/i18n/messages/ai.js.map +1 -1
  344. package/dist/i18n/messages/chat-usage.d.ts +34 -0
  345. package/dist/i18n/messages/chat-usage.d.ts.map +1 -0
  346. package/dist/i18n/messages/chat-usage.js +25 -0
  347. package/dist/i18n/messages/chat-usage.js.map +1 -0
  348. package/dist/i18n/messages/commands.d.ts +2 -0
  349. package/dist/i18n/messages/commands.d.ts.map +1 -1
  350. package/dist/i18n/messages/commands.js +2 -0
  351. package/dist/i18n/messages/commands.js.map +1 -1
  352. package/dist/i18n/messages/comments.d.ts +2 -2
  353. package/dist/i18n/messages/comments.js +2 -2
  354. package/dist/i18n/messages/comments.js.map +1 -1
  355. package/dist/i18n/messages/design-check.d.ts +12 -0
  356. package/dist/i18n/messages/design-check.d.ts.map +1 -1
  357. package/dist/i18n/messages/design-check.js +13 -1
  358. package/dist/i18n/messages/design-check.js.map +1 -1
  359. package/dist/i18n/messages/design-memory.d.ts +68 -0
  360. package/dist/i18n/messages/design-memory.d.ts.map +1 -0
  361. package/dist/i18n/messages/design-memory.js +85 -0
  362. package/dist/i18n/messages/design-memory.js.map +1 -0
  363. package/dist/i18n/messages/fonts.d.ts +12 -0
  364. package/dist/i18n/messages/fonts.d.ts.map +1 -1
  365. package/dist/i18n/messages/fonts.js +10 -0
  366. package/dist/i18n/messages/fonts.js.map +1 -1
  367. package/dist/i18n/messages/menu.d.ts +2 -0
  368. package/dist/i18n/messages/menu.d.ts.map +1 -1
  369. package/dist/i18n/messages/menu.js +2 -0
  370. package/dist/i18n/messages/menu.js.map +1 -1
  371. package/dist/i18n/messages/panels.d.ts +131 -0
  372. package/dist/i18n/messages/panels.d.ts.map +1 -1
  373. package/dist/i18n/messages/panels.js +109 -1
  374. package/dist/i18n/messages/panels.js.map +1 -1
  375. package/dist/i18n/messages/settings.d.ts +1 -0
  376. package/dist/i18n/messages/settings.d.ts.map +1 -1
  377. package/dist/i18n/messages/settings.js +1 -0
  378. package/dist/i18n/messages/settings.js.map +1 -1
  379. package/dist/i18n/messages/tools.d.ts +2 -0
  380. package/dist/i18n/messages/tools.d.ts.map +1 -1
  381. package/dist/i18n/messages/tools.js +3 -1
  382. package/dist/i18n/messages/tools.js.map +1 -1
  383. package/dist/i18n/messages/variables/panel.d.ts +24 -0
  384. package/dist/i18n/messages/variables/panel.d.ts.map +1 -1
  385. package/dist/i18n/messages/variables/panel.js +20 -0
  386. package/dist/i18n/messages/variables/panel.js.map +1 -1
  387. package/dist/i18n/messages/variations.d.ts +28 -0
  388. package/dist/i18n/messages/variations.d.ts.map +1 -0
  389. package/dist/i18n/messages/variations.js +26 -0
  390. package/dist/i18n/messages/variations.js.map +1 -0
  391. package/dist/i18n/messages.d.ts +405 -4
  392. package/dist/i18n/messages.d.ts.map +1 -1
  393. package/dist/i18n/messages.js +8 -2
  394. package/dist/i18n/messages.js.map +1 -1
  395. package/dist/i18n/useI18n.d.ts +1389 -13
  396. package/dist/i18n/useI18n.d.ts.map +1 -1
  397. package/dist/i18n/useI18n.js +8 -1
  398. package/dist/i18n/useI18n.js.map +1 -1
  399. package/dist/primitives/ColorPicker/ColorInputRoot.vue.d.ts +6 -0
  400. package/dist/primitives/ColorPicker/ColorInputRoot.vue.d.ts.map +1 -1
  401. package/dist/primitives/ColorPicker/ColorInputRoot.vue.js +3 -1
  402. package/dist/primitives/ColorPicker/ColorInputRoot.vue.js.map +1 -1
  403. package/dist/primitives/ColorPicker/ColorPickerRoot.vue.d.ts +11 -2
  404. package/dist/primitives/ColorPicker/ColorPickerRoot.vue.d.ts.map +1 -1
  405. package/dist/primitives/ColorPicker/ColorPickerRoot.vue.js +15 -5
  406. package/dist/primitives/ColorPicker/ColorPickerRoot.vue.js.map +1 -1
  407. package/dist/primitives/ColorPicker/index.d.ts +2 -1
  408. package/dist/primitives/ColorPicker/index.js +2 -1
  409. package/dist/primitives/ColorPicker/outside.d.ts +16 -0
  410. package/dist/primitives/ColorPicker/outside.d.ts.map +1 -0
  411. package/dist/primitives/ColorPicker/outside.js +20 -0
  412. package/dist/primitives/ColorPicker/outside.js.map +1 -0
  413. package/dist/primitives/Fill/FillRoot.vue.d.ts +2 -1
  414. package/dist/primitives/Fill/FillRoot.vue.d.ts.map +1 -1
  415. package/dist/primitives/Fill/FillRoot.vue.js +5 -2
  416. package/dist/primitives/Fill/FillRoot.vue.js.map +1 -1
  417. package/dist/primitives/Fill/FillSwatch.vue.d.ts.map +1 -1
  418. package/dist/primitives/Fill/FillSwatch.vue.js +2 -1
  419. package/dist/primitives/Fill/FillSwatch.vue.js.map +1 -1
  420. package/dist/primitives/Fill/types.d.ts +6 -1
  421. package/dist/primitives/Fill/types.d.ts.map +1 -1
  422. package/dist/primitives/Fill/useFill.d.ts +10 -4
  423. package/dist/primitives/Fill/useFill.d.ts.map +1 -1
  424. package/dist/primitives/Fill/useFill.js +14 -10
  425. package/dist/primitives/Fill/useFill.js.map +1 -1
  426. package/dist/primitives/FontPicker/FontPickerRoot.vue.d.ts +5 -0
  427. package/dist/primitives/FontPicker/FontPickerRoot.vue.d.ts.map +1 -1
  428. package/dist/primitives/FontPicker/FontPickerRoot.vue.js +63 -56
  429. package/dist/primitives/FontPicker/FontPickerRoot.vue.js.map +1 -1
  430. package/dist/primitives/GradientEditor/GradientEditorRoot.vue.d.ts +2 -1
  431. package/dist/primitives/GradientEditor/GradientEditorRoot.vue.d.ts.map +1 -1
  432. package/dist/primitives/GradientEditor/GradientEditorRoot.vue.js +5 -2
  433. package/dist/primitives/GradientEditor/GradientEditorRoot.vue.js.map +1 -1
  434. package/dist/primitives/GradientEditor/GradientEditorStop.vue.d.ts.map +1 -1
  435. package/dist/primitives/GradientEditor/GradientEditorStop.vue.js +4 -3
  436. package/dist/primitives/GradientEditor/GradientEditorStop.vue.js.map +1 -1
  437. package/dist/primitives/GradientEditor/types.d.ts +3 -1
  438. package/dist/primitives/GradientEditor/types.d.ts.map +1 -1
  439. package/dist/primitives/GradientEditor/useGradientStops.d.ts +5 -3
  440. package/dist/primitives/GradientEditor/useGradientStops.d.ts.map +1 -1
  441. package/dist/primitives/GradientEditor/useGradientStops.js +9 -4
  442. package/dist/primitives/GradientEditor/useGradientStops.js.map +1 -1
  443. package/dist/primitives/LayerTree/LayerTreeRoot.vue.d.ts +6 -1
  444. package/dist/primitives/LayerTree/LayerTreeRoot.vue.d.ts.map +1 -1
  445. package/dist/primitives/LayerTree/LayerTreeRoot.vue.js +16 -1
  446. package/dist/primitives/LayerTree/LayerTreeRoot.vue.js.map +1 -1
  447. package/dist/primitives/TypographyControls/TypographyControlsRoot.vue.d.ts +3 -0
  448. package/dist/primitives/TypographyControls/TypographyControlsRoot.vue.d.ts.map +1 -1
  449. package/dist/primitives/TypographyControls/TypographyControlsRoot.vue.js +3 -1
  450. package/dist/primitives/TypographyControls/TypographyControlsRoot.vue.js.map +1 -1
  451. package/dist/shared/assets/cursors/eyedropper.svg.js +6 -0
  452. package/dist/shared/assets/cursors/eyedropper.svg.js.map +1 -0
  453. package/dist/shared/frame.d.ts +28 -0
  454. package/dist/shared/frame.d.ts.map +1 -0
  455. package/dist/shared/frame.js +92 -0
  456. package/dist/shared/frame.js.map +1 -0
  457. package/dist/shared/input/auto-layout/drag.js +71 -0
  458. package/dist/shared/input/auto-layout/drag.js.map +1 -0
  459. package/dist/shared/input/{auto-layout-hover.d.ts → auto-layout/hover.d.ts} +3 -3
  460. package/dist/shared/input/auto-layout/hover.d.ts.map +1 -0
  461. package/dist/shared/input/{auto-layout-hover.js → auto-layout/hover.js} +42 -86
  462. package/dist/shared/input/auto-layout/hover.js.map +1 -0
  463. package/dist/shared/input/{auto-layout.js → auto-layout/index.js} +2 -2
  464. package/dist/shared/input/auto-layout/index.js.map +1 -0
  465. package/dist/shared/input/index.d.ts +1 -1
  466. package/dist/shared/input/index.js +1 -1
  467. package/dist/shared/input/move/drag.js +1 -1
  468. package/dist/shared/input/resize.js +1 -1
  469. package/dist/shared/input/select.js +5 -3
  470. package/dist/shared/input/select.js.map +1 -1
  471. package/dist/shared/input/types.d.ts +10 -2
  472. package/dist/shared/input/types.d.ts.map +1 -1
  473. package/dist/shared/input/types.js.map +1 -1
  474. package/package.json +19 -4
  475. package/dist/shared/input/auto-layout-hover.d.ts.map +0 -1
  476. package/dist/shared/input/auto-layout-hover.js.map +0 -1
  477. package/dist/shared/input/auto-layout.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { computed } from "vue";
2
- import { colorToCSS } from "@pairdraw/scene-graph/color";
1
+ import { computed, toValue } from "vue";
2
+ import { colorToPreviewCSS } from "@pairdraw/scene-graph/color";
3
3
  import { BLACK, TRANSPARENT } from "@pairdraw/scene-graph/constants";
4
4
  import { DEFAULT_GRADIENT_TRANSFORM, defaultGradientStops, defaultMeshPoints } from "@pairdraw/scene-graph/gradient";
5
5
  //#region src/primitives/Fill/useFill.ts
@@ -25,8 +25,8 @@ function effectiveColor(color, opacity) {
25
25
  a: color.a * opacity
26
26
  };
27
27
  }
28
- function gradientCSS(stops, opacity) {
29
- return stops.map((stop) => `${colorToCSS(effectiveColor(stop.color, opacity))} ${stop.position * 100}%`).join(", ");
28
+ function gradientCSS(stops, opacity, profile) {
29
+ return stops.map((stop) => `${colorToPreviewCSS(effectiveColor(stop.color, opacity), profile)} ${stop.position * 100}%`).join(", ");
30
30
  }
31
31
  function fillCategory(fill) {
32
32
  return FILL_CATEGORY[fill.type] ?? "SOLID";
@@ -37,15 +37,19 @@ function fillIsTransparent(fill) {
37
37
  if (fillCategory(fill) === "MESH") return fill.meshPoints?.some((point) => point.color.a < 1) ?? fillColor(fill, TRANSPARENT).a < 1;
38
38
  return fillColor(fill, TRANSPARENT).a < 1;
39
39
  }
40
- function fillSwatchBackground(fill) {
41
- if (fillCategory(fill) === "GRADIENT" && fill.gradientStops?.length) return `linear-gradient(to right, ${gradientCSS(fill.gradientStops, fill.opacity)})`;
42
- if (fillCategory(fill) === "MESH" && fill.meshPoints?.length) return `linear-gradient(to right, ${fill.meshPoints.map((point, index) => `${colorToCSS(effectiveColor(point.color, fill.opacity))} ${index / (fill.meshPoints?.length ?? 1) * 100}%`).join(", ")})`;
43
- return colorToCSS(effectiveColor(fillColor(fill, TRANSPARENT), fill.opacity));
40
+ /**
41
+ * A fill's swatch as CSS in `profile`: a Display P3 document's stored components are written in
42
+ * its own profile, so the swatch shows the color the canvas draws.
43
+ */
44
+ function fillSwatchBackground(fill, profile = "srgb") {
45
+ if (fillCategory(fill) === "GRADIENT" && fill.gradientStops?.length) return `linear-gradient(to right, ${gradientCSS(fill.gradientStops, fill.opacity, profile)})`;
46
+ if (fillCategory(fill) === "MESH" && fill.meshPoints?.length) return `linear-gradient(to right, ${fill.meshPoints.map((point, index) => `${colorToPreviewCSS(effectiveColor(point.color, fill.opacity), profile)} ${index / (fill.meshPoints?.length ?? 1) * 100}%`).join(", ")})`;
47
+ return colorToPreviewCSS(effectiveColor(fillColor(fill, TRANSPARENT), fill.opacity), profile);
44
48
  }
45
49
  /** Fill category state and immutable conversion actions without picker or popover behavior. */
46
- function useFill(fill, onUpdate) {
50
+ function useFill(fill, onUpdate, options = {}) {
47
51
  const category = computed(() => fillCategory(fill.value));
48
- const swatchBackground = computed(() => fillSwatchBackground(fill.value));
52
+ const swatchBackground = computed(() => fillSwatchBackground(fill.value, toValue(options.colorProfile) ?? "srgb"));
49
53
  const transparent = computed(() => fillIsTransparent(fill.value));
50
54
  function toSolid() {
51
55
  if (category.value === "SOLID") return;
@@ -1 +1 @@
1
- {"version":3,"file":"useFill.js","names":[],"sources":["../../../src/primitives/Fill/useFill.ts"],"sourcesContent":["import { computed } from 'vue'\nimport type { Ref } from 'vue'\n\nimport type { Fill, GradientStop } from '@pairdraw/scene-graph'\nimport { colorToCSS } from '@pairdraw/scene-graph/color'\nimport { BLACK, TRANSPARENT } from '@pairdraw/scene-graph/constants'\nimport {\n DEFAULT_GRADIENT_TRANSFORM,\n defaultGradientStops,\n defaultMeshPoints\n} from '@pairdraw/scene-graph/gradient'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport type { FillCategory } from './types'\n\nconst FILL_CATEGORY: Partial<Record<Fill['type'], FillCategory>> = {\n SOLID: 'SOLID',\n GRADIENT_LINEAR: 'GRADIENT',\n GRADIENT_RADIAL: 'GRADIENT',\n GRADIENT_ANGULAR: 'GRADIENT',\n GRADIENT_DIAMOND: 'GRADIENT',\n MESH: 'MESH',\n IMAGE: 'IMAGE'\n}\n\n/**\n * A non-solid fill carries no `color` at runtime even though the model types it as required,\n * because image and shader paints have no colour; the swatch treats that as no colour paint.\n */\nfunction fillColor(fill: Fill, fallback: Color): Color {\n return (fill as { color?: Color }).color ?? fallback\n}\n\nfunction effectiveColor(color: Color, opacity: number): Color {\n return { ...color, a: color.a * opacity }\n}\n\nfunction gradientCSS(stops: GradientStop[], opacity: number): string {\n return stops\n .map((stop) => `${colorToCSS(effectiveColor(stop.color, opacity))} ${stop.position * 100}%`)\n .join(', ')\n}\n\nexport function fillCategory(fill: Fill): FillCategory {\n return FILL_CATEGORY[fill.type] ?? 'SOLID'\n}\n\nexport function fillIsTransparent(fill: Fill): boolean {\n if (fill.opacity < 1) return true\n if (fillCategory(fill) === 'GRADIENT')\n return (\n fill.gradientStops?.some((stop) => stop.color.a < 1) ?? fillColor(fill, TRANSPARENT).a < 1\n )\n if (fillCategory(fill) === 'MESH')\n return fill.meshPoints?.some((point) => point.color.a < 1) ?? fillColor(fill, TRANSPARENT).a < 1\n return fillColor(fill, TRANSPARENT).a < 1\n}\n\nexport function fillSwatchBackground(fill: Fill): string {\n if (fillCategory(fill) === 'GRADIENT' && fill.gradientStops?.length) {\n return `linear-gradient(to right, ${gradientCSS(fill.gradientStops, fill.opacity)})`\n }\n if (fillCategory(fill) === 'MESH' && fill.meshPoints?.length) {\n const stops = fill.meshPoints\n .map(\n (point, index) =>\n `${colorToCSS(effectiveColor(point.color, fill.opacity))} ${(index / (fill.meshPoints?.length ?? 1)) * 100}%`\n )\n .join(', ')\n return `linear-gradient(to right, ${stops})`\n }\n return colorToCSS(effectiveColor(fillColor(fill, TRANSPARENT), fill.opacity))\n}\n\n/** Fill category state and immutable conversion actions without picker or popover behavior. */\nexport function useFill(fill: Ref<Fill>, onUpdate: (fill: Fill) => void) {\n const category = computed(() => fillCategory(fill.value))\n const swatchBackground = computed(() => fillSwatchBackground(fill.value))\n const transparent = computed(() => fillIsTransparent(fill.value))\n\n function toSolid() {\n if (category.value === 'SOLID') return\n const color =\n fill.value.gradientStops?.[0]?.color ??\n fill.value.meshPoints?.[0]?.color ??\n fillColor(fill.value, BLACK)\n onUpdate({ ...fill.value, type: 'SOLID', color: { ...color } })\n }\n\n function toGradient() {\n if (category.value === 'GRADIENT') return\n const gradientStops = fill.value.gradientStops?.length\n ? structuredClone(fill.value.gradientStops)\n : defaultGradientStops(fillColor(fill.value, BLACK))\n onUpdate({\n ...fill.value,\n type: 'GRADIENT_LINEAR',\n gradientStops,\n gradientTransform: fill.value.gradientTransform ?? { ...DEFAULT_GRADIENT_TRANSFORM }\n })\n }\n\n function toMesh() {\n if (category.value === 'MESH') return\n const color = fill.value.meshPoints?.[0]?.color ?? fillColor(fill.value, BLACK)\n onUpdate({\n ...fill.value,\n type: 'MESH',\n meshColumns: 1,\n meshRows: 1,\n meshPoints: defaultMeshPoints(color)\n })\n }\n\n function toImage() {\n if (category.value === 'IMAGE') return\n onUpdate({ ...fill.value, type: 'IMAGE' })\n }\n\n const actions = { toSolid, toGradient, toMesh, toImage }\n\n return {\n category,\n swatchBackground,\n transparent,\n actions,\n toSolid,\n toGradient,\n toMesh,\n toImage\n }\n}\n"],"mappings":";;;;;AAeA,MAAM,gBAA6D;CACjE,OAAO;CACP,iBAAiB;CACjB,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,MAAM;CACN,OAAO;AACT;;;;;AAMA,SAAS,UAAU,MAAY,UAAwB;CACrD,OAAQ,KAA2B,SAAS;AAC9C;AAEA,SAAS,eAAe,OAAc,SAAwB;CAC5D,OAAO;EAAE,GAAG;EAAO,GAAG,MAAM,IAAI;CAAQ;AAC1C;AAEA,SAAS,YAAY,OAAuB,SAAyB;CACnE,OAAO,MACJ,KAAK,SAAS,GAAG,WAAW,eAAe,KAAK,OAAO,OAAO,CAAC,EAAE,GAAG,KA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,KAAK,MAAM,aAAa,EAAE,EAAE,SAC5B,UAAU,KAAK,OAAO,KAAK;EAC7B,SAAS;GAAE,GAAG,KAAK;GAAO,MAAM;GAAS,OAAO,EAAE,GAAG,MAAM;EAAE,CAAC;CAChE;CAEA,SAAS,aAAa;EACpB,IAAI,SAAS,UAAU,YAAY;EACnC,MAAM,gBAAgB,KAAK,MAAM,eAAe,SAC5C,gBAAgB,KAAK,MAAM,aAAa,IACxC,qBAAqB,UAAU,KAAK,OAAO,KAAK,CAAC;EACrD,SAAS;GACP,GAAG,KAAK;GACR,MAAM;GACN;GACA,mBAAmB,KAAK,MAAM,qBAAqB,EAAE,GAAG,2BAA2B;EACrF,CAAC;CACH;CAEA,SAAS,SAAS;EAChB,IAAI,SAAS,UAAU,QAAQ;EAC/B,MAAM,QAAQ,KAAK,MAAM,aAAa,EAAE,EAAE,SAAS,UAAU,KAAK,OAAO,KAAK;EAC9E,SAAS;GACP,GAAG,KAAK;GACR,MAAM;GACN,aAAa;GACb,UAAU;GACV,YAAY,kBAAkB,KAAK;EACrC,CAAC;CACH;CAEA,SAAS,UAAU;EACjB,IAAI,SAAS,UAAU,SAAS;EAChC,SAAS;GAAE,GAAG,KAAK;GAAO,MAAM;EAAQ,CAAC;CAC3C;CAIA,OAAO;EACL;EACA;EACA;EACA,SAAA;GANgB;GAAS;GAAY;GAAQ;EAMvC;EACN;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useFill.js","names":[],"sources":["../../../src/primitives/Fill/useFill.ts"],"sourcesContent":["import { computed, toValue } from 'vue'\nimport type { MaybeRefOrGetter, Ref } from 'vue'\n\nimport type { DocumentColorSpace, Fill, GradientStop } from '@pairdraw/scene-graph'\nimport { colorToPreviewCSS } from '@pairdraw/scene-graph/color'\nimport { BLACK, TRANSPARENT } from '@pairdraw/scene-graph/constants'\nimport {\n DEFAULT_GRADIENT_TRANSFORM,\n defaultGradientStops,\n defaultMeshPoints\n} from '@pairdraw/scene-graph/gradient'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport type { FillCategory } from './types'\n\nconst FILL_CATEGORY: Partial<Record<Fill['type'], FillCategory>> = {\n SOLID: 'SOLID',\n GRADIENT_LINEAR: 'GRADIENT',\n GRADIENT_RADIAL: 'GRADIENT',\n GRADIENT_ANGULAR: 'GRADIENT',\n GRADIENT_DIAMOND: 'GRADIENT',\n MESH: 'MESH',\n IMAGE: 'IMAGE'\n}\n\n/**\n * A non-solid fill carries no `color` at runtime even though the model types it as required,\n * because image and shader paints have no colour; the swatch treats that as no colour paint.\n */\nfunction fillColor(fill: Fill, fallback: Color): Color {\n return (fill as { color?: Color }).color ?? fallback\n}\n\nfunction effectiveColor(color: Color, opacity: number): Color {\n return { ...color, a: color.a * opacity }\n}\n\nfunction gradientCSS(stops: GradientStop[], opacity: number, profile: DocumentColorSpace): string {\n return stops\n .map(\n (stop) =>\n `${colorToPreviewCSS(effectiveColor(stop.color, opacity), profile)} ${stop.position * 100}%`\n )\n .join(', ')\n}\n\nexport function fillCategory(fill: Fill): FillCategory {\n return FILL_CATEGORY[fill.type] ?? 'SOLID'\n}\n\nexport function fillIsTransparent(fill: Fill): boolean {\n if (fill.opacity < 1) return true\n if (fillCategory(fill) === 'GRADIENT')\n return (\n fill.gradientStops?.some((stop) => stop.color.a < 1) ?? fillColor(fill, TRANSPARENT).a < 1\n )\n if (fillCategory(fill) === 'MESH')\n return fill.meshPoints?.some((point) => point.color.a < 1) ?? fillColor(fill, TRANSPARENT).a < 1\n return fillColor(fill, TRANSPARENT).a < 1\n}\n\n/**\n * A fill's swatch as CSS in `profile`: a Display P3 document's stored components are written in\n * its own profile, so the swatch shows the color the canvas draws.\n */\nexport function fillSwatchBackground(fill: Fill, profile: DocumentColorSpace = 'srgb'): string {\n if (fillCategory(fill) === 'GRADIENT' && fill.gradientStops?.length) {\n return `linear-gradient(to right, ${gradientCSS(fill.gradientStops, fill.opacity, profile)})`\n }\n if (fillCategory(fill) === 'MESH' && fill.meshPoints?.length) {\n const stops = fill.meshPoints\n .map(\n (point, index) =>\n `${colorToPreviewCSS(effectiveColor(point.color, fill.opacity), profile)} ${(index / (fill.meshPoints?.length ?? 1)) * 100}%`\n )\n .join(', ')\n return `linear-gradient(to right, ${stops})`\n }\n return colorToPreviewCSS(effectiveColor(fillColor(fill, TRANSPARENT), fill.opacity), profile)\n}\n\n/** Fill category state and immutable conversion actions without picker or popover behavior. */\nexport function useFill(\n fill: Ref<Fill>,\n onUpdate: (fill: Fill) => void,\n options: { colorProfile?: MaybeRefOrGetter<DocumentColorSpace | undefined> } = {}\n) {\n const category = computed(() => fillCategory(fill.value))\n const swatchBackground = computed(() =>\n fillSwatchBackground(fill.value, toValue(options.colorProfile) ?? 'srgb')\n )\n const transparent = computed(() => fillIsTransparent(fill.value))\n\n function toSolid() {\n if (category.value === 'SOLID') return\n const color =\n fill.value.gradientStops?.[0]?.color ??\n fill.value.meshPoints?.[0]?.color ??\n fillColor(fill.value, BLACK)\n onUpdate({ ...fill.value, type: 'SOLID', color: { ...color } })\n }\n\n function toGradient() {\n if (category.value === 'GRADIENT') return\n const gradientStops = fill.value.gradientStops?.length\n ? structuredClone(fill.value.gradientStops)\n : defaultGradientStops(fillColor(fill.value, BLACK))\n onUpdate({\n ...fill.value,\n type: 'GRADIENT_LINEAR',\n gradientStops,\n gradientTransform: fill.value.gradientTransform ?? { ...DEFAULT_GRADIENT_TRANSFORM }\n })\n }\n\n function toMesh() {\n if (category.value === 'MESH') return\n const color = fill.value.meshPoints?.[0]?.color ?? fillColor(fill.value, BLACK)\n onUpdate({\n ...fill.value,\n type: 'MESH',\n meshColumns: 1,\n meshRows: 1,\n meshPoints: defaultMeshPoints(color)\n })\n }\n\n function toImage() {\n if (category.value === 'IMAGE') return\n onUpdate({ ...fill.value, type: 'IMAGE' })\n }\n\n const actions = { toSolid, toGradient, toMesh, toImage }\n\n return {\n category,\n swatchBackground,\n transparent,\n actions,\n toSolid,\n toGradient,\n toMesh,\n toImage\n }\n}\n"],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,SAAS;GAAE,GAAG,KAAK;GAAO,MAAM;EAAQ,CAAC;CAC3C;CAIA,OAAO;EACL;EACA;EACA;EACA,SAAA;GANgB;GAAS;GAAY;GAAQ;EAMvC;EACN;EACA;EACA;EACA;CACF;AACF"}
@@ -11,6 +11,7 @@ type __VLS_Props = {
11
11
  emptyFontsText?: string;
12
12
  emptyFontsHint?: string;
13
13
  };
14
+ declare function closeMenu(): void;
14
15
  type __VLS_ModelProps = {
15
16
  modelValue: string;
16
17
  };
@@ -26,6 +27,8 @@ declare var __VLS_23: {
26
27
  selected: boolean;
27
28
  }, __VLS_75: {
28
29
  selected: boolean;
30
+ }, __VLS_77: {
31
+ close: typeof closeMenu;
29
32
  };
30
33
  type __VLS_Slots = {} & {
31
34
  trigger?: (props: typeof __VLS_23) => any;
@@ -35,6 +38,8 @@ type __VLS_Slots = {} & {
35
38
  item?: (props: typeof __VLS_67) => any;
36
39
  } & {
37
40
  indicator?: (props: typeof __VLS_75) => any;
41
+ } & {
42
+ footer?: (props: typeof __VLS_77) => any;
38
43
  };
39
44
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
40
45
  select: (family: string) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"FontPickerRoot.vue.d.ts","names":[],"sources":["../../../src/primitives/FontPicker/FontPickerRoot.vue"],"mappings":";;;;KAuNK;EACH,oBAAoB,mBAAmB;EACvC,kBAAkB;EAClB,KAAK;EACL;EACA;EACA;EACA;;KA2DG;EACL;;KAMK,oBAAoB,cAAc;YA6ThB;;;GAA0C;;GAAqB;;;;GAAqB;;;KACtG;EACD,WAAW,cAAc;;EACzB,UAAU,cAAc;;EACxB,QAAQ,cAAc;;EACtB,aAAa,cAAc;;cAQzB,0BAAU,gBAAA,iDAAA,qCAAA;;;;;;0CAGd;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
1
+ {"version":3,"file":"FontPickerRoot.vue.d.ts","names":[],"sources":["../../../src/primitives/FontPicker/FontPickerRoot.vue"],"mappings":";;;;KA4NK;EACH,oBAAoB,mBAAmB;EACvC,kBAAkB;EAClB,KAAK;EACL;EACA;EACA;EACA;;iBAoCO;KA2BJ;EACL;;KAMK,oBAAoB,cAAc;YAiUhB;;;GAA0C;;GAAqB;;;;GAAqB;;GAAqB;gBAAA;;KAC3H;EACD,WAAW,cAAc;;EACzB,UAAU,cAAc;;EACxB,QAAQ,cAAc;;EACtB,aAAa,cAAc;;EAC3B,UAAU,cAAc;;cAQtB,0BAAU,gBAAA,iDAAA,qCAAA;;;;;;0CAGd;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
@@ -49,6 +49,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
49
49
  });
50
50
  const { portalActive } = useRetainedPopup(open);
51
51
  const root = useTemplateRef("root");
52
+ function closeMenu() {
53
+ open.value = false;
54
+ }
52
55
  watch(() => open.value && !loading.value && filtered.value.length > 0, async (ready) => {
53
56
  if (!ready || searchTerm.value) return;
54
57
  await nextTick();
@@ -97,65 +100,69 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
97
100
  ref: contentRef,
98
101
  onVnodeMounted: focusSearchInput
99
102
  }, {
100
- default: withCtx(() => [renderSlot(_ctx.$slots, "search", { searchTerm: unref(searchTerm) }, () => [createVNode(unref(ComboboxInput), {
101
- modelValue: unref(searchTerm),
102
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchTerm) ? searchTerm.value = $event : null),
103
- "display-value": () => "",
104
- class: normalizeClass(__props.ui?.search),
105
- placeholder: __props.searchPlaceholder,
106
- autocomplete: "off",
107
- autocorrect: "off",
108
- autocapitalize: "off",
109
- spellcheck: "false"
110
- }, null, 8, [
111
- "modelValue",
112
- "class",
113
- "placeholder"
114
- ])]), createVNode(unref(ComboboxViewport), { class: normalizeClass(__props.ui?.viewport ?? "max-h-72 overflow-y-auto") }, {
115
- default: withCtx(() => [createVNode(unref(ComboboxVirtualizer), {
116
- options: unref(filtered),
117
- "text-content": (option) => option.family,
118
- "estimate-size": 36
119
- }, {
120
- default: withCtx(({ option }) => [createVNode(unref(ComboboxItem), {
121
- value: option.family,
122
- class: normalizeClass(__props.ui?.item),
123
- style: normalizeStyle({ fontFamily: `'${option.family}', sans-serif` })
103
+ default: withCtx(() => [
104
+ renderSlot(_ctx.$slots, "search", { searchTerm: unref(searchTerm) }, () => [createVNode(unref(ComboboxInput), {
105
+ modelValue: unref(searchTerm),
106
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchTerm) ? searchTerm.value = $event : null),
107
+ "display-value": () => "",
108
+ class: normalizeClass(__props.ui?.search),
109
+ placeholder: __props.searchPlaceholder,
110
+ autocomplete: "off",
111
+ autocorrect: "off",
112
+ autocapitalize: "off",
113
+ spellcheck: "false"
114
+ }, null, 8, [
115
+ "modelValue",
116
+ "class",
117
+ "placeholder"
118
+ ])]),
119
+ createVNode(unref(ComboboxViewport), { class: normalizeClass(__props.ui?.viewport ?? "max-h-72 overflow-y-auto") }, {
120
+ default: withCtx(() => [createVNode(unref(ComboboxVirtualizer), {
121
+ options: unref(filtered),
122
+ "text-content": (option) => option.family,
123
+ "estimate-size": 36
124
124
  }, {
125
- default: withCtx(() => [renderSlot(_ctx.$slots, "item", {
126
- family: option.family,
127
- source: option.source,
128
- selected: option.family === modelValue.value
129
- }, () => [createVNode(unref(ComboboxItemIndicator), null, {
130
- default: withCtx(() => [renderSlot(_ctx.$slots, "indicator", { selected: option.family === modelValue.value })]),
125
+ default: withCtx(({ option }) => [createVNode(unref(ComboboxItem), {
126
+ value: option.family,
127
+ class: normalizeClass(__props.ui?.item),
128
+ style: normalizeStyle({ fontFamily: `'${option.family}', sans-serif` })
129
+ }, {
130
+ default: withCtx(() => [renderSlot(_ctx.$slots, "item", {
131
+ family: option.family,
132
+ source: option.source,
133
+ selected: option.family === modelValue.value
134
+ }, () => [createVNode(unref(ComboboxItemIndicator), null, {
135
+ default: withCtx(() => [renderSlot(_ctx.$slots, "indicator", { selected: option.family === modelValue.value })]),
136
+ _: 2
137
+ }, 1024), createElementVNode("span", _hoisted_2, toDisplayString(option.family), 1)])]),
131
138
  _: 2
132
- }, 1024), createElementVNode("span", _hoisted_2, toDisplayString(option.family), 1)])]),
133
- _: 2
134
- }, 1032, [
135
- "value",
136
- "class",
137
- "style"
138
- ])]),
139
+ }, 1032, [
140
+ "value",
141
+ "class",
142
+ "style"
143
+ ])]),
144
+ _: 3
145
+ }, 8, ["options", "text-content"]), unref(filtered).length === 0 && unref(searchTerm) ? (openBlock(), createElementBlock("div", {
146
+ key: 0,
147
+ class: normalizeClass(__props.ui?.empty)
148
+ }, toDisplayString(__props.emptySearchText ?? "No fonts found"), 3)) : unref(filtered).length === 0 ? (openBlock(), createElementBlock("div", {
149
+ key: 1,
150
+ class: normalizeClass(__props.ui?.empty)
151
+ }, [createElementVNode("div", null, [
152
+ unref(accessState) === "prompt" ? (openBlock(), createElementBlock("p", _hoisted_3, " Allow local font access to browse installed fonts. ")) : unref(accessState) === "denied" ? (openBlock(), createElementBlock("p", _hoisted_4, " Local font access is blocked for this site. ")) : unref(accessState) === "unsupported" ? (openBlock(), createElementBlock("p", _hoisted_5, " Local fonts are not available in this browser. ")) : (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(__props.emptyFontsText ?? "No local fonts available."), 1)),
153
+ __props.emptyFontsHint ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString(__props.emptyFontsHint), 1)) : createCommentVNode("v-if", true),
154
+ unref(accessState) === "prompt" ? (openBlock(), createElementBlock("button", {
155
+ key: 5,
156
+ type: "button",
157
+ class: normalizeClass(__props.ui?.emptyAction),
158
+ disabled: unref(loading),
159
+ onClick: _cache[1] || (_cache[1] = (...args) => unref(requestAccess) && unref(requestAccess)(...args))
160
+ }, toDisplayString(unref(loading) ? "Loading…" : "Allow local fonts"), 11, _hoisted_8)) : createCommentVNode("v-if", true)
161
+ ])], 2)) : createCommentVNode("v-if", true)]),
139
162
  _: 3
140
- }, 8, ["options", "text-content"]), unref(filtered).length === 0 && unref(searchTerm) ? (openBlock(), createElementBlock("div", {
141
- key: 0,
142
- class: normalizeClass(__props.ui?.empty)
143
- }, toDisplayString(__props.emptySearchText ?? "No fonts found"), 3)) : unref(filtered).length === 0 ? (openBlock(), createElementBlock("div", {
144
- key: 1,
145
- class: normalizeClass(__props.ui?.empty)
146
- }, [createElementVNode("div", null, [
147
- unref(accessState) === "prompt" ? (openBlock(), createElementBlock("p", _hoisted_3, " Allow local font access to browse installed fonts. ")) : unref(accessState) === "denied" ? (openBlock(), createElementBlock("p", _hoisted_4, " Local font access is blocked for this site. ")) : unref(accessState) === "unsupported" ? (openBlock(), createElementBlock("p", _hoisted_5, " Local fonts are not available in this browser. ")) : (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(__props.emptyFontsText ?? "No local fonts available."), 1)),
148
- __props.emptyFontsHint ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString(__props.emptyFontsHint), 1)) : createCommentVNode("v-if", true),
149
- unref(accessState) === "prompt" ? (openBlock(), createElementBlock("button", {
150
- key: 5,
151
- type: "button",
152
- class: normalizeClass(__props.ui?.emptyAction),
153
- disabled: unref(loading),
154
- onClick: _cache[1] || (_cache[1] = (...args) => unref(requestAccess) && unref(requestAccess)(...args))
155
- }, toDisplayString(unref(loading) ? "Loading…" : "Allow local fonts"), 11, _hoisted_8)) : createCommentVNode("v-if", true)
156
- ])], 2)) : createCommentVNode("v-if", true)]),
157
- _: 3
158
- }, 8, ["class"])]),
163
+ }, 8, ["class"]),
164
+ renderSlot(_ctx.$slots, "footer", { close: closeMenu })
165
+ ]),
159
166
  _: 3
160
167
  }, 8, ["class"])]),
161
168
  _: 3
@@ -1 +1 @@
1
- {"version":3,"file":"FontPickerRoot.vue.js","names":[],"sources":["../../../src/primitives/FontPicker/FontPickerRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { templateRef, unrefElement } from '@vueuse/core'\nimport {\n ComboboxAnchor,\n ComboboxContent,\n ComboboxInput,\n ComboboxItem,\n ComboboxItemIndicator,\n ComboboxPortal,\n ComboboxRoot,\n ComboboxTrigger,\n ComboboxVirtualizer,\n ComboboxViewport,\n type AcceptableValue\n} from 'reka-ui'\nimport { nextTick, useTemplateRef, watch } from 'vue'\n\nimport type { FontFamilyOption } from '@pairdraw/core/text'\n\nimport { useRetainedPopup } from '#vue/lifecycle/retention/popup'\nimport type { FontPickerUI } from '#vue/primitives/FontPicker/types'\nimport { useFontPicker, type FontAccessController } from '#vue/primitives/FontPicker/useFontPicker'\n\nconst {\n listFamilies,\n localFontAccess,\n ui,\n searchPlaceholder = 'Search fonts…',\n emptySearchText,\n emptyFontsText,\n emptyFontsHint\n} = defineProps<{\n listFamilies: () => Promise<string[] | FontFamilyOption[]>\n localFontAccess?: FontAccessController\n ui?: FontPickerUI\n searchPlaceholder?: string\n emptySearchText?: string\n emptyFontsText?: string\n emptyFontsHint?: string\n}>()\n\nconst modelValue = defineModel<string>({ required: true })\nconst emit = defineEmits<{ select: [family: string] }>()\n\nconst contentRef = templateRef<HTMLElement>('contentRef')\n\nfunction focusSearchInput() {\n nextTick(() => {\n const content = unrefElement(contentRef)\n if (!(content instanceof HTMLElement)) return\n content.querySelector<HTMLInputElement>('input')?.focus()\n })\n}\n\nconst { searchTerm, open, filtered, loading, accessState, requestAccess, select } = useFontPicker({\n modelValue,\n listFamilies,\n localFontAccess,\n onSelect: (family) => emit('select', family)\n})\nconst { portalActive } = useRetainedPopup(open)\nconst root = useTemplateRef<{ highlightItem: (value: AcceptableValue) => void }>('root')\n\n// The families arrive after the list opens, too late for Reka's own scroll to the chosen font.\nwatch(\n () => open.value && !loading.value && filtered.value.length > 0,\n async (ready) => {\n if (!ready || searchTerm.value) return\n await nextTick()\n root.value?.highlightItem(modelValue.value)\n }\n)\n\n/**\n * The list holds font options and the value is a family name; Reka compares them to find the\n * chosen font, so opening scrolls to it.\n */\nfunction sameFamily(left: unknown, right: unknown): boolean {\n return familyOf(left) === familyOf(right)\n}\n\nfunction familyOf(value: unknown): unknown {\n return typeof value === 'object' && value !== null && 'family' in value ? value.family : value\n}\n</script>\n\n<template>\n <ComboboxRoot\n ref=\"root\"\n v-model:open=\"open\"\n :model-value=\"modelValue\"\n :ignore-filter=\"true\"\n :by=\"sameFamily\"\n @update:model-value=\"\n (v: AcceptableValue) => {\n if (typeof v === 'string') select(v)\n }\n \"\n >\n <ComboboxAnchor as-child>\n <ComboboxTrigger as-child>\n <slot name=\"trigger\" :value=\"modelValue\" :open=\"open\">\n <button :class=\"ui?.trigger\">\n <span class=\"truncate\">{{ modelValue }}</span>\n </button>\n </slot>\n </ComboboxTrigger>\n </ComboboxAnchor>\n\n <ComboboxPortal v-if=\"portalActive\">\n <ComboboxContent\n :side-offset=\"2\"\n align=\"start\"\n position=\"popper\"\n :class=\"ui?.content\"\n @open-auto-focus.prevent\n ref=\"contentRef\"\n @vue:mounted=\"focusSearchInput\"\n >\n <slot name=\"search\" :search-term=\"searchTerm\">\n <ComboboxInput\n v-model=\"searchTerm\"\n :display-value=\"() => ''\"\n :class=\"ui?.search\"\n :placeholder=\"searchPlaceholder\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n </slot>\n\n <ComboboxViewport :class=\"ui?.viewport ?? 'max-h-72 overflow-y-auto'\">\n <ComboboxVirtualizer\n v-slot=\"{ option }\"\n :options=\"filtered\"\n :text-content=\"(option: FontFamilyOption) => option.family\"\n :estimate-size=\"36\"\n >\n <ComboboxItem\n :value=\"option.family\"\n :class=\"ui?.item\"\n :style=\"{ fontFamily: `'${option.family}', sans-serif` }\"\n >\n <slot\n name=\"item\"\n :family=\"option.family\"\n :source=\"option.source\"\n :selected=\"option.family === modelValue\"\n >\n <ComboboxItemIndicator>\n <slot name=\"indicator\" :selected=\"option.family === modelValue\" />\n </ComboboxItemIndicator>\n <span class=\"truncate\">{{ option.family }}</span>\n </slot>\n </ComboboxItem>\n </ComboboxVirtualizer>\n\n <div v-if=\"filtered.length === 0 && searchTerm\" :class=\"ui?.empty\">\n {{ emptySearchText ?? 'No fonts found' }}\n </div>\n <div v-else-if=\"filtered.length === 0\" :class=\"ui?.empty\">\n <div>\n <p v-if=\"accessState === 'prompt'\">\n Allow local font access to browse installed fonts.\n </p>\n <p v-else-if=\"accessState === 'denied'\">\n Local font access is blocked for this site.\n </p>\n <p v-else-if=\"accessState === 'unsupported'\">\n Local fonts are not available in this browser.\n </p>\n <p v-else>{{ emptyFontsText ?? 'No local fonts available.' }}</p>\n <p v-if=\"emptyFontsHint\" class=\"mt-1\">{{ emptyFontsHint }}</p>\n <button\n v-if=\"accessState === 'prompt'\"\n type=\"button\"\n :class=\"ui?.emptyAction\"\n :disabled=\"loading\"\n @click=\"requestAccess\"\n >\n {{ loading ? 'Loading…' : 'Allow local fonts' }}\n </button>\n </div>\n </div>\n </ComboboxViewport>\n </ComboboxContent>\n </ComboboxPortal>\n </ComboboxRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCA,MAAM,aAAa,SAAmB,SAAA,YAAmB;EACzD,MAAM,OAAO;EAEb,MAAM,aAAa,YAAyB,YAAY;EAExD,SAAS,mBAAmB;GAC1B,eAAe;IACb,MAAM,UAAU,aAAa,UAAU;IACvC,IAAI,EAAE,mBAAmB,cAAc;IACvC,QAAQ,cAAgC,OAAO,CAAC,EAAE,MAAM;GAC1D,CAAC;EACH;EAEA,MAAM,EAAE,YAAY,MAAM,UAAU,SAAS,aAAa,eAAe,WAAW,cAAc;GAChG;GACA,cAAW,QAAA;GACX,iBAAc,QAAA;GACd,WAAW,WAAW,KAAK,UAAU,MAAM;EAC7C,CAAC;EACD,MAAM,EAAE,iBAAiB,iBAAiB,IAAI;EAC9C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AAA,mBAAA,QAAA,IAAA"}
1
+ {"version":3,"file":"FontPickerRoot.vue.js","names":[],"sources":["../../../src/primitives/FontPicker/FontPickerRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { templateRef, unrefElement } from '@vueuse/core'\nimport {\n ComboboxAnchor,\n ComboboxContent,\n ComboboxInput,\n ComboboxItem,\n ComboboxItemIndicator,\n ComboboxPortal,\n ComboboxRoot,\n ComboboxTrigger,\n ComboboxVirtualizer,\n ComboboxViewport,\n type AcceptableValue\n} from 'reka-ui'\nimport { nextTick, useTemplateRef, watch } from 'vue'\n\nimport type { FontFamilyOption } from '@pairdraw/core/text'\n\nimport { useRetainedPopup } from '#vue/lifecycle/retention/popup'\nimport type { FontPickerUI } from '#vue/primitives/FontPicker/types'\nimport { useFontPicker, type FontAccessController } from '#vue/primitives/FontPicker/useFontPicker'\n\nconst {\n listFamilies,\n localFontAccess,\n ui,\n searchPlaceholder = 'Search fonts…',\n emptySearchText,\n emptyFontsText,\n emptyFontsHint\n} = defineProps<{\n listFamilies: () => Promise<string[] | FontFamilyOption[]>\n localFontAccess?: FontAccessController\n ui?: FontPickerUI\n searchPlaceholder?: string\n emptySearchText?: string\n emptyFontsText?: string\n emptyFontsHint?: string\n}>()\n\nconst modelValue = defineModel<string>({ required: true })\nconst emit = defineEmits<{ select: [family: string] }>()\n\nconst contentRef = templateRef<HTMLElement>('contentRef')\n\nfunction focusSearchInput() {\n nextTick(() => {\n const content = unrefElement(contentRef)\n if (!(content instanceof HTMLElement)) return\n content.querySelector<HTMLInputElement>('input')?.focus()\n })\n}\n\nconst { searchTerm, open, filtered, loading, accessState, requestAccess, select } = useFontPicker({\n modelValue,\n listFamilies,\n localFontAccess,\n onSelect: (family) => emit('select', family)\n})\nconst { portalActive } = useRetainedPopup(open)\nconst root = useTemplateRef<{ highlightItem: (value: AcceptableValue) => void }>('root')\n\nfunction closeMenu(): void {\n open.value = false\n}\n\n// The families arrive after the list opens, too late for Reka's own scroll to the chosen font.\nwatch(\n () => open.value && !loading.value && filtered.value.length > 0,\n async (ready) => {\n if (!ready || searchTerm.value) return\n await nextTick()\n root.value?.highlightItem(modelValue.value)\n }\n)\n\n/**\n * The list holds font options and the value is a family name; Reka compares them to find the\n * chosen font, so opening scrolls to it.\n */\nfunction sameFamily(left: unknown, right: unknown): boolean {\n return familyOf(left) === familyOf(right)\n}\n\nfunction familyOf(value: unknown): unknown {\n return typeof value === 'object' && value !== null && 'family' in value ? value.family : value\n}\n</script>\n\n<template>\n <ComboboxRoot\n ref=\"root\"\n v-model:open=\"open\"\n :model-value=\"modelValue\"\n :ignore-filter=\"true\"\n :by=\"sameFamily\"\n @update:model-value=\"\n (v: AcceptableValue) => {\n if (typeof v === 'string') select(v)\n }\n \"\n >\n <ComboboxAnchor as-child>\n <ComboboxTrigger as-child>\n <slot name=\"trigger\" :value=\"modelValue\" :open=\"open\">\n <button :class=\"ui?.trigger\">\n <span class=\"truncate\">{{ modelValue }}</span>\n </button>\n </slot>\n </ComboboxTrigger>\n </ComboboxAnchor>\n\n <ComboboxPortal v-if=\"portalActive\">\n <ComboboxContent\n :side-offset=\"2\"\n align=\"start\"\n position=\"popper\"\n :class=\"ui?.content\"\n @open-auto-focus.prevent\n ref=\"contentRef\"\n @vue:mounted=\"focusSearchInput\"\n >\n <slot name=\"search\" :search-term=\"searchTerm\">\n <ComboboxInput\n v-model=\"searchTerm\"\n :display-value=\"() => ''\"\n :class=\"ui?.search\"\n :placeholder=\"searchPlaceholder\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n </slot>\n\n <ComboboxViewport :class=\"ui?.viewport ?? 'max-h-72 overflow-y-auto'\">\n <ComboboxVirtualizer\n v-slot=\"{ option }\"\n :options=\"filtered\"\n :text-content=\"(option: FontFamilyOption) => option.family\"\n :estimate-size=\"36\"\n >\n <ComboboxItem\n :value=\"option.family\"\n :class=\"ui?.item\"\n :style=\"{ fontFamily: `'${option.family}', sans-serif` }\"\n >\n <slot\n name=\"item\"\n :family=\"option.family\"\n :source=\"option.source\"\n :selected=\"option.family === modelValue\"\n >\n <ComboboxItemIndicator>\n <slot name=\"indicator\" :selected=\"option.family === modelValue\" />\n </ComboboxItemIndicator>\n <span class=\"truncate\">{{ option.family }}</span>\n </slot>\n </ComboboxItem>\n </ComboboxVirtualizer>\n\n <div v-if=\"filtered.length === 0 && searchTerm\" :class=\"ui?.empty\">\n {{ emptySearchText ?? 'No fonts found' }}\n </div>\n <div v-else-if=\"filtered.length === 0\" :class=\"ui?.empty\">\n <div>\n <p v-if=\"accessState === 'prompt'\">\n Allow local font access to browse installed fonts.\n </p>\n <p v-else-if=\"accessState === 'denied'\">\n Local font access is blocked for this site.\n </p>\n <p v-else-if=\"accessState === 'unsupported'\">\n Local fonts are not available in this browser.\n </p>\n <p v-else>{{ emptyFontsText ?? 'No local fonts available.' }}</p>\n <p v-if=\"emptyFontsHint\" class=\"mt-1\">{{ emptyFontsHint }}</p>\n <button\n v-if=\"accessState === 'prompt'\"\n type=\"button\"\n :class=\"ui?.emptyAction\"\n :disabled=\"loading\"\n @click=\"requestAccess\"\n >\n {{ loading ? 'Loading…' : 'Allow local fonts' }}\n </button>\n </div>\n </div>\n </ComboboxViewport>\n <slot name=\"footer\" :close=\"closeMenu\" />\n </ComboboxContent>\n </ComboboxPortal>\n </ComboboxRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCA,MAAM,aAAa,SAAmB,SAAA,YAAmB;EACzD,MAAM,OAAO;EAEb,MAAM,aAAa,YAAyB,YAAY;EAExD,SAAS,mBAAmB;GAC1B,eAAe;IACb,MAAM,UAAU,aAAa,UAAU;IACvC,IAAI,EAAE,mBAAmB,cAAc;IACvC,QAAQ,cAAgC,OAAO,CAAC,EAAE,MAAM;GAC1D,CAAC;EACH;EAEA,MAAM,EAAE,YAAY,MAAM,UAAU,SAAS,aAAa,eAAe,WAAW,cAAc;GAChG;GACA,c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,MAAA,GAAA,SAAE,MAAA,aAAA,KAAA,MAAA,aAAA,CAAA,CAAA,GAAA,IAAA;SAEL,GAAA,gBAAA,MAAA,OAAA,IAAO,aAAA,mBAAA,GAAA,IAAA,UAAA,KAAA,mBAAA,QAAA,IAAA;;;;OAKlB,WAAyC,KAAA,QAAA,UAAA,EAApB,OAAO,UAAS,CAAA"}
@@ -1,7 +1,8 @@
1
- import { Fill } from "@pairdraw/scene-graph";
1
+ import { ColorProfile, Fill } from "@pairdraw/scene-graph";
2
2
  //#region src/primitives/GradientEditor/GradientEditorRoot.vue.d.ts
3
3
  type __VLS_Props = {
4
4
  fill: Fill;
5
+ colorProfile?: ColorProfile;
5
6
  };
6
7
  type __VLS_ModelProps = {
7
8
  /** The selected stop, which the canvas handles can also change. */
@@ -1 +1 @@
1
- {"version":3,"file":"GradientEditorRoot.vue.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/GradientEditorRoot.vue"],"mappings":";;KA6EK;EAAgB,MAAM;;KAqDtB;;EAEL;;KAMK,oBAAoB,cAAc;YAkCnC;;;;;;;;;;;;;;;;;;;;;;KACC;EACD,WAAW,cAAc;;cAGvB,0BAAU,gBAAA,iDAAA,qCAAA;;;;;;0CAGd;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
1
+ {"version":3,"file":"GradientEditorRoot.vue.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/GradientEditorRoot.vue"],"mappings":";;KA8EK;EAAgB,MAAM;EAAM,eAAe;;KAsD3C;;EAEL;;KAMK,oBAAoB,cAAc;YAkCnC;;;;;;;;;;;;;;;;;;;;;;KACC;EACD,WAAW,cAAc;;cAGvB,0BAAU,gBAAA,iDAAA,qCAAA;;;;;;0CAGd;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
@@ -3,7 +3,10 @@ import { computed, defineComponent, mergeModels, renderSlot, unref, useModel, wa
3
3
  //#region src/primitives/GradientEditor/GradientEditorRoot.vue
4
4
  const _sfc_main = /*@__PURE__*/ defineComponent({
5
5
  __name: "GradientEditorRoot",
6
- props: /*@__PURE__*/ mergeModels({ fill: {} }, {
6
+ props: /*@__PURE__*/ mergeModels({
7
+ fill: {},
8
+ colorProfile: {}
9
+ }, {
7
10
  "activeStopIndex": {},
8
11
  "activeStopIndexModifiers": {}
9
12
  }),
@@ -12,7 +15,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
12
15
  const emit = __emit;
13
16
  /** The selected stop, which the canvas handles can also change. */
14
17
  const selectedStop = useModel(__props, "activeStopIndex");
15
- const { activeStopIndex, stops, subtype, subtypes, activeColor, barBackground, setSubtype, selectStop, addStop, removeStop, updateStopPosition, updateStopColor, updateStopOpacity, updateActiveColor, dragStop } = useGradientStops(computed(() => __props.fill), (updated) => emit("update", updated));
18
+ const { activeStopIndex, stops, subtype, subtypes, activeColor, barBackground, setSubtype, selectStop, addStop, removeStop, updateStopPosition, updateStopColor, updateStopOpacity, updateActiveColor, dragStop } = useGradientStops(computed(() => __props.fill), (updated) => emit("update", updated), { colorProfile: () => __props.colorProfile ?? "srgb" });
16
19
  watch(selectedStop, (index) => {
17
20
  if (index !== void 0 && index !== activeStopIndex.value) activeStopIndex.value = index;
18
21
  }, { immediate: true });
@@ -1 +1 @@
1
- {"version":3,"file":"GradientEditorRoot.vue.js","names":[],"sources":["../../../src/primitives/GradientEditor/GradientEditorRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, watch } from 'vue'\n\nimport type { Fill } from '@pairdraw/scene-graph'\n\nimport { useGradientStops } from '#vue/primitives/GradientEditor/useGradientStops'\n\nconst { fill } = defineProps<{ fill: Fill }>()\nconst emit = defineEmits<{ update: [fill: Fill] }>()\n/** The selected stop, which the canvas handles can also change. */\nconst selectedStop = defineModel<number>('activeStopIndex')\n\nconst {\n activeStopIndex,\n stops,\n subtype,\n subtypes,\n activeColor,\n barBackground,\n setSubtype,\n selectStop,\n addStop,\n removeStop,\n updateStopPosition,\n updateStopColor,\n updateStopOpacity,\n updateActiveColor,\n dragStop\n} = useGradientStops(\n computed(() => fill),\n (updated) => emit('update', updated)\n)\n\nwatch(\n selectedStop,\n (index) => {\n if (index !== undefined && index !== activeStopIndex.value) activeStopIndex.value = index\n },\n { immediate: true }\n)\nwatch(activeStopIndex, (index) => {\n if (index !== selectedStop.value) selectedStop.value = index\n})\n\nconst actions = {\n setSubtype,\n selectStop,\n addStop,\n removeStop,\n updateStopPosition,\n updateStopColor,\n updateStopOpacity,\n updateActiveColor,\n dragStop\n}\n</script>\n\n<template>\n <slot\n :stops=\"stops\"\n :subtype=\"subtype\"\n :subtypes=\"subtypes\"\n :active-stop-index=\"activeStopIndex\"\n :active-color=\"activeColor\"\n :bar-background=\"barBackground\"\n :actions=\"actions\"\n />\n</template>\n"],"mappings":";;;;;;;;;;;EAQA,MAAM,OAAO;;EAEb,MAAM,eAAe,SAAmB,SAAC,iBAAiB;EAE1D,MAAM,EACJ,iBACA,OACA,SACA,UACA,aACA,eACA,YACA,YACA,SACA,YACA,oBACA,iBACA,mBACA,mBACA,aACE,iBACF,eAAe,QAAA,IAAI,IAClB,YAAY,KAAK,UAAU,OAAO,CACrC;EAEA,MACE,eACC,UAAU;GACT,IAAI,UAAU,KAAA,KAAa,UAAU,gBAAgB,OAAO,gBAAgB,QAAQ;EACtF,GACA,EAAE,WAAW,KAAK,CACpB;EACA,MAAM,kBAAkB,UAAU;GAChC,IAAI,UAAU,aAAa,OAAO,aAAa,QAAQ;EACzD,CAAC;EAED,MAAM,UAAU;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;;GAIE,OAAA,WAQE,KAAA,QAAA,WAAA;IAPC,OAAO,MAAA,KAAA;IACP,SAAS,MAAA,OAAA;IACT,UAAU,MAAA,QAAA;IACV,iBAAmB,MAAA,eAAA;IACnB,aAAc,MAAA,WAAA;IACd,eAAgB,MAAA,aAAA;IACP"}
1
+ {"version":3,"file":"GradientEditorRoot.vue.js","names":[],"sources":["../../../src/primitives/GradientEditor/GradientEditorRoot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, watch } from 'vue'\n\nimport type { ColorProfile, Fill } from '@pairdraw/scene-graph'\n\nimport { useGradientStops } from '#vue/primitives/GradientEditor/useGradientStops'\n\nconst { fill, colorProfile } = defineProps<{ fill: Fill; colorProfile?: ColorProfile }>()\nconst emit = defineEmits<{ update: [fill: Fill] }>()\n/** The selected stop, which the canvas handles can also change. */\nconst selectedStop = defineModel<number>('activeStopIndex')\n\nconst {\n activeStopIndex,\n stops,\n subtype,\n subtypes,\n activeColor,\n barBackground,\n setSubtype,\n selectStop,\n addStop,\n removeStop,\n updateStopPosition,\n updateStopColor,\n updateStopOpacity,\n updateActiveColor,\n dragStop\n} = useGradientStops(\n computed(() => fill),\n (updated) => emit('update', updated),\n { colorProfile: () => colorProfile ?? 'srgb' }\n)\n\nwatch(\n selectedStop,\n (index) => {\n if (index !== undefined && index !== activeStopIndex.value) activeStopIndex.value = index\n },\n { immediate: true }\n)\nwatch(activeStopIndex, (index) => {\n if (index !== selectedStop.value) selectedStop.value = index\n})\n\nconst actions = {\n setSubtype,\n selectStop,\n addStop,\n removeStop,\n updateStopPosition,\n updateStopColor,\n updateStopOpacity,\n updateActiveColor,\n dragStop\n}\n</script>\n\n<template>\n <slot\n :stops=\"stops\"\n :subtype=\"subtype\"\n :subtypes=\"subtypes\"\n :active-stop-index=\"activeStopIndex\"\n :active-color=\"activeColor\"\n :bar-background=\"barBackground\"\n :actions=\"actions\"\n />\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAQA,MAAM,OAAO;;EAEb,MAAM,eAAe,SAAmB,SAAC,iBAAiB;EAE1D,MAAM,EACJ,iBACA,OACA,SACA,UACA,aACA,eACA,YACA,YACA,SACA,YACA,oBACA,iBACA,mBACA,mBACA,aACE,iBACF,eAAe,QAAA,IAAI,IAClB,YAAY,KAAK,UAAU,OAAO,GACnC,EAAE,oBAAoB,QAAA,gBAAgB,OAAO,CAC/C;EAEA,MACE,eACC,UAAU;GACT,IAAI,UAAU,KAAA,KAAa,UAAU,gBAAgB,OAAO,gBAAgB,QAAQ;EACtF,GACA,EAAE,WAAW,KAAK,CACpB;EACA,MAAM,kBAAkB,UAAU;GAChC,IAAI,UAAU,aAAa,OAAO,aAAa,QAAQ;EACzD,CAAC;EAED,MAAM,UAAU;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;;GAIE,OAAA,WAQE,KAAA,QAAA,WAAA;IAPC,OAAO,MAAA,KAAA;IACP,SAAS,MAAA,OAAA;IACT,UAAU,MAAA,QAAA;IACV,iBAAmB,MAAA,eAAA;IACnB,aAAc,MAAA,WAAA;IACd,eAAgB,MAAA,aAAA;IACP"}
@@ -1 +1 @@
1
- {"version":3,"file":"GradientEditorStop.vue.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/GradientEditorStop.vue"],"mappings":";;KA+IK,cAAc;cA2Ib,0BAAU,gBAAA,uDAAA,qCAAA;;;;;;;;;;;;0CAGd;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
1
+ {"version":3,"file":"GradientEditorStop.vue.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/GradientEditorStop.vue"],"mappings":";;KAiJK,cAAc;cA2Ib,0BAAU,gBAAA,uDAAA,qCAAA;;;;;;;;;;;;0CAGd;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
@@ -1,6 +1,6 @@
1
1
  import { computed, createBlock, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
2
2
  import { Primitive } from "reka-ui";
3
- import { colorToCSS, colorToHexRaw } from "@pairdraw/scene-graph/color";
3
+ import { colorToHexRaw, colorToPreviewCSS, convertColor } from "@pairdraw/scene-graph/color";
4
4
  //#region src/primitives/GradientEditor/GradientEditorStop.vue
5
5
  const _sfc_main = /*@__PURE__*/ defineComponent({
6
6
  inheritAttrs: false,
@@ -23,6 +23,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
23
23
  },
24
24
  positionStep: { default: 1 },
25
25
  label: {},
26
+ colorProfile: { default: "srgb" },
26
27
  asChild: {
27
28
  type: Boolean,
28
29
  default: false
@@ -40,8 +41,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
40
41
  const emit = __emit;
41
42
  const positionPercent = computed(() => Math.round(__props.stop.position * 100));
42
43
  const opacityPercent = computed(() => Math.round(__props.stop.color.a * 100));
43
- const hex = computed(() => colorToHexRaw(__props.stop.color));
44
- const css = computed(() => colorToCSS(__props.stop.color));
44
+ const hex = computed(() => colorToHexRaw(convertColor(__props.stop.color, __props.colorProfile, "srgb")));
45
+ const css = computed(() => colorToPreviewCSS(__props.stop.color, __props.colorProfile));
45
46
  const accessibleLabel = computed(() => __props.label ?? `Gradient stop ${__props.index + 1}`);
46
47
  const actions = {
47
48
  select: () => emit("select", __props.index),
@@ -1 +1 @@
1
- {"version":3,"file":"GradientEditorStop.vue.js","names":["$attrs"],"sources":["../../../src/primitives/GradientEditor/GradientEditorStop.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Primitive } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { colorToCSS, colorToHexRaw } from '@pairdraw/scene-graph/color'\n\nimport type {\n GradientEditorStopActions,\n GradientEditorStopProps,\n GradientEditorStopSlots\n} from '#vue/primitives/GradientEditor/types'\n\nconst {\n stop,\n index,\n active,\n dragging = false,\n interactive = true,\n removable = true,\n positionStep = 1,\n label,\n as = 'div',\n asChild = false\n} = defineProps<GradientEditorStopProps>()\n\nconst emit = defineEmits<{\n select: [index: number]\n updatePosition: [index: number, position: number]\n updateColor: [index: number, hex: string]\n updateOpacity: [index: number, opacity: number]\n remove: [index: number]\n}>()\n\ndefineSlots<GradientEditorStopSlots>()\ndefineOptions({ inheritAttrs: false })\n\nconst positionPercent = computed(() => Math.round(stop.position * 100))\nconst opacityPercent = computed(() => Math.round(stop.color.a * 100))\nconst hex = computed(() => colorToHexRaw(stop.color))\nconst css = computed(() => colorToCSS(stop.color))\nconst accessibleLabel = computed(() => label ?? `Gradient stop ${index + 1}`)\nconst actions: GradientEditorStopActions = {\n select: () => emit('select', index),\n updatePosition: (position) => emit('updatePosition', index, position),\n updateColor: (hexValue) => emit('updateColor', index, hexValue),\n updateOpacity: (opacity) => emit('updateOpacity', index, opacity),\n remove: () => emit('remove', index)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!interactive) return\n const amount = positionStep * (event.shiftKey ? 10 : 1)\n let nextPosition: number | undefined\n if (event.code === 'ArrowLeft' || event.code === 'ArrowDown')\n nextPosition = positionPercent.value - amount\n else if (event.code === 'ArrowRight' || event.code === 'ArrowUp')\n nextPosition = positionPercent.value + amount\n else if (event.code === 'Home') nextPosition = 0\n else if (event.code === 'End') nextPosition = 100\n else if ((event.code === 'Delete' || event.code === 'Backspace') && removable) {\n event.preventDefault()\n event.stopPropagation()\n actions.remove()\n return\n }\n if (nextPosition === undefined) return\n event.preventDefault()\n event.stopPropagation()\n actions.updatePosition(Math.max(0, Math.min(100, nextPosition)))\n}\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-selected=\"active ? '' : undefined\"\n :data-dragging=\"dragging ? '' : undefined\"\n :role=\"interactive ? 'slider' : undefined\"\n :tabindex=\"interactive ? 0 : undefined\"\n :aria-label=\"interactive ? accessibleLabel : undefined\"\n :aria-valuemin=\"interactive ? 0 : undefined\"\n :aria-valuemax=\"interactive ? 100 : undefined\"\n :aria-valuenow=\"interactive ? positionPercent : undefined\"\n :aria-valuetext=\"interactive ? `${positionPercent}%` : undefined\"\n data-slot=\"stop\"\n @click=\"actions.select\"\n @focus=\"actions.select\"\n @keydown=\"onKeydown\"\n >\n <slot\n :stop=\"stop\"\n :index=\"index\"\n :active=\"active\"\n :selected=\"active\"\n :dragging=\"dragging\"\n :position-percent=\"positionPercent\"\n :opacity-percent=\"opacityPercent\"\n :hex=\"hex\"\n :css=\"css\"\n :actions=\"actions\"\n />\n </Primitive>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,MAAM,OAAO;EAWb,MAAM,kBAAkB,eAAe,KAAK,MAAM,QAAA,KAAK,WAAW,GAAG,CAAC;EACtE,MAAM,iBAAiB,eAAe,KAAK,MAAM,QAAA,KAAK,MAAM,IAAI,GAAG,CAAC;EACpE,MAAM,MAAM,eAAe,cAAc,QAAA,KAAK,KAAK,CAAC;EACpD,MAAM,MAAM,eAAe,WAAW,QAAA,KAAK,KAAK,CAAC;EACjD,MAAM,kBAAkB,eAAe,QAAA,SAAS,iBAAiB,QAAA,QAAQ,GAAG;EAC5E,MAAM,UAAqC;GACzC,cAAc,KAAK,UAAU,QAAA,KAAK;GAClC,iBAAiB,aAAa,KAAK,kBAAkB,QAAA,OAAO,QAAQ;GACpE,cAAc,aAAa,KAAK,eAAe,QAAA,OAAO,QAAQ;GAC9D,gBAAgB,YAAY,KAAK,iBAAiB,QAAA,OAAO,OAAO;GAChE,cAAc,KAAK,UAAU,QAAA,KAAK;EACpC;EAEA,SAAS,UAAU,OAAsB;GACvC,IAAI,CAAC,QAAA,aAAa;GAClB,MAAM,SAAS,QAAA,gBAAgB,MAAM,WAAW,KAAK;GACrD,IAAI;GACJ,IAAI,MAAM,SAAS,eAAe,MAAM,SAAS,aAC/C,eAAe,gBAAgB,QAAQ;QACpC,IAAI,MAAM,SAAS,gBAAgB,MAAM,SAAS,WACrD,eAAe,gBAAgB,QAAQ;QACpC,IAAI,MAAM,SAAS,QAAQ,eAAe;QAC1C,IAAI,MAAM,SAAS,OAAO,eAAe;QACzC,KAAK,MAAM,SAAS,YAAY,MAAM,SAAS,gBAAgB,QAAA,WAAW;IAC7E,MAAM,eAAe;IACrB,MAAM,gBAAgB;IACtB,QAAQ,OAAO;IACf;GACF;GACA,IAAI,iBAAiB,KAAA,GAAW;GAChC,MAAM,eAAe;GACrB,MAAM,gBAAgB;GACtB,QAAQ,eAAe,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,YAAY,CAAC,CAAC;EACjE;;GAIE,OAAA,UAAA,GAAA,YA8BY,MAAA,SAAA,GA9BZ,WACUA,KA6BE,QA7BI;IACb,IAAI,QAAA;IACJ,YAAU,QAAA;IACV,iBAAe,QAAA,SAAM,KAAQ,KAAA;IAC7B,iBAAe,QAAA,WAAQ,KAAQ,KAAA;IAC/B,MAAM,QAAA,cAAW,WAAc,KAAA;IAC/B,UAAU,QAAA,cAAW,IAAO,KAAA;IAC5B,cAAY,QAAA,cAAc,gBAAA,QAAkB,KAAA;IAC5C,iBAAe,QAAA,cAAW,IAAO,KAAA;IACjC,iBAAe,QAAA,cAAW,MAAS,KAAA;IACnC,iBAAe,QAAA,cAAc,gBAAA,QAAkB,KAAA;IAC/C,kBAAgB,QAAA,cAAW,GAAM,gBAAA,MAAe,KAAM,KAAA;IACvD,aAAU;IACT,SAAO,QAAQ;IACf,SAAO,QAAQ;IACN;;IAaR,SAAA,cAAA,CAXF,WAWE,KAAA,QAAA,WAAA;KAVC,MAAM,QAAA;KACN,OAAO,QAAA;KACP,QAAQ,QAAA;KACR,UAAU,QAAA;KACV,UAAU,QAAA;KACV,iBAAkB,gBAAA;KAClB,gBAAiB,eAAA;KACjB,KAAK,IAAA;KACL,KAAK,IAAA;KACI"}
1
+ {"version":3,"file":"GradientEditorStop.vue.js","names":["$attrs"],"sources":["../../../src/primitives/GradientEditor/GradientEditorStop.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Primitive } from 'reka-ui'\nimport { computed } from 'vue'\n\nimport { colorToHexRaw, colorToPreviewCSS, convertColor } from '@pairdraw/scene-graph/color'\n\nimport type {\n GradientEditorStopActions,\n GradientEditorStopProps,\n GradientEditorStopSlots\n} from '#vue/primitives/GradientEditor/types'\n\nconst {\n stop,\n index,\n active,\n dragging = false,\n interactive = true,\n removable = true,\n positionStep = 1,\n label,\n as = 'div',\n asChild = false,\n colorProfile = 'srgb'\n} = defineProps<GradientEditorStopProps>()\n\nconst emit = defineEmits<{\n select: [index: number]\n updatePosition: [index: number, position: number]\n updateColor: [index: number, hex: string]\n updateOpacity: [index: number, opacity: number]\n remove: [index: number]\n}>()\n\ndefineSlots<GradientEditorStopSlots>()\ndefineOptions({ inheritAttrs: false })\n\nconst positionPercent = computed(() => Math.round(stop.position * 100))\nconst opacityPercent = computed(() => Math.round(stop.color.a * 100))\nconst hex = computed(() => colorToHexRaw(convertColor(stop.color, colorProfile, 'srgb')))\nconst css = computed(() => colorToPreviewCSS(stop.color, colorProfile))\nconst accessibleLabel = computed(() => label ?? `Gradient stop ${index + 1}`)\nconst actions: GradientEditorStopActions = {\n select: () => emit('select', index),\n updatePosition: (position) => emit('updatePosition', index, position),\n updateColor: (hexValue) => emit('updateColor', index, hexValue),\n updateOpacity: (opacity) => emit('updateOpacity', index, opacity),\n remove: () => emit('remove', index)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!interactive) return\n const amount = positionStep * (event.shiftKey ? 10 : 1)\n let nextPosition: number | undefined\n if (event.code === 'ArrowLeft' || event.code === 'ArrowDown')\n nextPosition = positionPercent.value - amount\n else if (event.code === 'ArrowRight' || event.code === 'ArrowUp')\n nextPosition = positionPercent.value + amount\n else if (event.code === 'Home') nextPosition = 0\n else if (event.code === 'End') nextPosition = 100\n else if ((event.code === 'Delete' || event.code === 'Backspace') && removable) {\n event.preventDefault()\n event.stopPropagation()\n actions.remove()\n return\n }\n if (nextPosition === undefined) return\n event.preventDefault()\n event.stopPropagation()\n actions.updatePosition(Math.max(0, Math.min(100, nextPosition)))\n}\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-selected=\"active ? '' : undefined\"\n :data-dragging=\"dragging ? '' : undefined\"\n :role=\"interactive ? 'slider' : undefined\"\n :tabindex=\"interactive ? 0 : undefined\"\n :aria-label=\"interactive ? accessibleLabel : undefined\"\n :aria-valuemin=\"interactive ? 0 : undefined\"\n :aria-valuemax=\"interactive ? 100 : undefined\"\n :aria-valuenow=\"interactive ? positionPercent : undefined\"\n :aria-valuetext=\"interactive ? `${positionPercent}%` : undefined\"\n data-slot=\"stop\"\n @click=\"actions.select\"\n @focus=\"actions.select\"\n @keydown=\"onKeydown\"\n >\n <slot\n :stop=\"stop\"\n :index=\"index\"\n :active=\"active\"\n :selected=\"active\"\n :dragging=\"dragging\"\n :position-percent=\"positionPercent\"\n :opacity-percent=\"opacityPercent\"\n :hex=\"hex\"\n :css=\"css\"\n :actions=\"actions\"\n />\n </Primitive>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,OAAO;EAWb,MAAM,kBAAkB,eAAe,KAAK,MAAM,QAAA,KAAK,WAAW,GAAG,CAAC;EACtE,MAAM,iBAAiB,eAAe,KAAK,MAAM,QAAA,KAAK,MAAM,IAAI,GAAG,CAAC;EACpE,MAAM,MAAM,eAAe,cAAc,aAAa,QAAA,KAAK,OAAO,QAAA,cAAc,MAAM,CAAC,CAAC;EACxF,MAAM,MAAM,eAAe,kBAAkB,QAAA,KAAK,OAAO,QAAA,YAAY,CAAC;EACtE,MAAM,kBAAkB,eAAe,QAAA,SAAS,iBAAiB,QAAA,QAAQ,GAAG;EAC5E,MAAM,UAAqC;GACzC,cAAc,KAAK,UAAU,QAAA,KAAK;GAClC,iBAAiB,aAAa,KAAK,kBAAkB,QAAA,OAAO,QAAQ;GACpE,cAAc,aAAa,KAAK,eAAe,QAAA,OAAO,QAAQ;GAC9D,gBAAgB,YAAY,KAAK,iBAAiB,QAAA,OAAO,OAAO;GAChE,cAAc,KAAK,UAAU,QAAA,KAAK;EACpC;EAEA,SAAS,UAAU,OAAsB;GACvC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,UAAU,QAAA;KACV,UAAU,QAAA;KACV,iBAAkB,gBAAA;KAClB,gBAAiB,eAAA;KACjB,KAAK,IAAA;KACL,KAAK,IAAA;KACI"}
@@ -1,5 +1,5 @@
1
1
  import { PrimitiveProps } from "reka-ui";
2
- import { GradientStop } from "@pairdraw/scene-graph";
2
+ import { ColorProfile, GradientStop } from "@pairdraw/scene-graph";
3
3
  //#region src/primitives/GradientEditor/types.d.ts
4
4
  interface GradientEditorStopProps extends PrimitiveProps {
5
5
  stop: GradientStop;
@@ -10,6 +10,8 @@ interface GradientEditorStopProps extends PrimitiveProps {
10
10
  removable?: boolean;
11
11
  positionStep?: number;
12
12
  label?: string;
13
+ /** The profile the stop's color is stored in; the hex reads it as the sRGB color drawn. */
14
+ colorProfile?: ColorProfile;
13
15
  }
14
16
  interface GradientEditorStopActions {
15
17
  select: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/types.ts"],"mappings":";;;UAIiB,gCAAgC;EAC/C,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,iBAAiB;EACjB,cAAc;EACd,gBAAgB;EAChB;;UAGe;EACf,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;;UAGM;EACf,WAAW,OAAO"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/types.ts"],"mappings":";;;UAIiB,gCAAgC;EAC/C,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,eAAe;;UAGA;EACf;EACA,iBAAiB;EACjB,cAAc;EACd,gBAAgB;EAChB;;UAGe;EACf,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;;UAGM;EACf,WAAW,OAAO"}
@@ -1,5 +1,5 @@
1
- import { Ref } from "vue";
2
- import { Fill, GradientStop } from "@pairdraw/scene-graph";
1
+ import { MaybeRefOrGetter, Ref } from "vue";
2
+ import { ColorProfile, Fill, GradientStop } from "@pairdraw/scene-graph";
3
3
  import { Color } from "@pairdraw/scene-graph/primitives";
4
4
  //#region src/primitives/GradientEditor/useGradientStops.d.ts
5
5
  type GradientSubtype = 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND';
@@ -9,7 +9,9 @@ type GradientSubtype = 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR
9
9
  * Use this composable for gradient editors that need subtype switching,
10
10
  * active-stop selection, stop dragging, and stop color/opacity editing.
11
11
  */
12
- declare function useGradientStops(fill: Ref<Fill>, onUpdate: (fill: Fill) => void): {
12
+ declare function useGradientStops(fill: Ref<Fill>, onUpdate: (fill: Fill) => void, options?: {
13
+ colorProfile?: MaybeRefOrGetter<ColorProfile>;
14
+ }): {
13
15
  activeStopIndex: Ref<number, number>;
14
16
  stops: import("vue").ComputedRef<GradientStop[]>;
15
17
  subtype: import("vue").ComputedRef<GradientSubtype>;
@@ -1 +1 @@
1
- {"version":3,"file":"useGradientStops.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/useGradientStops.ts"],"mappings":";;;;KASK;;;;;;;iBAmBW,iBAAiB,MAAM,IAAI,OAAO,WAAW,MAAM;;;;;IAb1C,OAAA;IAAwB;;;;EAmCrB,aAAA,MAAA;EAQC,aAAA;;EAaA,aAAA;EAMQ,qBAAA,eAAM;EAMT,kBAAA,eAAM;EAKJ,oBAAA,eAAM;EASN,oBAAA,OAAA;EAYT,WAAA,eAAM"}
1
+ {"version":3,"file":"useGradientStops.d.ts","names":[],"sources":["../../../src/primitives/GradientEditor/useGradientStops.ts"],"mappings":";;;;KASK;;;;;;;iBAmBW,iBACd,MAAM,IAAI,OACV,WAAW,MAAM,eACjB;EAAW,eAAe,iBAAiB;;;;;;IAhBpB,OAAA;IAAwB;;;;EA0CrB,aAAA,MAAA;EAQC,aAAA;;EAaA,aAAA;EAMQ,qBAAA,eAAM;EAMT,kBAAA,eAAM;EAKJ,oBAAA,eAAM;EASN,oBAAA,OAAA;EAaT,WAAA,eAAM"}
@@ -1,6 +1,6 @@
1
1
  import { useColorModel } from "../../controls/color-model/use.js";
2
- import { computed, ref } from "vue";
3
- import { colorToCSS } from "@pairdraw/scene-graph/color";
2
+ import { computed, ref, toValue } from "vue";
3
+ import { colorToPreviewCSS } from "@pairdraw/scene-graph/color";
4
4
  import { DEFAULT_GRADIENT_TRANSFORM } from "@pairdraw/scene-graph/gradient";
5
5
  //#region src/primitives/GradientEditor/useGradientStops.ts
6
6
  const SUBTYPES = [
@@ -27,7 +27,7 @@ const SUBTYPES = [
27
27
  * Use this composable for gradient editors that need subtype switching,
28
28
  * active-stop selection, stop dragging, and stop color/opacity editing.
29
29
  */
30
- function useGradientStops(fill, onUpdate) {
30
+ function useGradientStops(fill, onUpdate, options = {}) {
31
31
  const activeStopIndex = ref(0);
32
32
  const stops = computed(() => fill.value.gradientStops ?? []);
33
33
  const subtype = computed(() => fill.value.type);
@@ -36,7 +36,11 @@ function useGradientStops(fill, onUpdate) {
36
36
  if (!s.length) return fill.value.color;
37
37
  return s[Math.min(activeStopIndex.value, s.length - 1)].color;
38
38
  });
39
- const barBackground = computed(() => stops.value.length ? `linear-gradient(to right, ${stops.value.map((s) => `${colorToCSS(s.color)} ${s.position * 100}%`).join(", ")})` : "");
39
+ const barBackground = computed(() => {
40
+ if (!stops.value.length) return "";
41
+ const profile = toValue(options.colorProfile ?? "srgb");
42
+ return `linear-gradient(to right, ${stops.value.map((s) => `${colorToPreviewCSS(s.color, profile)} ${s.position * 100}%`).join(", ")})`;
43
+ });
40
44
  function emitStops(newStops) {
41
45
  onUpdate({
42
46
  ...fill.value,
@@ -106,6 +110,7 @@ function useGradientStops(fill, onUpdate) {
106
110
  }
107
111
  const colorModel = useColorModel({
108
112
  color: activeColor,
113
+ colorProfile: options.colorProfile,
109
114
  onUpdate: updateActiveColor
110
115
  });
111
116
  function dragStop(index, position) {
@@ -1 +1 @@
1
- {"version":3,"file":"useGradientStops.js","names":[],"sources":["../../../src/primitives/GradientEditor/useGradientStops.ts"],"sourcesContent":["import { computed, ref, type Ref } from 'vue'\n\nimport type { Fill, GradientStop, GradientTransform } from '@pairdraw/scene-graph'\nimport { colorToCSS } from '@pairdraw/scene-graph/color'\nimport { DEFAULT_GRADIENT_TRANSFORM } from '@pairdraw/scene-graph/gradient'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport { useColorModel } from '#vue/controls/color-model/use'\n\ntype GradientSubtype =\n | 'GRADIENT_LINEAR'\n | 'GRADIENT_RADIAL'\n | 'GRADIENT_ANGULAR'\n | 'GRADIENT_DIAMOND'\n\nconst SUBTYPES: { value: GradientSubtype; label: string }[] = [\n { value: 'GRADIENT_LINEAR', label: 'Linear' },\n { value: 'GRADIENT_RADIAL', label: 'Radial' },\n { value: 'GRADIENT_ANGULAR', label: 'Angular' },\n { value: 'GRADIENT_DIAMOND', label: 'Diamond' }\n]\n\n/**\n * Returns gradient-stop state and mutation helpers for a fill.\n *\n * Use this composable for gradient editors that need subtype switching,\n * active-stop selection, stop dragging, and stop color/opacity editing.\n */\nexport function useGradientStops(fill: Ref<Fill>, onUpdate: (fill: Fill) => void) {\n const activeStopIndex = ref(0)\n const stops = computed(() => fill.value.gradientStops ?? [])\n const subtype = computed(() => fill.value.type as GradientSubtype)\n\n const activeColor = computed(() => {\n const s = stops.value\n if (!s.length) return fill.value.color\n return s[Math.min(activeStopIndex.value, s.length - 1)].color\n })\n\n const barBackground = computed(() =>\n stops.value.length\n ? `linear-gradient(to right, ${stops.value.map((s) => `${colorToCSS(s.color)} ${s.position * 100}%`).join(', ')})`\n : ''\n )\n\n function emitStops(newStops: GradientStop[]) {\n onUpdate({ ...fill.value, gradientStops: newStops })\n }\n\n /** Figma keeps the transform across kinds, so a radial gradient grows from the linear line. */\n function setSubtype(type: GradientSubtype) {\n if (type === fill.value.type) return\n const gradientTransform: GradientTransform = fill.value.gradientTransform ?? {\n ...DEFAULT_GRADIENT_TRANSFORM\n }\n onUpdate({ ...fill.value, type, gradientTransform })\n }\n\n function selectStop(index: number) {\n activeStopIndex.value = index\n }\n\n function addStop() {\n const s = [...stops.value]\n const pos = s.length >= 2 ? (s[s.length - 2].position + s[s.length - 1].position) / 2 : 0.5\n s.push({ color: { ...activeColor.value }, position: pos })\n s.sort((a, b) => a.position - b.position)\n activeStopIndex.value = s.findIndex((stop) => stop.position === pos)\n emitStops(s)\n }\n\n function removeStop(index: number) {\n if (stops.value.length <= 2) return\n emitStops(stops.value.filter((_, i) => i !== index))\n activeStopIndex.value = Math.min(activeStopIndex.value, stops.value.length - 2)\n }\n\n function updateStopPosition(index: number, position: number) {\n const s = [...stops.value]\n s[index] = { ...s[index], position: Math.max(0, Math.min(1, position / 100)) }\n emitStops(s)\n }\n\n function updateStopColor(index: number, hex: string) {\n selectStop(index)\n colorModel.updateHex(hex)\n }\n\n function updateStopOpacity(index: number, opacity: number) {\n const s = [...stops.value]\n s[index] = {\n ...s[index],\n color: { ...s[index].color, a: Math.max(0, Math.min(1, opacity / 100)) }\n }\n emitStops(s)\n }\n\n function updateActiveColor(color: Color) {\n const s = [...stops.value]\n const idx = Math.min(activeStopIndex.value, s.length - 1)\n s[idx] = { ...s[idx], color }\n emitStops(s)\n }\n\n const colorModel = useColorModel({\n color: activeColor,\n onUpdate: updateActiveColor\n })\n\n function dragStop(index: number, position: number) {\n const s = [...stops.value]\n s[index] = { ...s[index], position }\n emitStops(s)\n }\n\n return {\n activeStopIndex,\n stops,\n subtype,\n subtypes: SUBTYPES,\n activeColor,\n barBackground,\n setSubtype,\n selectStop,\n addStop,\n removeStop,\n updateStopPosition,\n updateStopColor,\n updateStopOpacity,\n updateActiveColor,\n dragStop\n }\n}\n"],"mappings":";;;;;AAeA,MAAM,WAAwD;CAC5D;EAAE,OAAO;EAAmB,OAAO;CAAS;CAC5C;EAAE,OAAO;EAAmB,OAAO;CAAS;CAC5C;EAAE,OAA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AAC;CACb;CAEA,OAAO;EACL;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useGradientStops.js","names":[],"sources":["../../../src/primitives/GradientEditor/useGradientStops.ts"],"sourcesContent":["import { computed, ref, toValue, type MaybeRefOrGetter, type Ref } from 'vue'\n\nimport type { ColorProfile, Fill, GradientStop, GradientTransform } from '@pairdraw/scene-graph'\nimport { colorToPreviewCSS } from '@pairdraw/scene-graph/color'\nimport { DEFAULT_GRADIENT_TRANSFORM } from '@pairdraw/scene-graph/gradient'\nimport type { Color } from '@pairdraw/scene-graph/primitives'\n\nimport { useColorModel } from '#vue/controls/color-model/use'\n\ntype GradientSubtype =\n | 'GRADIENT_LINEAR'\n | 'GRADIENT_RADIAL'\n | 'GRADIENT_ANGULAR'\n | 'GRADIENT_DIAMOND'\n\nconst SUBTYPES: { value: GradientSubtype; label: string }[] = [\n { value: 'GRADIENT_LINEAR', label: 'Linear' },\n { value: 'GRADIENT_RADIAL', label: 'Radial' },\n { value: 'GRADIENT_ANGULAR', label: 'Angular' },\n { value: 'GRADIENT_DIAMOND', label: 'Diamond' }\n]\n\n/**\n * Returns gradient-stop state and mutation helpers for a fill.\n *\n * Use this composable for gradient editors that need subtype switching,\n * active-stop selection, stop dragging, and stop color/opacity editing.\n */\nexport function useGradientStops(\n fill: Ref<Fill>,\n onUpdate: (fill: Fill) => void,\n options: { colorProfile?: MaybeRefOrGetter<ColorProfile> } = {}\n) {\n const activeStopIndex = ref(0)\n const stops = computed(() => fill.value.gradientStops ?? [])\n const subtype = computed(() => fill.value.type as GradientSubtype)\n\n const activeColor = computed(() => {\n const s = stops.value\n if (!s.length) return fill.value.color\n return s[Math.min(activeStopIndex.value, s.length - 1)].color\n })\n\n const barBackground = computed(() => {\n if (!stops.value.length) return ''\n const profile = toValue(options.colorProfile ?? 'srgb')\n const paints = stops.value.map(\n (s) => `${colorToPreviewCSS(s.color, profile)} ${s.position * 100}%`\n )\n return `linear-gradient(to right, ${paints.join(', ')})`\n })\n\n function emitStops(newStops: GradientStop[]) {\n onUpdate({ ...fill.value, gradientStops: newStops })\n }\n\n /** Figma keeps the transform across kinds, so a radial gradient grows from the linear line. */\n function setSubtype(type: GradientSubtype) {\n if (type === fill.value.type) return\n const gradientTransform: GradientTransform = fill.value.gradientTransform ?? {\n ...DEFAULT_GRADIENT_TRANSFORM\n }\n onUpdate({ ...fill.value, type, gradientTransform })\n }\n\n function selectStop(index: number) {\n activeStopIndex.value = index\n }\n\n function addStop() {\n const s = [...stops.value]\n const pos = s.length >= 2 ? (s[s.length - 2].position + s[s.length - 1].position) / 2 : 0.5\n s.push({ color: { ...activeColor.value }, position: pos })\n s.sort((a, b) => a.position - b.position)\n activeStopIndex.value = s.findIndex((stop) => stop.position === pos)\n emitStops(s)\n }\n\n function removeStop(index: number) {\n if (stops.value.length <= 2) return\n emitStops(stops.value.filter((_, i) => i !== index))\n activeStopIndex.value = Math.min(activeStopIndex.value, stops.value.length - 2)\n }\n\n function updateStopPosition(index: number, position: number) {\n const s = [...stops.value]\n s[index] = { ...s[index], position: Math.max(0, Math.min(1, position / 100)) }\n emitStops(s)\n }\n\n function updateStopColor(index: number, hex: string) {\n selectStop(index)\n colorModel.updateHex(hex)\n }\n\n function updateStopOpacity(index: number, opacity: number) {\n const s = [...stops.value]\n s[index] = {\n ...s[index],\n color: { ...s[index].color, a: Math.max(0, Math.min(1, opacity / 100)) }\n }\n emitStops(s)\n }\n\n function updateActiveColor(color: Color) {\n const s = [...stops.value]\n const idx = Math.min(activeStopIndex.value, s.length - 1)\n s[idx] = { ...s[idx], color }\n emitStops(s)\n }\n\n const colorModel = useColorModel({\n color: activeColor,\n colorProfile: options.colorProfile,\n onUpdate: updateActiveColor\n })\n\n function dragStop(index: number, position: number) {\n const s = [...stops.value]\n s[index] = { ...s[index], position }\n emitStops(s)\n }\n\n return {\n activeStopIndex,\n stops,\n subtype,\n subtypes: SUBTYPES,\n activeColor,\n barBackground,\n setSubtype,\n selectStop,\n addStop,\n removeStop,\n updateStopPosition,\n updateStopColor,\n updateStopOpacity,\n updateActiveColor,\n dragStop\n }\n}\n"],"mappings":";;;;;AAeA,MAAM,WAAwD;CAC5D;EAAE,OAAO;EAAmB,OAAO;CAAS;CAC5C;EAAE,OAAO;EAAmB,OAAO;CAAS;CAC5C;EAAE,OAAO;EAAoB,OAAO;CAAU;CAC9C;EAAE,OAAO;EAAoB,OAAO;CAAU;AAChD;;;;;;;AAQA,SAAgB,iBACd,MACA,UACA,UAA6D,CAAC,GAC9D;CACA,MAAM,kBAAkB,IAAI,CAAC;CAC7B,MAAM,QAAQ,eAAe,KAAK,MAAM,iBAAiB,CAAC,CAAC;CAC3D,MAAM,UAAU,eAAe,KAAK,MAAM,IAAuB;CAEjE,MAAM,cAAc,eAAe;EACjC,MAAM,IAAI,MAAM;EAChB,IAAI,CAAC,EAAE,QAAQ,OAAO,KAAK,MAAM;EACjC,OAAO,EAAE,KAAK,IAAI,gBAAgB,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;CAC1D,CAAC;CAED,MAAM,gBAAgB,eAAe;EACnC,IAAI,CAAC,MAAM,MAAM,QAAQ,OAAO;EAChC,MAAM,UAAU,QAAQ,QAAQ,gBAAgB,MAAM;EAItD,OAAO,6BAHQ,MAAM,MAAM,KACxB,MAAM,GAAG,kBAAkB,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE,WAAW,IAAI,EAE3B,CAAC,CAAC,KAAK,IAAI,EAAE;CACxD,CAAC;CAED,SAAS,UAAU,UAA0B;EAC3C,SAAS;GAAE,GAAG,KAAK;GAAO,eAAe;EAAS,CAAC;CACrD;;CAGA,SAAS,WAAW,MAAuB;EACzC,IAAI,SAAS,KAAK,MAAM,MAAM;EAC9B,MAAM,oBAAuC,KAAK,MAAM,qBAAqB,EAC3E,GAAG,2BACL;EACA,SAAS;GAAE,GAAG,KAAK;GAAO;GAAM;EAAkB,CAAC;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AAI,CAAC,GAAG,MAAM,KAAK;EACzB,MAAM,MAAM,KAAK,IAAI,gBAAgB,OAAO,EAAE,SAAS,CAAC;EACxD,EAAE,OAAO;GAAE,GAAG,EAAE;GAAM;EAAM;EAC5B,UAAU,CAAC;CACb;CAEA,MAAM,aAAa,cAAc;EAC/B,OAAO;EACP,cAAc,QAAQ;EACtB,UAAU;CACZ,CAAC;CAED,SAAS,SAAS,OAAe,UAAkB;EACjD,MAAM,IAAI,CAAC,GAAG,MAAM,KAAK;EACzB,EAAE,SAAS;GAAE,GAAG,EAAE;GAAQ;EAAS;EACnC,UAAU,CAAC;CACb;CAEA,OAAO;EACL;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -5,6 +5,8 @@ type __VLS_Props = {
5
5
  /** Whether the tree selects more than one layer at a time; Reka announces it to assistive tech. */
6
6
  multiple?: boolean;
7
7
  };
8
+ /** Moves the list to a row without selecting it, for keyboard focus and Tab. */
9
+ declare function reveal(id: string): void;
8
10
  declare function select(id: string, selection: boolean | LayerSelectionMode): void;
9
11
  declare function toggleExpand(id: string): void;
10
12
  declare function setVirtualizer(next: LayerTreeVirtualizer): void;
@@ -86,6 +88,7 @@ declare var __VLS_8: {
86
88
  actions: {
87
89
  select: typeof select;
88
90
  toggleExpand: typeof toggleExpand;
91
+ reveal: typeof reveal;
89
92
  setFocused: (value: boolean) => void;
90
93
  setVirtualizer: typeof setVirtualizer;
91
94
  };
@@ -93,7 +96,9 @@ declare var __VLS_8: {
93
96
  type __VLS_Slots = {} & {
94
97
  default?: (props: typeof __VLS_8) => any;
95
98
  };
96
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
99
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
100
+ visibleRows: import("vue").ComputedRef<LayerRow[]>;
101
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
97
102
  select: (id: string, additive: boolean) => any;
98
103
  rename: (id: string, name: string) => any;
99
104
  toggleVisibility: (id: string) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"LayerTreeRoot.vue.d.ts","names":[],"sources":["../../../src/primitives/LayerTree/LayerTreeRoot.vue"],"mappings":";;KAwTK;EACH;;EAEA;;iBA4JO,OAAO,YAAY,qBAAqB;iBAyBxC,aAAa;iBAeb,eAAe,MAAM;YA8H1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAvHkB,aAAA;;;;KAwHjB;EACD,WAAW,cAAc;;cAKvB,0BAAU,gBAAA,2CAAA,qCAAA;;;;;;;;;;;;0CAGd;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}
1
+ {"version":3,"file":"LayerTreeRoot.vue.d.ts","names":[],"sources":["../../../src/primitives/LayerTree/LayerTreeRoot.vue"],"mappings":";;KAsUK;EACH;;EAEA;;;iBA6HO,OAAO;iBAyCP,OAAO,YAAY,qBAAqB;iBAyBxC,aAAa;iBAeb,eAAe,MAAM;YAmI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA3HkB,aAAA;;;;KA4HjB;EACD,WAAW,cAAc;;cAKvB,0BAAU,gBAAA;yCAAA;;;;;;;;;;;;;0CAId;cACI,cAAqB,uBAAuB,YAAY;cACzC,iBAAO;KACvB,gBAAgB,GAAG,KAAK;;IAE3B,QAAQ"}