@scalar/api-client 3.19.3 → 3.20.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 (403) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
  3. package/dist/components/SectionFilter.vue.d.ts +2 -0
  4. package/dist/components/SectionFilter.vue.d.ts.map +1 -1
  5. package/dist/components/SectionFilter.vue.js +1 -1
  6. package/dist/components/SectionFilter.vue.js.map +1 -1
  7. package/dist/components/SectionFilter.vue.script.js +11 -8
  8. package/dist/components/SectionFilter.vue.script.js.map +1 -1
  9. package/dist/components/Server/ServerVariablesSelect.vue.d.ts.map +1 -1
  10. package/dist/components/Server/ServerVariablesSelect.vue.js.map +1 -1
  11. package/dist/components/Server/ServerVariablesSelect.vue.script.js +5 -3
  12. package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
  13. package/dist/components/Server/ServerVariablesTextbox.vue.d.ts.map +1 -1
  14. package/dist/components/Server/ServerVariablesTextbox.vue.js.map +1 -1
  15. package/dist/components/Server/ServerVariablesTextbox.vue.script.js +6 -3
  16. package/dist/components/Server/ServerVariablesTextbox.vue.script.js.map +1 -1
  17. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
  18. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js.map +1 -1
  19. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js +4 -2
  20. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js.map +1 -1
  21. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  22. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js.map +1 -1
  23. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +3 -1
  24. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
  25. package/dist/style.css +159 -135
  26. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +2 -0
  27. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  28. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  29. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +9 -3
  30. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  31. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  32. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  33. package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
  34. package/dist/v2/blocks/operation-block/components/Header.vue.script.js +10 -6
  35. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  36. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts.map +1 -1
  37. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
  38. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js.map +1 -1
  39. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +4 -2
  40. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
  41. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  42. package/dist/v2/blocks/operation-block/helpers/send-request.js +4 -3
  43. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  44. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +2 -0
  45. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  46. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  47. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  48. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +51 -26
  49. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  50. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  51. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  52. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  53. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +28 -8
  54. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  55. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
  56. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.js.map +1 -1
  57. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +9 -3
  58. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
  59. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.d.ts.map +1 -1
  60. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.js.map +1 -1
  61. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js +6 -4
  62. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js.map +1 -1
  63. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  64. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
  65. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +3 -1
  66. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  67. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  68. package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
  69. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +7 -5
  70. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
  71. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -2
  72. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  73. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  74. package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
  75. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +40 -7
  76. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
  77. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +12 -12
  78. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  79. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  80. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +24 -20
  81. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  82. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
  83. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js.map +1 -1
  84. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +6 -4
  85. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
  86. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
  87. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +5 -4
  88. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
  89. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  90. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  91. package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
  92. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +34 -13
  93. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
  94. package/dist/v2/blocks/response-block/components/Headers.vue.d.ts +3 -3
  95. package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
  96. package/dist/v2/blocks/response-block/components/Headers.vue.js.map +1 -1
  97. package/dist/v2/blocks/response-block/components/Headers.vue.script.js +5 -3
  98. package/dist/v2/blocks/response-block/components/Headers.vue.script.js.map +1 -1
  99. package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts.map +1 -1
  100. package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
  101. package/dist/v2/blocks/response-block/components/ResponseBody.vue.js.map +1 -1
  102. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +3 -1
  103. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
  104. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.d.ts.map +1 -1
  105. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.js.map +1 -1
  106. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +11 -3
  107. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
  108. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts.map +1 -1
  109. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
  110. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js.map +1 -1
  111. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +8 -6
  112. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
  113. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts +1 -0
  114. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
  115. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js.map +1 -1
  116. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +109 -56
  117. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
  118. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.d.ts.map +1 -1
  119. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.js.map +1 -1
  120. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js +5 -3
  121. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js.map +1 -1
  122. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.d.ts.map +1 -1
  123. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.js.map +1 -1
  124. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +6 -3
  125. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
  126. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.d.ts.map +1 -1
  127. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js.map +1 -1
  128. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +7 -5
  129. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
  130. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
  131. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
  132. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
  133. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js.map +1 -1
  134. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +20 -15
  135. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
  136. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
  137. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
  138. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js.map +1 -1
  139. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +4 -2
  140. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
  141. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts.map +1 -1
  142. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js.map +1 -1
  143. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js +11 -6
  144. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js.map +1 -1
  145. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts +4 -0
  146. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts.map +1 -0
  147. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js +100 -0
  148. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js.map +1 -0
  149. package/dist/v2/blocks/response-block/helpers/response-stream.d.ts +13 -0
  150. package/dist/v2/blocks/response-block/helpers/response-stream.d.ts.map +1 -0
  151. package/dist/v2/blocks/response-block/helpers/response-stream.js +97 -0
  152. package/dist/v2/blocks/response-block/helpers/response-stream.js.map +1 -0
  153. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +1 -1
  154. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  155. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  156. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  157. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +39 -27
  158. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  159. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +6 -6
  160. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  161. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
  162. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
  163. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +7 -4
  164. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
  165. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
  166. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
  167. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +21 -16
  168. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
  169. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  170. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
  171. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +7 -5
  172. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  173. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
  174. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js.map +1 -1
  175. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +7 -5
  176. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +1 -1
  177. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  178. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  179. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +105 -40
  180. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  181. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
  182. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js.map +1 -1
  183. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +10 -8
  184. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
  185. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  186. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js.map +1 -1
  187. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +14 -9
  188. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
  189. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
  190. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
  191. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +6 -4
  192. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
  193. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  194. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
  195. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js +3 -1
  196. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
  197. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  198. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
  199. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +40 -40
  200. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  201. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +108 -7
  202. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -1
  203. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +12 -0
  204. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
  205. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  206. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.d.ts.map +1 -1
  207. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js +8 -5
  208. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js.map +1 -1
  209. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +2 -0
  210. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -1
  211. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +2 -0
  212. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js.map +1 -1
  213. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts +3 -0
  214. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts.map +1 -0
  215. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js +8 -0
  216. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js.map +1 -0
  217. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts +3 -0
  218. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts.map +1 -0
  219. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js +11 -0
  220. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js.map +1 -0
  221. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts +19 -0
  222. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts.map +1 -0
  223. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js +117 -0
  224. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js.map +1 -0
  225. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -1
  226. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  227. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +15 -11
  228. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  229. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts +1 -1
  230. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts.map +1 -1
  231. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js +8 -1
  232. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js.map +1 -1
  233. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -1
  234. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +6 -0
  235. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
  236. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -1
  237. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  238. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +8 -6
  239. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
  240. package/dist/v2/components/code-input/CodeInput.vue.d.ts +4 -4
  241. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  242. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  243. package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
  244. package/dist/v2/components/code-input/CodeInput.vue.script.js +10 -10
  245. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  246. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts +4 -4
  247. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
  248. package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
  249. package/dist/v2/components/code-input/CodeInputLite.vue.js.map +1 -1
  250. package/dist/v2/components/code-input/CodeInputLite.vue.script.js +8 -5
  251. package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
  252. package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts +4 -0
  253. package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts.map +1 -1
  254. package/dist/v2/components/code-input/PillTooltipHost.vue.js.map +1 -1
  255. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +7 -3
  256. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
  257. package/dist/v2/components/code-input/code-variable-widget.d.ts +3 -0
  258. package/dist/v2/components/code-input/code-variable-widget.d.ts.map +1 -1
  259. package/dist/v2/components/code-input/code-variable-widget.js +6 -3
  260. package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
  261. package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts +0 -1
  262. package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts.map +1 -1
  263. package/dist/v2/components/data-table/DataTableCheckbox.vue.js.map +1 -1
  264. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +4 -2
  265. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
  266. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  267. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  268. package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
  269. package/dist/v2/components/data-table/DataTableInput.vue.script.js +5 -3
  270. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  271. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  272. package/dist/v2/components/data-table/DataTableInputSelect.vue.js.map +1 -1
  273. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +12 -9
  274. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
  275. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
  276. package/dist/v2/components/forms/ConfirmationForm.vue.js.map +1 -1
  277. package/dist/v2/components/forms/ConfirmationForm.vue.script.js +5 -3
  278. package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
  279. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
  280. package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
  281. package/dist/v2/components/layout/CollapsibleSection.vue.script.js +3 -1
  282. package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
  283. package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -1
  284. package/dist/v2/components/modals/DeleteModal.vue.js.map +1 -1
  285. package/dist/v2/components/modals/DeleteModal.vue.script.js +3 -1
  286. package/dist/v2/components/modals/DeleteModal.vue.script.js.map +1 -1
  287. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
  288. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  289. package/dist/v2/components/modals/ModalClientContainer.vue.js.map +1 -1
  290. package/dist/v2/components/modals/ModalClientContainer.vue.script.js +5 -2
  291. package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
  292. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  293. package/dist/v2/components/server/ServerDropdown.vue.js.map +1 -1
  294. package/dist/v2/components/server/ServerDropdown.vue.script.js +9 -5
  295. package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
  296. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  297. package/dist/v2/components/sidebar/Sidebar.vue.js.map +1 -1
  298. package/dist/v2/components/sidebar/Sidebar.vue.script.js +4 -2
  299. package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
  300. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  301. package/dist/v2/components/sidebar/SidebarMenu.vue.js.map +1 -1
  302. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +4 -2
  303. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
  304. package/dist/v2/components/sidebar/SidebarToggle.vue.d.ts.map +1 -1
  305. package/dist/v2/components/sidebar/SidebarToggle.vue.js.map +1 -1
  306. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +4 -2
  307. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
  308. package/dist/v2/constants.js +1 -1
  309. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -1
  310. package/dist/v2/features/command-palette/components/CommandActionForm.vue.js.map +1 -1
  311. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +4 -2
  312. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
  313. package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +2 -2
  314. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
  315. package/dist/v2/features/environments/EnvironmentsList.vue.js.map +1 -1
  316. package/dist/v2/features/environments/EnvironmentsList.vue.script.js +4 -2
  317. package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
  318. package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
  319. package/dist/v2/features/environments/components/Environment.vue.js.map +1 -1
  320. package/dist/v2/features/environments/components/Environment.vue.script.js +12 -10
  321. package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
  322. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
  323. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.js.map +1 -1
  324. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +5 -3
  325. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
  326. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
  327. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.js.map +1 -1
  328. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +9 -6
  329. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
  330. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  331. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
  332. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +6 -4
  333. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  334. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
  335. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
  336. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js.map +1 -1
  337. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +22 -10
  338. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
  339. package/dist/v2/features/localization/index.d.ts +18 -0
  340. package/dist/v2/features/localization/index.d.ts.map +1 -0
  341. package/dist/v2/features/localization/index.js +35 -0
  342. package/dist/v2/features/localization/index.js.map +1 -0
  343. package/dist/v2/features/localization/locales/ar.d.ts +385 -0
  344. package/dist/v2/features/localization/locales/ar.d.ts.map +1 -0
  345. package/dist/v2/features/localization/locales/ar.js +345 -0
  346. package/dist/v2/features/localization/locales/ar.js.map +1 -0
  347. package/dist/v2/features/localization/locales/de.d.ts +385 -0
  348. package/dist/v2/features/localization/locales/de.d.ts.map +1 -0
  349. package/dist/v2/features/localization/locales/de.js +345 -0
  350. package/dist/v2/features/localization/locales/de.js.map +1 -0
  351. package/dist/v2/features/localization/locales/es.d.ts +385 -0
  352. package/dist/v2/features/localization/locales/es.d.ts.map +1 -0
  353. package/dist/v2/features/localization/locales/es.js +345 -0
  354. package/dist/v2/features/localization/locales/es.js.map +1 -0
  355. package/dist/v2/features/localization/locales/fr.d.ts +385 -0
  356. package/dist/v2/features/localization/locales/fr.d.ts.map +1 -0
  357. package/dist/v2/features/localization/locales/fr.js +345 -0
  358. package/dist/v2/features/localization/locales/fr.js.map +1 -0
  359. package/dist/v2/features/localization/locales/pt.d.ts +385 -0
  360. package/dist/v2/features/localization/locales/pt.d.ts.map +1 -0
  361. package/dist/v2/features/localization/locales/pt.js +345 -0
  362. package/dist/v2/features/localization/locales/pt.js.map +1 -0
  363. package/dist/v2/features/localization/locales/ru.d.ts +385 -0
  364. package/dist/v2/features/localization/locales/ru.d.ts.map +1 -0
  365. package/dist/v2/features/localization/locales/ru.js +345 -0
  366. package/dist/v2/features/localization/locales/ru.js.map +1 -0
  367. package/dist/v2/features/localization/locales/zh-cn.d.ts +385 -0
  368. package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -0
  369. package/dist/v2/features/localization/locales/zh-cn.js +345 -0
  370. package/dist/v2/features/localization/locales/zh-cn.js.map +1 -0
  371. package/dist/v2/features/localization/translations.d.ts +385 -0
  372. package/dist/v2/features/localization/translations.d.ts.map +1 -0
  373. package/dist/v2/features/localization/translations.js +345 -0
  374. package/dist/v2/features/localization/translations.js.map +1 -0
  375. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  376. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  377. package/dist/v2/features/modal/Modal.vue.script.js +15 -4
  378. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  379. package/dist/v2/features/modal/use-lazy-api-client.d.ts +11 -0
  380. package/dist/v2/features/modal/use-lazy-api-client.d.ts.map +1 -0
  381. package/dist/v2/features/modal/use-lazy-api-client.js +48 -0
  382. package/dist/v2/features/modal/use-lazy-api-client.js.map +1 -0
  383. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  384. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  385. package/dist/v2/features/operation/Operation.vue.script.js +22 -6
  386. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  387. package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
  388. package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
  389. package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -1
  390. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +12 -8
  391. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
  392. package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
  393. package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -1
  394. package/dist/v2/features/search/components/SearchResult.vue.script.js +14 -10
  395. package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
  396. package/dist/v2/types/options.d.ts +1 -1
  397. package/dist/v2/types/options.d.ts.map +1 -1
  398. package/dist/v2/workspace-events.d.ts +2 -2
  399. package/dist/v2/workspace-events.d.ts.map +1 -1
  400. package/dist/v2/workspace-events.js +8 -1
  401. package/dist/v2/workspace-events.js.map +1 -1
  402. package/dist/vue-styles.css +124 -125
  403. package/package.json +22 -11
@@ -1,3 +1,4 @@
1
+ import { useLocalization } from "../../features/localization/index.js";
1
2
  import DataTableInputSelect_default from "../data-table/DataTableInputSelect.vue.js";
2
3
  import EnvironmentVariablesDropdown_default from "../../features/environments/components/EnvironmentVariablesDropdown.vue.js";
3
4
  import PillTooltipHost_default from "./PillTooltipHost.vue.js";
@@ -5,7 +6,7 @@ import { lookupVariableValue } from "./helpers/lookup-variable-value.js";
5
6
  import { buildPillContext } from "./helpers/build-pill-context.js";
6
7
  import { pillSignature } from "./helpers/pill-signature.js";
7
8
  import { serializeValue } from "./helpers/serialize-value.js";
8
- import { Fragment, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, nextTick, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, toDisplayString, useAttrs, useTemplateRef, watch } from "vue";
9
+ import { Fragment, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, nextTick, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, toDisplayString, unref, useAttrs, useTemplateRef, watch } from "vue";
9
10
  import { isDefined } from "@scalar/helpers/array/is-defined";
10
11
  import { CONTEXT_FUNCTION_NAMES, getContextFunctionComment, isContextFunctionName } from "@scalar/workspace-store/request-example";
11
12
  import { nanoid } from "nanoid";
@@ -111,6 +112,7 @@ var CodeInputLite_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
111
112
  ],
112
113
  setup(__props, { expose: __expose, emit: __emit }) {
113
114
  const emit = __emit;
115
+ const { translate } = useLocalization();
114
116
  const attrs = useAttrs();
115
117
  const ariaLabel = computed(() => typeof attrs["aria-label"] === "string" ? attrs["aria-label"] : void 0);
116
118
  /**
@@ -144,9 +146,9 @@ var CodeInputLite_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
144
146
  * Whether the serialized value should count as empty for placeholder display.
145
147
  *
146
148
  * `contenteditable` can leave behind invisible residue after some delete
147
- * sequences — most commonly a non-breaking space (` `) — which makes a
149
+ * sequences — most commonly a non-breaking space (`\u00a0`) — which makes a
148
150
  * visually empty field report a non-zero length and silently drop its
149
- * placeholder. Trimming covers that case; ` ` counts as whitespace, so a
151
+ * placeholder. Trimming covers that case; `\u00a0` counts as whitespace, so a
150
152
  * field that only holds editor residue is treated as empty. This affects the
151
153
  * placeholder flag only, never the value emitted via `serializeEditor`.
152
154
  */
@@ -185,7 +187,8 @@ var CodeInputLite_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
185
187
  for (const pillEl of pills) {
186
188
  const app = createApp(PillTooltipHost_default, {
187
189
  context: buildPillContext(pillEl.dataset.variable ?? "", __props.environment),
188
- target: pillEl
190
+ target: pillEl,
191
+ translate
189
192
  });
190
193
  app.mount(document.createElement("div"));
191
194
  pillTooltipApps.push(app);
@@ -610,7 +613,7 @@ var CodeInputLite_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
610
613
  }, null, 40, _hoisted_3)], 16, _hoisted_2)),
611
614
  _ctx.$slots.warning ? (openBlock(), createElementBlock("div", _hoisted_4, [renderSlot(_ctx.$slots, "warning", {}, void 0, true)])) : createCommentVNode("", true),
612
615
  _ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_5, [renderSlot(_ctx.$slots, "icon", {}, void 0, true)])) : createCommentVNode("", true),
613
- __props.required ? (openBlock(), createElementBlock("div", _hoisted_6, " Required ")) : createCommentVNode("", true),
616
+ __props.required ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(unref(translate)("apiClient.codeInputLite.required")), 1)) : createCommentVNode("", true),
614
617
  displayVariablesDropdown.value ? (openBlock(), createBlock(EnvironmentVariablesDropdown_default, {
615
618
  key: 8,
616
619
  ref_key: "dropdownRef",
@@ -1 +1 @@
1
- {"version":3,"file":"CodeInputLite.vue.script.js","names":["$attrs","$slots"],"sources":["../../../../src/v2/components/code-input/CodeInputLite.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * CodeInputLite\n *\n * Single-line `contenteditable` editor that renders `{{varname}}` as atomic\n * pill spans (`contenteditable=\"false\"`) and offers an env-variable\n * autocomplete on `{{`. The value is still exposed as a `{{name}}`-bearing\n * string via `update:modelValue`; DOM ↔ model conversion lives in\n * `renderModel` and `serializeEditor`.\n */\nexport default {\n inheritAttrs: false,\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport {\n CONTEXT_FUNCTION_NAMES,\n getContextFunctionComment,\n isContextFunctionName,\n type ContextFunctionName,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { nanoid } from 'nanoid'\nimport {\n computed,\n createApp,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n useTemplateRef,\n watch,\n type App,\n} from 'vue'\n\nimport DataTableInputSelect from '@/v2/components/data-table/DataTableInputSelect.vue'\nimport EnvironmentVariableDropdown from '@/v2/features/environments/components/EnvironmentVariablesDropdown.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport type { CodeInputModelValue } from './CodeInput.vue'\nimport { buildPillContext } from './helpers/build-pill-context'\nimport { lookupVariableValue } from './helpers/lookup-variable-value'\nimport { pillSignature } from './helpers/pill-signature'\nimport { serializeValue } from './helpers/serialize-value'\nimport PillTooltipHost from './PillTooltipHost.vue'\n\ntype Props = {\n modelValue: CodeInputModelValue\n /** Environment for variable substitution. Pass undefined to disable env vars */\n environment: XScalarEnvironment | undefined\n /** Render as a non-interactive read-only label */\n disabled?: boolean\n /** Render the input with the native `readonly` attribute (still focusable, no edits) */\n readOnly?: boolean\n /** Show error styling */\n error?: boolean\n /** Layout context affects styling and dropdown visibility */\n layout?: ClientLayout\n /** Placeholder text for an empty input */\n placeholder?: string\n /** Show required indicator */\n required?: boolean\n /** Emit submit on blur */\n emitOnBlur?: boolean\n /** Render variable pills + show the autocomplete dropdown */\n withVariables?: boolean\n /** Include `{{$guid}}` etc. in the autocomplete dropdown */\n withFakeData?: boolean\n /** Always emit change events even if the value is unchanged */\n alwaysEmitChange?: boolean\n /** Strike-through styling for the input text (e.g. overridden values) */\n linethrough?: boolean\n /** Schema type — drives boolean select mode when `boolean` is included */\n type?: string | string[]\n /** Predefined enum values; when set the input is replaced by a select */\n enum?: string[]\n /** Example values; when set (and no enum/boolean) the input is replaced by a select */\n examples?: string[]\n /** Default value to suggest in select modes */\n default?: CodeInputModelValue\n /** Whether the boolean select includes a `null` option */\n nullable?: boolean\n}\n\nconst {\n modelValue,\n environment,\n disabled = false,\n readOnly = false,\n error = false,\n layout = 'desktop',\n placeholder,\n required = false,\n emitOnBlur = true,\n alwaysEmitChange = false,\n withVariables = true,\n withFakeData = false,\n linethrough = false,\n type,\n enum: enumProp,\n examples,\n default: defaultProp,\n nullable = false,\n} = defineProps<Props>()\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string]\n 'submit': [value: string, event: KeyboardEvent | FocusEvent]\n 'blur': [value: string, event: FocusEvent]\n 'navigate': [route: { page: 'document'; path: 'environment' }]\n}>()\n\nconst attrs = useAttrs()\nconst ariaLabel = computed(() =>\n typeof attrs['aria-label'] === 'string' ? attrs['aria-label'] : undefined,\n)\n\n/**\n * The id only matters once the dropdown opens (`aria-controls` /\n * `aria-activedescendant`), so we defer `nanoid()` until first focus to\n * keep idle instances cheap. A consumer-supplied `id` attr is preserved.\n */\nconst generatedComponentId = ref<string | null>(null)\nconst componentId = computed((): string | undefined =>\n typeof attrs.id === 'string'\n ? attrs.id\n : (generatedComponentId.value ?? undefined),\n)\nconst ensureComponentId = (): void => {\n if (\n (typeof attrs.id !== 'string' || !attrs.id) &&\n generatedComponentId.value === null\n ) {\n generatedComponentId.value = `id-${nanoid()}`\n }\n}\n\nconst editorRef = useTemplateRef<HTMLDivElement>('editorRef')\nconst dropdownRef = ref<InstanceType<\n typeof EnvironmentVariableDropdown\n> | null>(null)\n\n/** Id of the dropdown's `role=\"listbox\"` element, for the combobox wiring. */\nconst listboxId = computed((): string | undefined =>\n componentId.value ? `${componentId.value}-listbox` : undefined,\n)\n\n/**\n * Id of the option the dropdown currently highlights. Mirrors the dropdown's\n * own selection so the editor can expose it via `aria-activedescendant`.\n */\nconst activeOptionId = computed(\n (): string | undefined => dropdownRef.value?.activeOptionId,\n)\n\nconst isFocused = ref(false)\nconst isEmpty = ref(true)\n\n/**\n * True while an IME composition is in progress. Rebuilding the editor DOM\n * mid-composition (e.g. when `{{` forms a pill) cancels the composition, so we\n * defer those rebuilds until `compositionend`.\n */\nconst isComposing = ref(false)\n\n/**\n * Whether the serialized value should count as empty for placeholder display.\n *\n * `contenteditable` can leave behind invisible residue after some delete\n * sequences — most commonly a non-breaking space (` `) — which makes a\n * visually empty field report a non-zero length and silently drop its\n * placeholder. Trimming covers that case; ` ` counts as whitespace, so a\n * field that only holds editor residue is treated as empty. This affects the\n * placeholder flag only, never the value emitted via `serializeEditor`.\n */\nconst isBlankValue = (text: string): boolean => text.trim().length === 0\n\n// ───────────────────────────────────────────────────────────────────\n// Rendering-mode detection (parity with CodeInput's select dispatch)\n// ───────────────────────────────────────────────────────────────────\n\n/** True when the schema type is exactly `boolean` (or includes it in a tuple type). */\nconst isBooleanMode = computed((): boolean => {\n if (enumProp?.length) {\n return false\n }\n return type === 'boolean' || (Array.isArray(type) && type.includes('boolean'))\n})\n\nconst booleanOptions = computed((): string[] =>\n nullable ? ['true', 'false', 'null'] : ['true', 'false'],\n)\n\n/** Default type when the schema is a tuple — picks the first non-null entry. */\nconst defaultType = computed((): string | undefined => {\n if (Array.isArray(type)) {\n return type.find((t) => t !== 'null') ?? 'string'\n }\n return type\n})\n\nconst handleSelectChange = (value: string): void =>\n emit('update:modelValue', value)\n\n// ───────────────────────────────────────────────────────────────────\n// Per-pill tooltip apps\n// ───────────────────────────────────────────────────────────────────\n\nlet pillTooltipApps: App[] = []\n\n/**\n * Per-pill tooltips are the heaviest part of the render (a Vue app +\n * `useTooltip` watch + listeners each), so we defer mounting them until\n * the first interaction (focus, pointerover, or dropdown open). Once on,\n * subsequent rebuilds remount tooltips for the new pills.\n */\nlet tooltipsActive = false\n\nconst teardownPillTooltips = (): void => {\n for (const app of pillTooltipApps) {\n app.unmount()\n }\n pillTooltipApps = []\n}\n\nconst mountPillTooltips = (): void => {\n if (!editorRef.value || layout === 'modal') {\n return\n }\n const pills = editorRef.value.querySelectorAll<HTMLElement>('.scalar-pill')\n for (const pillEl of pills) {\n const variableName = pillEl.dataset.variable ?? ''\n const context = buildPillContext(variableName, environment)\n const app = createApp(PillTooltipHost, { context, target: pillEl })\n // PillTooltipHost is renderless; useTooltip attaches to `target` directly.\n app.mount(document.createElement('div'))\n pillTooltipApps.push(app)\n }\n}\n\n// ───────────────────────────────────────────────────────────────────\n// DOM ↔ model conversion\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Build a pill `<span>` for the given variable. `contentEditable = 'false'`\n * makes the browser treat it as a single atom (arrow keys jump over it,\n * Backspace deletes it whole); `{{` / `}}` only live in the model string.\n */\nconst createPillElement = (\n name: string,\n start: number,\n end: number,\n): HTMLSpanElement => {\n const isCtx = isContextFunctionName(name)\n const span = document.createElement('span')\n span.className = isCtx ? 'scalar-pill scalar-pill--context-fn' : 'scalar-pill'\n span.contentEditable = 'false'\n span.dataset.variable = name\n // Model-coordinate offsets (the pill stands in for the full `{{name}}`).\n // Used by click forwarding and tests to map a pill back to the value.\n span.dataset.pillStart = String(start)\n span.dataset.pillEnd = String(end)\n\n const color = isCtx\n ? 'var(--scalar-color-3)'\n : environment?.color || 'var(--scalar-color-1)'\n span.style.setProperty('--tw-bg-base', color)\n\n // Fade env pills with no usable value. A falsy check (not just\n // `=== undefined`) matches the tooltip path's `Boolean(value)`, so a\n // variable declared with an empty string fades here too.\n const isUndefinedEnv = !isCtx && !lookupVariableValue(environment, name)\n if (isUndefinedEnv) {\n span.style.opacity = '0.5'\n }\n\n span.textContent = name\n return span\n}\n\n/** Render a model string into the editor as a mix of text nodes + pills. */\nconst renderModel = (text: string): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n\n teardownPillTooltips()\n editor.replaceChildren()\n\n if (!withVariables || !text.includes('{{')) {\n if (text) {\n editor.appendChild(document.createTextNode(text))\n }\n isEmpty.value = isBlankValue(text)\n return\n }\n\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = match.index\n const end = start + match[0].length\n if (start > lastIndex) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex, start)))\n }\n editor.appendChild(createPillElement(match[1] ?? '', start, end))\n lastIndex = end\n }\n\n if (lastIndex < text.length) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex)))\n }\n\n isEmpty.value = false\n if (tooltipsActive) {\n mountPillTooltips()\n }\n}\n\n/** Length the given child contributes to the serialized model string. */\nconst modelLengthOf = (node: Node): number => {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').length\n }\n if (node instanceof HTMLElement && node.classList.contains('scalar-pill')) {\n return `{{${node.dataset.variable ?? ''}}}`.length\n }\n // Defensive: a stray element (e.g. browser-inserted <br>) — use its text.\n return (node.textContent ?? '').length\n}\n\n/** Read the editor DOM back into a `{{name}}`-bearing model string. */\nconst serializeEditor = (): string => {\n const editor = editorRef.value\n if (!editor) {\n return ''\n }\n let out = ''\n for (const node of Array.from(editor.childNodes)) {\n if (node.nodeType === Node.TEXT_NODE) {\n out += node.textContent ?? ''\n } else if (\n node instanceof HTMLElement &&\n node.classList.contains('scalar-pill')\n ) {\n out += `{{${node.dataset.variable ?? ''}}}`\n } else if (node instanceof HTMLElement) {\n // Flatten any stray <br> / <div> the browser may inject on paste/Enter.\n out += node.textContent ?? ''\n }\n }\n return out\n}\n\nlet lastPillSignature: string | null = null\nlet lastEnvKey = ''\n\n/**\n * Cache key for the env + `withVariables` state. Includes variable\n * name/value pairs so the watcher notices adds/removes/edits even when\n * `environment.color` is unchanged — without that, pills keep stale\n * `isDefined` opacity and tooltip values until the input itself changes.\n */\nconst computeEnvKey = (): string => {\n const color = environment?.color ?? ''\n const flag = withVariables ? '1' : '0'\n const variables = environment?.variables ?? []\n let vars = ''\n for (const v of variables) {\n const value =\n typeof v.value === 'string' ? v.value : (v.value?.default ?? '')\n // Unit separators (\\x1f / \\x1e) so values can safely contain `|` or `=`.\n vars += `\\x1f${v.name}\\x1e${value}`\n }\n return `${color}|${flag}|${vars}`\n}\n\n/** Idempotent: first call flips `tooltipsActive` and mounts pill tooltips. */\nconst ensureTooltipsActive = (): void => {\n if (tooltipsActive) {\n return\n }\n tooltipsActive = true\n mountPillTooltips()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Caret ↔ model offset\n// ───────────────────────────────────────────────────────────────────\n\n/** Selection start as a model-string offset, or `null` if not inside the editor. */\nconst getModelCaret = (): number | null => {\n const editor = editorRef.value\n if (!editor) {\n return null\n }\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0) {\n return null\n }\n const range = selection.getRangeAt(0)\n if (\n range.startContainer !== editor &&\n !editor.contains(range.startContainer)\n ) {\n return null\n }\n\n // Anchored on the editor itself: `startOffset` is a child index.\n if (range.startContainer === editor) {\n let pos = 0\n for (\n let i = 0;\n i < range.startOffset && i < editor.childNodes.length;\n i++\n ) {\n pos += modelLengthOf(editor.childNodes.item(i))\n }\n return pos\n }\n\n let pos = 0\n for (const child of Array.from(editor.childNodes)) {\n if (child === range.startContainer) {\n return pos + range.startOffset\n }\n // Pills are non-editable; if a browser quirk still lands a selection\n // inside one, snap to the nearest boundary instead of getting stuck.\n if (child.contains(range.startContainer)) {\n return range.startOffset === 0 ? pos : pos + modelLengthOf(child)\n }\n pos += modelLengthOf(child)\n }\n return pos\n}\n\n/** Place the caret at the given model offset, walking the DOM to find it. */\nconst setModelCaret = (target: number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const range = document.createRange()\n let pos = 0\n let placed = false\n\n for (const child of Array.from(editor.childNodes)) {\n const len = modelLengthOf(child)\n if (pos + len >= target) {\n if (child.nodeType === Node.TEXT_NODE) {\n const into = Math.max(\n 0,\n Math.min(target - pos, (child.textContent ?? '').length),\n )\n range.setStart(child, into)\n } else if (target - pos <= 0) {\n range.setStartBefore(child)\n } else {\n range.setStartAfter(child)\n }\n placed = true\n break\n }\n pos += len\n }\n\n if (!placed) {\n range.selectNodeContents(editor)\n range.collapse(false)\n } else {\n range.collapse(true)\n }\n\n const selection = window.getSelection()\n if (!selection) {\n return\n }\n selection.removeAllRanges()\n selection.addRange(range)\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Environment variable dropdown\n// ───────────────────────────────────────────────────────────────────\n\nconst showDropdown = ref(false)\nconst dropdownQuery = ref('')\nconst dropdownPosition = ref({ left: 0, top: 0 })\n\nconst contextFunctionDropdownItems = computed(() =>\n withFakeData\n ? CONTEXT_FUNCTION_NAMES.map((key) => ({\n key,\n description: getContextFunctionComment(key as ContextFunctionName),\n }))\n : [],\n)\n\nconst displayVariablesDropdown = computed(\n (): boolean =>\n showDropdown.value &&\n withVariables &&\n layout !== 'modal' &&\n (Boolean(environment) || withFakeData),\n)\n\nconst updateDropdownVisibility = (): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const caret = getModelCaret()\n if (caret === null) {\n showDropdown.value = false\n return\n }\n const text = serializeEditor().slice(0, caret)\n const lastOpen = text.lastIndexOf('{{')\n const lastClose = text.lastIndexOf('}}')\n\n if (lastOpen <= lastClose) {\n showDropdown.value = false\n return\n }\n\n dropdownQuery.value = text.slice(lastOpen + 2)\n // Make sure the combobox has an id before it advertises `aria-expanded`, so\n // `aria-controls` always resolves to the listbox we are about to render.\n ensureComponentId()\n showDropdown.value = true\n\n // Anchor under the caret; `getBoundingClientRect` gives the caret rect in one read.\n nextTick(() => {\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0 || !editorRef.value) {\n return\n }\n const r = selection.getRangeAt(0).cloneRange()\n r.collapse(true)\n const rect = r.getBoundingClientRect()\n const editorRect = editorRef.value.getBoundingClientRect()\n // Some browsers collapse empty ranges to a zero rect — fall back to the editor edge.\n dropdownPosition.value = {\n left: rect.left || editorRect.left,\n top: rect.bottom || editorRect.bottom,\n }\n })\n}\n\nconst handleDropdownSelect = (item: string): void => {\n if (readOnly) {\n return\n }\n const caret = getModelCaret() ?? 0\n const value = serializeEditor()\n const from = Math.max(0, caret - dropdownQuery.value.length - 2)\n const to = caret\n const next = `${value.slice(0, from)}{{${item}}}${value.slice(to)}`\n const nextCursor = from + `{{${item}}}`.length\n\n // Pill set changed — force a re-render and reposition the caret.\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n setModelCaret(nextCursor)\n\n showDropdown.value = false\n emitChange(next, { skipDropdownCheck: true })\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Change / focus / blur\n// ───────────────────────────────────────────────────────────────────\n\nconst emitChange = (\n value: string,\n opts: { skipDropdownCheck?: boolean } = {},\n): void => {\n const same = value === serializeValue(modelValue)\n if (alwaysEmitChange || !same) {\n emit('update:modelValue', value)\n }\n if (!opts.skipDropdownCheck) {\n updateDropdownVisibility()\n }\n}\n\nconst handleInput = (): void => {\n const text = serializeEditor()\n isEmpty.value = isBlankValue(text)\n\n // Only rebuild when the pill set changes (e.g. `}}` closed a pattern, or\n // a value was pasted). Skipping it for plain-text edits preserves the\n // live selection — important for IME composition and double-click select.\n // Also defer while composing; `handleCompositionEnd` re-runs this path so the\n // rebuild happens once the IME has committed its text.\n const sig = pillSignature(text, withVariables)\n if (!isComposing.value && sig !== lastPillSignature) {\n const caret = getModelCaret()\n lastPillSignature = sig\n renderModel(text)\n if (caret !== null) {\n setModelCaret(caret)\n }\n }\n\n emitChange(text)\n}\n\nconst handleCompositionStart = (): void => {\n isComposing.value = true\n}\n\nconst handleCompositionEnd = (): void => {\n isComposing.value = false\n // Run the deferred input path now that the composition has committed, so any\n // pill that formed during composition is rendered.\n handleInput()\n}\n\nconst handleFocus = (): void => {\n isFocused.value = true\n ensureComponentId()\n ensureTooltipsActive()\n}\n\nconst handleBlur = (event: FocusEvent): void => {\n isFocused.value = false\n showDropdown.value = false\n const value = serializeEditor()\n // Check the serialized `value`, not `modelValue` — a `0` or `false` model is\n // a valid non-empty entry that should still submit on blur.\n if (emitOnBlur && value) {\n emit('submit', value, event)\n }\n emit('blur', value, event)\n}\n\n/**\n * Strip rich content on paste; `contenteditable=\"plaintext-only\"` is not\n * reliable cross-browser, so we intercept and use `insertText` to keep undo.\n */\nconst handlePaste = (event: ClipboardEvent): void => {\n event.preventDefault()\n const text = event.clipboardData?.getData('text/plain') ?? ''\n if (!text) {\n return\n }\n document.execCommand('insertText', false, text.replace(/\\r?\\n/g, ' '))\n // `insertText` normally fires an `input` event, but that is not guaranteed\n // across browsers. Run the same path explicitly so pill rendering, emptiness,\n // `update:modelValue`, and the dropdown never lag behind the pasted DOM.\n handleInput()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Keyboard handling\n// ───────────────────────────────────────────────────────────────────\n\nconst handleKeyDown = (event: KeyboardEvent): void => {\n if (showDropdown.value) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleArrowKey(\n event.key === 'ArrowDown' ? 'down' : 'up',\n )\n return\n }\n if (event.key === 'Enter') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleSelect()\n return\n }\n if (event.key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n showDropdown.value = false\n return\n }\n }\n\n if (event.key === 'Enter') {\n // Block the browser default so a contenteditable div does not insert\n // <br> / <div> and break single-line semantics, then emit submit\n // (used by the table editors).\n event.preventDefault()\n emit('submit', serializeEditor(), event)\n return\n }\n\n // Backspace / Delete: pill atomicity is handled by the browser via\n // `contenteditable=\"false\"` on pills — no manual `}}`-pair handling needed.\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Click forwarding & lifecycle\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Clicking a pill selects it whole, so a subsequent Backspace deletes it\n * in one keystroke and typing replaces it — the usual chip/mention model.\n */\nconst handleEditorClick = (event: MouseEvent): void => {\n const target =\n event.target instanceof Element\n ? event.target.closest<HTMLElement>('.scalar-pill')\n : null\n if (!target) {\n return\n }\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n const range = document.createRange()\n range.selectNode(target)\n const selection = window.getSelection()\n selection?.removeAllRanges()\n selection?.addRange(range)\n updateDropdownVisibility()\n}\n\nonMounted(() => {\n const initial = serializeValue(modelValue)\n lastPillSignature = pillSignature(initial, withVariables)\n lastEnvKey = computeEnvKey()\n renderModel(initial)\n isEmpty.value = isBlankValue(initial)\n\n // `autofocus` on a contenteditable div is not honoured natively, so focus\n // the editor ourselves when the consumer passes the attribute.\n if (Object.hasOwn(attrs, 'autofocus')) {\n editorRef.value?.focus()\n }\n})\n\nwatch(\n () => modelValue,\n (next) => {\n const serialized = serializeValue(next)\n // Always sync the placeholder flag, even when the DOM already matches and we\n // skip the rebuild below. Otherwise a value cell that switches from select\n // mode (no editor element) into the empty editor keeps a stale `isEmpty`,\n // and the placeholder silently disappears.\n isEmpty.value = isBlankValue(serialized)\n if (serializeEditor() === serialized) {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n)\n\n// The editable surface only exists in \"editor mode\" (see template). When a row switches into editor\n// mode after mount — most notably when this component instance is reused for a different table row —\n// `onMounted` has already run and the `modelValue` watch fired while `editorRef` was still null, so\n// the model was never painted into the freshly created element and the cell renders empty.\n//\n// Paint the model when the element appears, but only into a still-empty editor: an editor that\n// already holds text is either up to date or ahead of `modelValue` with an uncommitted edit/paste,\n// and must not be clobbered.\n//\n// `flush: 'sync'` makes the paint part of the same step that creates the element. Vue assigns a\n// non-null template ref from a post-render effect, so the element is already mounted and patched\n// when this runs — deferring any further (the `pre` default, or `post`) only pushes the paint past\n// the consumer effects that run later in the same flush. A parent that focuses the cell as it\n// switches into editor mode would then place the caret in a still-empty editor, and the paint's\n// `replaceChildren` would drop that selection.\nwatch(\n editorRef,\n (editor) => {\n if (!editor || !isBlankValue(serializeEditor())) {\n return\n }\n const serialized = serializeValue(modelValue)\n if (serialized === '') {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n { flush: 'sync' },\n)\n\nwatch(\n [() => environment, () => withVariables],\n () => {\n // Env changes affect pill colour and `isDefined` opacity — rebuild.\n const envKey = computeEnvKey()\n if (envKey === lastEnvKey) {\n return\n }\n lastEnvKey = envKey\n // Most rows are plain text; skip the DOM walk when there are no pills.\n // Pills introduced later flow through `handleInput` / the modelValue\n // watcher, which update `lastPillSignature`.\n if (lastPillSignature === '') {\n return\n }\n lastPillSignature = pillSignature(serializeEditor(), withVariables)\n // Preserve the caret across the rebuild so editing does not jump to the\n // start when the environment changes mid-edit (mirrors `handleInput`).\n const caret = getModelCaret()\n renderModel(serializeEditor())\n if (caret !== null) {\n setModelCaret(caret)\n }\n },\n // Variables are often mutated in place (e.g. editing a value in the env\n // editor) without the object reference changing — deep watch catches it.\n { deep: true },\n)\n\nonBeforeUnmount(() => {\n teardownPillTooltips()\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Public API\n// ───────────────────────────────────────────────────────────────────\n\ndefineExpose({\n /** Focus the editor. `position` controls caret placement. */\n focus: (position?: 'start' | 'end' | number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n if (!isDefined(position)) {\n return\n }\n const length = serializeEditor().length\n const pos =\n position === 'start' ? 0 : position === 'end' ? length : position\n setModelCaret(pos)\n },\n /** Replace the current value programmatically and re-render the pills. */\n setContent: (next = ''): void => {\n if (serializeEditor() === next) {\n return\n }\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n isEmpty.value = isBlankValue(next)\n },\n /** Read the current value as a `{{name}}`-bearing string. */\n getValue: (): string => serializeEditor(),\n /** Caret offset in the model string. */\n cursorPosition: (): number | undefined => {\n const c = getModelCaret()\n return c === null ? undefined : c\n },\n isFocused,\n editorRef,\n})\n</script>\n\n<template>\n <!-- Disabled mode: read-only label -->\n <div\n v-if=\"disabled\"\n class=\"text-c-2 flex cursor-default items-center justify-center\"\n :class=\"{\n 'font-code pr-2 pl-1 text-base': layout === 'modal',\n 'px-2': layout !== 'modal',\n 'line-through': linethrough,\n }\"\n data-testid=\"code-input-lite-disabled\">\n <span class=\"whitespace-nowrap\">{{ modelValue }}</span>\n </div>\n\n <!-- Enum mode: select dropdown with predefined values -->\n <DataTableInputSelect\n v-else-if=\"enumProp?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :type=\"defaultType\"\n :value=\"enumProp\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Boolean mode: select dropdown with true/false (and optionally null) -->\n <DataTableInputSelect\n v-else-if=\"isBooleanMode\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"booleanOptions\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Examples mode: select dropdown with example values -->\n <DataTableInputSelect\n v-else-if=\"examples?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"examples\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Editor mode -->\n <div\n v-else\n :id=\"componentId\"\n v-bind=\"$attrs\"\n class=\"code-input-lite group/code-input-lite peer relative w-full leading-[1.44] -outline-offset-1 has-[:focus-visible]:rounded-[4px] has-[:focus-visible]:outline\"\n :class=\"{\n 'code-input-lite--error': error,\n 'code-input-lite--empty': isEmpty,\n 'line-through': linethrough,\n }\">\n <!-- The single editable surface; see the file header for how pills work. -->\n <div\n ref=\"editorRef\"\n :aria-activedescendant=\"\n displayVariablesDropdown ? activeOptionId : undefined\n \"\n :aria-autocomplete=\"withVariables ? 'list' : undefined\"\n :aria-controls=\"displayVariablesDropdown ? listboxId : undefined\"\n :aria-expanded=\"displayVariablesDropdown ? 'true' : undefined\"\n :aria-invalid=\"error ? 'true' : undefined\"\n :aria-label=\"ariaLabel\"\n :aria-readonly=\"readOnly ? 'true' : undefined\"\n :aria-required=\"required ? 'true' : undefined\"\n class=\"code-input-lite__editor\"\n :contenteditable=\"readOnly ? 'false' : 'true'\"\n :data-placeholder=\"placeholder\"\n :role=\"withVariables ? 'combobox' : 'textbox'\"\n spellcheck=\"false\"\n @blur=\"handleBlur\"\n @click=\"handleEditorClick\"\n @compositionend=\"handleCompositionEnd\"\n @compositionstart=\"handleCompositionStart\"\n @focus=\"handleFocus\"\n @input=\"handleInput\"\n @keydown=\"handleKeyDown\"\n @paste=\"handlePaste\"\n @pointerover=\"ensureTooltipsActive\" />\n </div>\n\n <!--\n Slots and the required indicator are siblings of the mode templates so\n they render in every mode and so `absolute right-0` anchors to the\n surrounding (relative) cell rather than the shrink-wrapped mode wrapper.\n -->\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <div\n v-if=\"$slots.icon\"\n class=\"centered-y absolute right-0 flex h-full items-center p-1.5 group-has-[.code-input-lite__editor:focus]:z-1\">\n <slot name=\"icon\" />\n </div>\n <div\n v-if=\"required\"\n class=\"required centered-y text-xxs text-c-3 group-[.error]:text-red bg-b-1 pointer-events-none absolute right-0 mr-0.5 pt-px pr-2 opacity-100 shadow-[-8px_0_4px_var(--scalar-background-1)] transition-opacity duration-150 peer-has-[.code-input-lite__editor:focus]:opacity-0\">\n Required\n </div>\n\n <EnvironmentVariableDropdown\n v-if=\"displayVariablesDropdown\"\n ref=\"dropdownRef\"\n :contextFunctionItems=\"contextFunctionDropdownItems\"\n :dropdownPosition=\"dropdownPosition\"\n :environment=\"environment\"\n :listboxId=\"listboxId\"\n :query=\"dropdownQuery\"\n @close=\"showDropdown = false\"\n @redirect=\"emit('navigate', { page: 'document', path: 'environment' })\"\n @select=\"handleDropdownSelect\" />\n</template>\n\n<style scoped>\n.code-input-lite {\n /* Flex so the editor centres vertically in whatever height the cell gives us.\n Font properties inherit so we adopt the surrounding typography. */\n display: flex;\n align-items: center;\n}\n\n.code-input-lite__editor {\n /* Everything font-related inherits from the surrounding context. */\n font: inherit;\n letter-spacing: inherit;\n flex: 1;\n min-width: 0;\n background: transparent;\n outline: none;\n color: var(--scalar-color-1);\n caret-color: var(--scalar-color-1);\n /* Single-line: horizontal scroll keeps the caret visible for long values;\n the scrollbar itself is hidden (would be noisy inside a table cell). */\n white-space: pre;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n padding: 0 0.5em;\n box-sizing: border-box;\n line-height: 1.44;\n /* Positioning context for the absolutely positioned placeholder. */\n position: relative;\n}\n\n.code-input-lite__editor::-webkit-scrollbar {\n display: none;\n}\n\n/* Absolute so the placeholder does not occupy flow space inside the\n contenteditable; otherwise the caret would land after it on focus.\n `pointer-events: none` lets clicks fall through to focus the editor.\n Hidden on focus so it never renders on top of the text caret. */\n.code-input-lite--empty .code-input-lite__editor:not(:focus)::before {\n content: attr(data-placeholder);\n color: var(--scalar-color-3);\n pointer-events: none;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0.5em;\n display: flex;\n align-items: center;\n}\n\n.code-input-lite--error .code-input-lite__editor {\n outline: 1px solid var(--scalar-color-red);\n}\n</style>\n\n<style>\n/* Pill styling. Each pill is `<span contenteditable=\"false\">name</span>` —\n an atomic widget; the caret lands before or after it, never inside. */\n.scalar-pill {\n color: var(--scalar-color-2);\n border-radius: var(--scalar-radius-full);\n display: inline-block;\n font-family: var(--scalar-font-code);\n font-size: 0.9em;\n line-height: 1.4;\n vertical-align: baseline;\n background: var(--scalar-background-3);\n padding: 0.125em 0.6em;\n margin-right: 0.35em;\n cursor: text;\n /* Single click selects the whole pill — chip/mention model, deletes in one go. */\n user-select: all;\n -webkit-user-select: all;\n}\n\n.dark-mode .scalar-pill {\n background: color-mix(\n in srgb,\n var(--tw-bg-base, var(--scalar-color-1)),\n transparent 90%\n );\n}\n\n.light-mode .scalar-pill {\n background: var(--scalar-background-3);\n}\n\n.scalar-pill--context-fn {\n /* Inset box-shadow as a border so the layout box stays identical to plain pills. */\n box-shadow: 0 0 0 1px\n color-mix(in srgb, var(--scalar-color-3), transparent 35%) inset;\n}\n\n.dark-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 55%);\n}\n\n.light-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 40%);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkGhB,MAAM,OAAO;EAOb,MAAM,QAAQ,SAAS;EACvB,MAAM,YAAY,eAChB,OAAO,MAAM,kBAAkB,WAAW,MAAM,gBAAgB,KAAA,CAClE;;;;;;EAOA,MAAM,uBAAuB,IAAmB,IAAI;EACpD,MAAM,cAAc,eAClB,OAAO,MAAM,OAAO,WAChB,MAAM,KACL,qBAAqB,SAAS,KAAA,CACrC;EACA,MAAM,0BAAgC;GACpC,KACG,OAAO,MAAM,OAAO,YAAY,CAAC,MAAM,OACxC,qBAAqB,UAAU,MAE/B,qBAAqB,QAAQ,MAAM,OAAO;EAE9C;EAEA,MAAM,YAAY,eAA+B,WAAW;EAC5D,MAAM,cAAc,IAEV,IAAI;;EAGd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;KACnC,iBAAe,QAAA,WAAQ,SAAY,KAAA;KACpC,OAAM;KACL,iBAAiB,QAAA,WAAQ,UAAA;KACzB,oBAAkB,QAAA;KAClB,MAAM,QAAA,gBAAa,aAAA;KACpB,YAAW;KACV,QAAM;KACN,SAAO;KACP,kBAAgB;KAChB,oBAAkB;KAClB,SAAO;KACP,SAAO;KACP,WAAS;KACT,SAAO;KACP,eAAa;;IASVC,KAAAA,OAAO,WAAA,UAAA,GADf,mBAIM,OAJN,YAIM,CADJ,WAAuB,KAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,IAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGjBA,KAAAA,OAAO,QAAA,UAAA,GADf,mBAIM,OAJN,YAIM,CADJ,WAAoB,KAAA,QAAA,QAAA,CAAA,GAAA,KAAA,GAAA,IAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGd,QAAA,YAAA,UAAA,GADR,mBAIM,OAJN,YAEqR,YAErR,KAAA,mBAAA,IAAA,IAAA;IAGQ,yBAAA,SAAA,UAAA,GADR,YAUmC,sCAAA;;cAR7B;KAAJ,KAAI;KACH,sBAAsB,6BAAA;KACtB,kBAAkB,iBAAA;KAClB,aAAa,QAAA;KACb,WAAW,UAAA;KACX,OAAO,cAAA;KACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,aAAA,QAAY;KACnB,YAAQ,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,YAAA;MAAA,MAAA;MAAA,MAAA;KAAA,CAAA;KACd,UAAQ"}
1
+ {"version":3,"file":"CodeInputLite.vue.script.js","names":["$attrs","$slots"],"sources":["../../../../src/v2/components/code-input/CodeInputLite.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * CodeInputLite\n *\n * Single-line `contenteditable` editor that renders `{{varname}}` as atomic\n * pill spans (`contenteditable=\"false\"`) and offers an env-variable\n * autocomplete on `{{`. The value is still exposed as a `{{name}}`-bearing\n * string via `update:modelValue`; DOM ↔ model conversion lives in\n * `renderModel` and `serializeEditor`.\n */\nexport default {\n inheritAttrs: false,\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport {\n CONTEXT_FUNCTION_NAMES,\n getContextFunctionComment,\n isContextFunctionName,\n type ContextFunctionName,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { nanoid } from 'nanoid'\nimport {\n computed,\n createApp,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n useTemplateRef,\n watch,\n type App,\n} from 'vue'\n\nimport DataTableInputSelect from '@/v2/components/data-table/DataTableInputSelect.vue'\nimport EnvironmentVariableDropdown from '@/v2/features/environments/components/EnvironmentVariablesDropdown.vue'\nimport { useLocalization } from '@/v2/features/localization'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport type { CodeInputModelValue } from './CodeInput.vue'\nimport { buildPillContext } from './helpers/build-pill-context'\nimport { lookupVariableValue } from './helpers/lookup-variable-value'\nimport { pillSignature } from './helpers/pill-signature'\nimport { serializeValue } from './helpers/serialize-value'\nimport PillTooltipHost from './PillTooltipHost.vue'\n\nconst {\n modelValue,\n environment,\n disabled = false,\n readOnly = false,\n error = false,\n layout = 'desktop',\n placeholder,\n required = false,\n emitOnBlur = true,\n alwaysEmitChange = false,\n withVariables = true,\n withFakeData = false,\n linethrough = false,\n type,\n enum: enumProp,\n examples,\n default: defaultProp,\n nullable = false,\n} = defineProps<Props>()\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string]\n 'submit': [value: string, event: KeyboardEvent | FocusEvent]\n 'blur': [value: string, event: FocusEvent]\n 'navigate': [route: { page: 'document'; path: 'environment' }]\n}>()\n\nconst { translate } = useLocalization()\n\ntype Props = {\n modelValue: CodeInputModelValue\n /** Environment for variable substitution. Pass undefined to disable env vars */\n environment: XScalarEnvironment | undefined\n /** Render as a non-interactive read-only label */\n disabled?: boolean\n /** Render the input with the native `readonly` attribute (still focusable, no edits) */\n readOnly?: boolean\n /** Show error styling */\n error?: boolean\n /** Layout context affects styling and dropdown visibility */\n layout?: ClientLayout\n /** Placeholder text for an empty input */\n placeholder?: string\n /** Show required indicator */\n required?: boolean\n /** Emit submit on blur */\n emitOnBlur?: boolean\n /** Render variable pills + show the autocomplete dropdown */\n withVariables?: boolean\n /** Include `{{$guid}}` etc. in the autocomplete dropdown */\n withFakeData?: boolean\n /** Always emit change events even if the value is unchanged */\n alwaysEmitChange?: boolean\n /** Strike-through styling for the input text (e.g. overridden values) */\n linethrough?: boolean\n /** Schema type — drives boolean select mode when `boolean` is included */\n type?: string | string[]\n /** Predefined enum values; when set the input is replaced by a select */\n enum?: string[]\n /** Example values; when set (and no enum/boolean) the input is replaced by a select */\n examples?: string[]\n /** Default value to suggest in select modes */\n default?: CodeInputModelValue\n /** Whether the boolean select includes a `null` option */\n nullable?: boolean\n}\n\nconst attrs = useAttrs()\nconst ariaLabel = computed(() =>\n typeof attrs['aria-label'] === 'string' ? attrs['aria-label'] : undefined,\n)\n\n/**\n * The id only matters once the dropdown opens (`aria-controls` /\n * `aria-activedescendant`), so we defer `nanoid()` until first focus to\n * keep idle instances cheap. A consumer-supplied `id` attr is preserved.\n */\nconst generatedComponentId = ref<string | null>(null)\nconst componentId = computed((): string | undefined =>\n typeof attrs.id === 'string'\n ? attrs.id\n : (generatedComponentId.value ?? undefined),\n)\nconst ensureComponentId = (): void => {\n if (\n (typeof attrs.id !== 'string' || !attrs.id) &&\n generatedComponentId.value === null\n ) {\n generatedComponentId.value = `id-${nanoid()}`\n }\n}\n\nconst editorRef = useTemplateRef<HTMLDivElement>('editorRef')\nconst dropdownRef = ref<InstanceType<\n typeof EnvironmentVariableDropdown\n> | null>(null)\n\n/** Id of the dropdown's `role=\"listbox\"` element, for the combobox wiring. */\nconst listboxId = computed((): string | undefined =>\n componentId.value ? `${componentId.value}-listbox` : undefined,\n)\n\n/**\n * Id of the option the dropdown currently highlights. Mirrors the dropdown's\n * own selection so the editor can expose it via `aria-activedescendant`.\n */\nconst activeOptionId = computed(\n (): string | undefined => dropdownRef.value?.activeOptionId,\n)\n\nconst isFocused = ref(false)\nconst isEmpty = ref(true)\n\n/**\n * True while an IME composition is in progress. Rebuilding the editor DOM\n * mid-composition (e.g. when `{{` forms a pill) cancels the composition, so we\n * defer those rebuilds until `compositionend`.\n */\nconst isComposing = ref(false)\n\n/**\n * Whether the serialized value should count as empty for placeholder display.\n *\n * `contenteditable` can leave behind invisible residue after some delete\n * sequences — most commonly a non-breaking space (`\\u00a0`) — which makes a\n * visually empty field report a non-zero length and silently drop its\n * placeholder. Trimming covers that case; `\\u00a0` counts as whitespace, so a\n * field that only holds editor residue is treated as empty. This affects the\n * placeholder flag only, never the value emitted via `serializeEditor`.\n */\nconst isBlankValue = (text: string): boolean => text.trim().length === 0\n\n// ───────────────────────────────────────────────────────────────────\n// Rendering-mode detection (parity with CodeInput's select dispatch)\n// ───────────────────────────────────────────────────────────────────\n\n/** True when the schema type is exactly `boolean` (or includes it in a tuple type). */\nconst isBooleanMode = computed((): boolean => {\n if (enumProp?.length) {\n return false\n }\n return type === 'boolean' || (Array.isArray(type) && type.includes('boolean'))\n})\n\nconst booleanOptions = computed((): string[] =>\n nullable ? ['true', 'false', 'null'] : ['true', 'false'],\n)\n\n/** Default type when the schema is a tuple — picks the first non-null entry. */\nconst defaultType = computed((): string | undefined => {\n if (Array.isArray(type)) {\n return type.find((t) => t !== 'null') ?? 'string'\n }\n return type\n})\n\nconst handleSelectChange = (value: string): void =>\n emit('update:modelValue', value)\n\n// ───────────────────────────────────────────────────────────────────\n// Per-pill tooltip apps\n// ───────────────────────────────────────────────────────────────────\n\nlet pillTooltipApps: App[] = []\n\n/**\n * Per-pill tooltips are the heaviest part of the render (a Vue app +\n * `useTooltip` watch + listeners each), so we defer mounting them until\n * the first interaction (focus, pointerover, or dropdown open). Once on,\n * subsequent rebuilds remount tooltips for the new pills.\n */\nlet tooltipsActive = false\n\nconst teardownPillTooltips = (): void => {\n for (const app of pillTooltipApps) {\n app.unmount()\n }\n pillTooltipApps = []\n}\n\nconst mountPillTooltips = (): void => {\n if (!editorRef.value || layout === 'modal') {\n return\n }\n const pills = editorRef.value.querySelectorAll<HTMLElement>('.scalar-pill')\n for (const pillEl of pills) {\n const variableName = pillEl.dataset.variable ?? ''\n const context = buildPillContext(variableName, environment)\n const app = createApp(PillTooltipHost, {\n context,\n target: pillEl,\n translate,\n })\n // PillTooltipHost is renderless; useTooltip attaches to `target` directly.\n app.mount(document.createElement('div'))\n pillTooltipApps.push(app)\n }\n}\n\n// ───────────────────────────────────────────────────────────────────\n// DOM ↔ model conversion\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Build a pill `<span>` for the given variable. `contentEditable = 'false'`\n * makes the browser treat it as a single atom (arrow keys jump over it,\n * Backspace deletes it whole); `{{` / `}}` only live in the model string.\n */\nconst createPillElement = (\n name: string,\n start: number,\n end: number,\n): HTMLSpanElement => {\n const isCtx = isContextFunctionName(name)\n const span = document.createElement('span')\n span.className = isCtx ? 'scalar-pill scalar-pill--context-fn' : 'scalar-pill'\n span.contentEditable = 'false'\n span.dataset.variable = name\n // Model-coordinate offsets (the pill stands in for the full `{{name}}`).\n // Used by click forwarding and tests to map a pill back to the value.\n span.dataset.pillStart = String(start)\n span.dataset.pillEnd = String(end)\n\n const color = isCtx\n ? 'var(--scalar-color-3)'\n : environment?.color || 'var(--scalar-color-1)'\n span.style.setProperty('--tw-bg-base', color)\n\n // Fade env pills with no usable value. A falsy check (not just\n // `=== undefined`) matches the tooltip path's `Boolean(value)`, so a\n // variable declared with an empty string fades here too.\n const isUndefinedEnv = !isCtx && !lookupVariableValue(environment, name)\n if (isUndefinedEnv) {\n span.style.opacity = '0.5'\n }\n\n span.textContent = name\n return span\n}\n\n/** Render a model string into the editor as a mix of text nodes + pills. */\nconst renderModel = (text: string): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n\n teardownPillTooltips()\n editor.replaceChildren()\n\n if (!withVariables || !text.includes('{{')) {\n if (text) {\n editor.appendChild(document.createTextNode(text))\n }\n isEmpty.value = isBlankValue(text)\n return\n }\n\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = match.index\n const end = start + match[0].length\n if (start > lastIndex) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex, start)))\n }\n editor.appendChild(createPillElement(match[1] ?? '', start, end))\n lastIndex = end\n }\n\n if (lastIndex < text.length) {\n editor.appendChild(document.createTextNode(text.slice(lastIndex)))\n }\n\n isEmpty.value = false\n if (tooltipsActive) {\n mountPillTooltips()\n }\n}\n\n/** Length the given child contributes to the serialized model string. */\nconst modelLengthOf = (node: Node): number => {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').length\n }\n if (node instanceof HTMLElement && node.classList.contains('scalar-pill')) {\n return `{{${node.dataset.variable ?? ''}}}`.length\n }\n // Defensive: a stray element (e.g. browser-inserted <br>) — use its text.\n return (node.textContent ?? '').length\n}\n\n/** Read the editor DOM back into a `{{name}}`-bearing model string. */\nconst serializeEditor = (): string => {\n const editor = editorRef.value\n if (!editor) {\n return ''\n }\n let out = ''\n for (const node of Array.from(editor.childNodes)) {\n if (node.nodeType === Node.TEXT_NODE) {\n out += node.textContent ?? ''\n } else if (\n node instanceof HTMLElement &&\n node.classList.contains('scalar-pill')\n ) {\n out += `{{${node.dataset.variable ?? ''}}}`\n } else if (node instanceof HTMLElement) {\n // Flatten any stray <br> / <div> the browser may inject on paste/Enter.\n out += node.textContent ?? ''\n }\n }\n return out\n}\n\nlet lastPillSignature: string | null = null\nlet lastEnvKey = ''\n\n/**\n * Cache key for the env + `withVariables` state. Includes variable\n * name/value pairs so the watcher notices adds/removes/edits even when\n * `environment.color` is unchanged — without that, pills keep stale\n * `isDefined` opacity and tooltip values until the input itself changes.\n */\nconst computeEnvKey = (): string => {\n const color = environment?.color ?? ''\n const flag = withVariables ? '1' : '0'\n const variables = environment?.variables ?? []\n let vars = ''\n for (const v of variables) {\n const value =\n typeof v.value === 'string' ? v.value : (v.value?.default ?? '')\n // Unit separators (\\x1f / \\x1e) so values can safely contain `|` or `=`.\n vars += `\\x1f${v.name}\\x1e${value}`\n }\n return `${color}|${flag}|${vars}`\n}\n\n/** Idempotent: first call flips `tooltipsActive` and mounts pill tooltips. */\nconst ensureTooltipsActive = (): void => {\n if (tooltipsActive) {\n return\n }\n tooltipsActive = true\n mountPillTooltips()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Caret ↔ model offset\n// ───────────────────────────────────────────────────────────────────\n\n/** Selection start as a model-string offset, or `null` if not inside the editor. */\nconst getModelCaret = (): number | null => {\n const editor = editorRef.value\n if (!editor) {\n return null\n }\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0) {\n return null\n }\n const range = selection.getRangeAt(0)\n if (\n range.startContainer !== editor &&\n !editor.contains(range.startContainer)\n ) {\n return null\n }\n\n // Anchored on the editor itself: `startOffset` is a child index.\n if (range.startContainer === editor) {\n let pos = 0\n for (\n let i = 0;\n i < range.startOffset && i < editor.childNodes.length;\n i++\n ) {\n pos += modelLengthOf(editor.childNodes.item(i))\n }\n return pos\n }\n\n let pos = 0\n for (const child of Array.from(editor.childNodes)) {\n if (child === range.startContainer) {\n return pos + range.startOffset\n }\n // Pills are non-editable; if a browser quirk still lands a selection\n // inside one, snap to the nearest boundary instead of getting stuck.\n if (child.contains(range.startContainer)) {\n return range.startOffset === 0 ? pos : pos + modelLengthOf(child)\n }\n pos += modelLengthOf(child)\n }\n return pos\n}\n\n/** Place the caret at the given model offset, walking the DOM to find it. */\nconst setModelCaret = (target: number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const range = document.createRange()\n let pos = 0\n let placed = false\n\n for (const child of Array.from(editor.childNodes)) {\n const len = modelLengthOf(child)\n if (pos + len >= target) {\n if (child.nodeType === Node.TEXT_NODE) {\n const into = Math.max(\n 0,\n Math.min(target - pos, (child.textContent ?? '').length),\n )\n range.setStart(child, into)\n } else if (target - pos <= 0) {\n range.setStartBefore(child)\n } else {\n range.setStartAfter(child)\n }\n placed = true\n break\n }\n pos += len\n }\n\n if (!placed) {\n range.selectNodeContents(editor)\n range.collapse(false)\n } else {\n range.collapse(true)\n }\n\n const selection = window.getSelection()\n if (!selection) {\n return\n }\n selection.removeAllRanges()\n selection.addRange(range)\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Environment variable dropdown\n// ───────────────────────────────────────────────────────────────────\n\nconst showDropdown = ref(false)\nconst dropdownQuery = ref('')\nconst dropdownPosition = ref({ left: 0, top: 0 })\n\nconst contextFunctionDropdownItems = computed(() =>\n withFakeData\n ? CONTEXT_FUNCTION_NAMES.map((key) => ({\n key,\n description: getContextFunctionComment(key as ContextFunctionName),\n }))\n : [],\n)\n\nconst displayVariablesDropdown = computed(\n (): boolean =>\n showDropdown.value &&\n withVariables &&\n layout !== 'modal' &&\n (Boolean(environment) || withFakeData),\n)\n\nconst updateDropdownVisibility = (): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n const caret = getModelCaret()\n if (caret === null) {\n showDropdown.value = false\n return\n }\n const text = serializeEditor().slice(0, caret)\n const lastOpen = text.lastIndexOf('{{')\n const lastClose = text.lastIndexOf('}}')\n\n if (lastOpen <= lastClose) {\n showDropdown.value = false\n return\n }\n\n dropdownQuery.value = text.slice(lastOpen + 2)\n // Make sure the combobox has an id before it advertises `aria-expanded`, so\n // `aria-controls` always resolves to the listbox we are about to render.\n ensureComponentId()\n showDropdown.value = true\n\n // Anchor under the caret; `getBoundingClientRect` gives the caret rect in one read.\n nextTick(() => {\n const selection = window.getSelection()\n if (!selection || selection.rangeCount === 0 || !editorRef.value) {\n return\n }\n const r = selection.getRangeAt(0).cloneRange()\n r.collapse(true)\n const rect = r.getBoundingClientRect()\n const editorRect = editorRef.value.getBoundingClientRect()\n // Some browsers collapse empty ranges to a zero rect — fall back to the editor edge.\n dropdownPosition.value = {\n left: rect.left || editorRect.left,\n top: rect.bottom || editorRect.bottom,\n }\n })\n}\n\nconst handleDropdownSelect = (item: string): void => {\n if (readOnly) {\n return\n }\n const caret = getModelCaret() ?? 0\n const value = serializeEditor()\n const from = Math.max(0, caret - dropdownQuery.value.length - 2)\n const to = caret\n const next = `${value.slice(0, from)}{{${item}}}${value.slice(to)}`\n const nextCursor = from + `{{${item}}}`.length\n\n // Pill set changed — force a re-render and reposition the caret.\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n setModelCaret(nextCursor)\n\n showDropdown.value = false\n emitChange(next, { skipDropdownCheck: true })\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Change / focus / blur\n// ───────────────────────────────────────────────────────────────────\n\nconst emitChange = (\n value: string,\n opts: { skipDropdownCheck?: boolean } = {},\n): void => {\n const same = value === serializeValue(modelValue)\n if (alwaysEmitChange || !same) {\n emit('update:modelValue', value)\n }\n if (!opts.skipDropdownCheck) {\n updateDropdownVisibility()\n }\n}\n\nconst handleInput = (): void => {\n const text = serializeEditor()\n isEmpty.value = isBlankValue(text)\n\n // Only rebuild when the pill set changes (e.g. `}}` closed a pattern, or\n // a value was pasted). Skipping it for plain-text edits preserves the\n // live selection — important for IME composition and double-click select.\n // Also defer while composing; `handleCompositionEnd` re-runs this path so the\n // rebuild happens once the IME has committed its text.\n const sig = pillSignature(text, withVariables)\n if (!isComposing.value && sig !== lastPillSignature) {\n const caret = getModelCaret()\n lastPillSignature = sig\n renderModel(text)\n if (caret !== null) {\n setModelCaret(caret)\n }\n }\n\n emitChange(text)\n}\n\nconst handleCompositionStart = (): void => {\n isComposing.value = true\n}\n\nconst handleCompositionEnd = (): void => {\n isComposing.value = false\n // Run the deferred input path now that the composition has committed, so any\n // pill that formed during composition is rendered.\n handleInput()\n}\n\nconst handleFocus = (): void => {\n isFocused.value = true\n ensureComponentId()\n ensureTooltipsActive()\n}\n\nconst handleBlur = (event: FocusEvent): void => {\n isFocused.value = false\n showDropdown.value = false\n const value = serializeEditor()\n // Check the serialized `value`, not `modelValue` — a `0` or `false` model is\n // a valid non-empty entry that should still submit on blur.\n if (emitOnBlur && value) {\n emit('submit', value, event)\n }\n emit('blur', value, event)\n}\n\n/**\n * Strip rich content on paste; `contenteditable=\"plaintext-only\"` is not\n * reliable cross-browser, so we intercept and use `insertText` to keep undo.\n */\nconst handlePaste = (event: ClipboardEvent): void => {\n event.preventDefault()\n const text = event.clipboardData?.getData('text/plain') ?? ''\n if (!text) {\n return\n }\n document.execCommand('insertText', false, text.replace(/\\r?\\n/g, ' '))\n // `insertText` normally fires an `input` event, but that is not guaranteed\n // across browsers. Run the same path explicitly so pill rendering, emptiness,\n // `update:modelValue`, and the dropdown never lag behind the pasted DOM.\n handleInput()\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Keyboard handling\n// ───────────────────────────────────────────────────────────────────\n\nconst handleKeyDown = (event: KeyboardEvent): void => {\n if (showDropdown.value) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleArrowKey(\n event.key === 'ArrowDown' ? 'down' : 'up',\n )\n return\n }\n if (event.key === 'Enter') {\n event.preventDefault()\n event.stopPropagation()\n dropdownRef.value?.handleSelect()\n return\n }\n if (event.key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n showDropdown.value = false\n return\n }\n }\n\n if (event.key === 'Enter') {\n // Block the browser default so a contenteditable div does not insert\n // <br> / <div> and break single-line semantics, then emit submit\n // (used by the table editors).\n event.preventDefault()\n emit('submit', serializeEditor(), event)\n return\n }\n\n // Backspace / Delete: pill atomicity is handled by the browser via\n // `contenteditable=\"false\"` on pills — no manual `}}`-pair handling needed.\n}\n\n// ───────────────────────────────────────────────────────────────────\n// Click forwarding & lifecycle\n// ───────────────────────────────────────────────────────────────────\n\n/**\n * Clicking a pill selects it whole, so a subsequent Backspace deletes it\n * in one keystroke and typing replaces it — the usual chip/mention model.\n */\nconst handleEditorClick = (event: MouseEvent): void => {\n const target =\n event.target instanceof Element\n ? event.target.closest<HTMLElement>('.scalar-pill')\n : null\n if (!target) {\n return\n }\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n const range = document.createRange()\n range.selectNode(target)\n const selection = window.getSelection()\n selection?.removeAllRanges()\n selection?.addRange(range)\n updateDropdownVisibility()\n}\n\nonMounted(() => {\n const initial = serializeValue(modelValue)\n lastPillSignature = pillSignature(initial, withVariables)\n lastEnvKey = computeEnvKey()\n renderModel(initial)\n isEmpty.value = isBlankValue(initial)\n\n // `autofocus` on a contenteditable div is not honoured natively, so focus\n // the editor ourselves when the consumer passes the attribute.\n if (Object.hasOwn(attrs, 'autofocus')) {\n editorRef.value?.focus()\n }\n})\n\nwatch(\n () => modelValue,\n (next) => {\n const serialized = serializeValue(next)\n // Always sync the placeholder flag, even when the DOM already matches and we\n // skip the rebuild below. Otherwise a value cell that switches from select\n // mode (no editor element) into the empty editor keeps a stale `isEmpty`,\n // and the placeholder silently disappears.\n isEmpty.value = isBlankValue(serialized)\n if (serializeEditor() === serialized) {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n)\n\n// The editable surface only exists in \"editor mode\" (see template). When a row switches into editor\n// mode after mount — most notably when this component instance is reused for a different table row —\n// `onMounted` has already run and the `modelValue` watch fired while `editorRef` was still null, so\n// the model was never painted into the freshly created element and the cell renders empty.\n//\n// Paint the model when the element appears, but only into a still-empty editor: an editor that\n// already holds text is either up to date or ahead of `modelValue` with an uncommitted edit/paste,\n// and must not be clobbered.\n//\n// `flush: 'sync'` makes the paint part of the same step that creates the element. Vue assigns a\n// non-null template ref from a post-render effect, so the element is already mounted and patched\n// when this runs — deferring any further (the `pre` default, or `post`) only pushes the paint past\n// the consumer effects that run later in the same flush. A parent that focuses the cell as it\n// switches into editor mode would then place the caret in a still-empty editor, and the paint's\n// `replaceChildren` would drop that selection.\nwatch(\n editorRef,\n (editor) => {\n if (!editor || !isBlankValue(serializeEditor())) {\n return\n }\n const serialized = serializeValue(modelValue)\n if (serialized === '') {\n return\n }\n lastPillSignature = pillSignature(serialized, withVariables)\n renderModel(serialized)\n },\n { flush: 'sync' },\n)\n\nwatch(\n [() => environment, () => withVariables],\n () => {\n // Env changes affect pill colour and `isDefined` opacity — rebuild.\n const envKey = computeEnvKey()\n if (envKey === lastEnvKey) {\n return\n }\n lastEnvKey = envKey\n // Most rows are plain text; skip the DOM walk when there are no pills.\n // Pills introduced later flow through `handleInput` / the modelValue\n // watcher, which update `lastPillSignature`.\n if (lastPillSignature === '') {\n return\n }\n lastPillSignature = pillSignature(serializeEditor(), withVariables)\n // Preserve the caret across the rebuild so editing does not jump to the\n // start when the environment changes mid-edit (mirrors `handleInput`).\n const caret = getModelCaret()\n renderModel(serializeEditor())\n if (caret !== null) {\n setModelCaret(caret)\n }\n },\n // Variables are often mutated in place (e.g. editing a value in the env\n // editor) without the object reference changing — deep watch catches it.\n { deep: true },\n)\n\nonBeforeUnmount(() => {\n teardownPillTooltips()\n})\n\n// ───────────────────────────────────────────────────────────────────\n// Public API\n// ───────────────────────────────────────────────────────────────────\n\ndefineExpose({\n /** Focus the editor. `position` controls caret placement. */\n focus: (position?: 'start' | 'end' | number): void => {\n const editor = editorRef.value\n if (!editor) {\n return\n }\n editor.focus()\n if (!isDefined(position)) {\n return\n }\n const length = serializeEditor().length\n const pos =\n position === 'start' ? 0 : position === 'end' ? length : position\n setModelCaret(pos)\n },\n /** Replace the current value programmatically and re-render the pills. */\n setContent: (next = ''): void => {\n if (serializeEditor() === next) {\n return\n }\n lastPillSignature = pillSignature(next, withVariables)\n renderModel(next)\n isEmpty.value = isBlankValue(next)\n },\n /** Read the current value as a `{{name}}`-bearing string. */\n getValue: (): string => serializeEditor(),\n /** Caret offset in the model string. */\n cursorPosition: (): number | undefined => {\n const c = getModelCaret()\n return c === null ? undefined : c\n },\n isFocused,\n editorRef,\n})\n</script>\n\n<template>\n <!-- Disabled mode: read-only label -->\n <div\n v-if=\"disabled\"\n class=\"text-c-2 flex cursor-default items-center justify-center\"\n :class=\"{\n 'font-code pr-2 pl-1 text-base': layout === 'modal',\n 'px-2': layout !== 'modal',\n 'line-through': linethrough,\n }\"\n data-testid=\"code-input-lite-disabled\">\n <span class=\"whitespace-nowrap\">{{ modelValue }}</span>\n </div>\n\n <!-- Enum mode: select dropdown with predefined values -->\n <DataTableInputSelect\n v-else-if=\"enumProp?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :type=\"defaultType\"\n :value=\"enumProp\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Boolean mode: select dropdown with true/false (and optionally null) -->\n <DataTableInputSelect\n v-else-if=\"isBooleanMode\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"booleanOptions\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Examples mode: select dropdown with example values -->\n <DataTableInputSelect\n v-else-if=\"examples?.length\"\n :default=\"defaultProp\"\n :modelValue=\"modelValue\"\n :value=\"examples\"\n @update:modelValue=\"handleSelectChange\" />\n\n <!-- Editor mode -->\n <div\n v-else\n :id=\"componentId\"\n v-bind=\"$attrs\"\n class=\"code-input-lite group/code-input-lite peer relative w-full leading-[1.44] -outline-offset-1 has-[:focus-visible]:rounded-[4px] has-[:focus-visible]:outline\"\n :class=\"{\n 'code-input-lite--error': error,\n 'code-input-lite--empty': isEmpty,\n 'line-through': linethrough,\n }\">\n <!-- The single editable surface; see the file header for how pills work. -->\n <div\n ref=\"editorRef\"\n :aria-activedescendant=\"\n displayVariablesDropdown ? activeOptionId : undefined\n \"\n :aria-autocomplete=\"withVariables ? 'list' : undefined\"\n :aria-controls=\"displayVariablesDropdown ? listboxId : undefined\"\n :aria-expanded=\"displayVariablesDropdown ? 'true' : undefined\"\n :aria-invalid=\"error ? 'true' : undefined\"\n :aria-label=\"ariaLabel\"\n :aria-readonly=\"readOnly ? 'true' : undefined\"\n :aria-required=\"required ? 'true' : undefined\"\n class=\"code-input-lite__editor\"\n :contenteditable=\"readOnly ? 'false' : 'true'\"\n :data-placeholder=\"placeholder\"\n :role=\"withVariables ? 'combobox' : 'textbox'\"\n spellcheck=\"false\"\n @blur=\"handleBlur\"\n @click=\"handleEditorClick\"\n @compositionend=\"handleCompositionEnd\"\n @compositionstart=\"handleCompositionStart\"\n @focus=\"handleFocus\"\n @input=\"handleInput\"\n @keydown=\"handleKeyDown\"\n @paste=\"handlePaste\"\n @pointerover=\"ensureTooltipsActive\" />\n </div>\n\n <!--\n Slots and the required indicator are siblings of the mode templates so\n they render in every mode and so `absolute right-0` anchors to the\n surrounding (relative) cell rather than the shrink-wrapped mode wrapper.\n -->\n <div\n v-if=\"$slots.warning\"\n class=\"centered-y text-orange absolute right-7 text-xs\">\n <slot name=\"warning\" />\n </div>\n <div\n v-if=\"$slots.icon\"\n class=\"centered-y absolute right-0 flex h-full items-center p-1.5 group-has-[.code-input-lite__editor:focus]:z-1\">\n <slot name=\"icon\" />\n </div>\n <div\n v-if=\"required\"\n class=\"required centered-y text-xxs text-c-3 group-[.error]:text-red bg-b-1 pointer-events-none absolute right-0 mr-0.5 pt-px pr-2 opacity-100 shadow-[-8px_0_4px_var(--scalar-background-1)] transition-opacity duration-150 peer-has-[.code-input-lite__editor:focus]:opacity-0\">\n {{ translate('apiClient.codeInputLite.required') }}\n </div>\n\n <EnvironmentVariableDropdown\n v-if=\"displayVariablesDropdown\"\n ref=\"dropdownRef\"\n :contextFunctionItems=\"contextFunctionDropdownItems\"\n :dropdownPosition=\"dropdownPosition\"\n :environment=\"environment\"\n :listboxId=\"listboxId\"\n :query=\"dropdownQuery\"\n @close=\"showDropdown = false\"\n @redirect=\"emit('navigate', { page: 'document', path: 'environment' })\"\n @select=\"handleDropdownSelect\" />\n</template>\n\n<style scoped>\n.code-input-lite {\n /* Flex so the editor centres vertically in whatever height the cell gives us.\n Font properties inherit so we adopt the surrounding typography. */\n display: flex;\n align-items: center;\n}\n\n.code-input-lite__editor {\n /* Everything font-related inherits from the surrounding context. */\n font: inherit;\n letter-spacing: inherit;\n flex: 1;\n min-width: 0;\n background: transparent;\n outline: none;\n color: var(--scalar-color-1);\n caret-color: var(--scalar-color-1);\n /* Single-line: horizontal scroll keeps the caret visible for long values;\n the scrollbar itself is hidden (would be noisy inside a table cell). */\n white-space: pre;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none;\n padding: 0 0.5em;\n box-sizing: border-box;\n line-height: 1.44;\n /* Positioning context for the absolutely positioned placeholder. */\n position: relative;\n}\n\n.code-input-lite__editor::-webkit-scrollbar {\n display: none;\n}\n\n/* Absolute so the placeholder does not occupy flow space inside the\n contenteditable; otherwise the caret would land after it on focus.\n `pointer-events: none` lets clicks fall through to focus the editor.\n Hidden on focus so it never renders on top of the text caret. */\n.code-input-lite--empty .code-input-lite__editor:not(:focus)::before {\n content: attr(data-placeholder);\n color: var(--scalar-color-3);\n pointer-events: none;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0.5em;\n display: flex;\n align-items: center;\n}\n\n.code-input-lite--error .code-input-lite__editor {\n outline: 1px solid var(--scalar-color-red);\n}\n</style>\n\n<style>\n/* Pill styling. Each pill is `<span contenteditable=\"false\">name</span>` —\n an atomic widget; the caret lands before or after it, never inside. */\n.scalar-pill {\n color: var(--scalar-color-2);\n border-radius: var(--scalar-radius-full);\n display: inline-block;\n font-family: var(--scalar-font-code);\n font-size: 0.9em;\n line-height: 1.4;\n vertical-align: baseline;\n background: var(--scalar-background-3);\n padding: 0.125em 0.6em;\n margin-right: 0.35em;\n cursor: text;\n /* Single click selects the whole pill — chip/mention model, deletes in one go. */\n user-select: all;\n -webkit-user-select: all;\n}\n\n.dark-mode .scalar-pill {\n background: color-mix(\n in srgb,\n var(--tw-bg-base, var(--scalar-color-1)),\n transparent 90%\n );\n}\n\n.light-mode .scalar-pill {\n background: var(--scalar-background-3);\n}\n\n.scalar-pill--context-fn {\n /* Inset box-shadow as a border so the layout box stays identical to plain pills. */\n box-shadow: 0 0 0 1px\n color-mix(in srgb, var(--scalar-color-3), transparent 35%) inset;\n}\n\n.dark-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 55%);\n}\n\n.light-mode .scalar-pill--context-fn {\n background: color-mix(in srgb, var(--scalar-background-3), transparent 40%);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWE,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DhB,MAAM,OAAO;EAOb,MAAM,EAAE,cAAc,gBAAgB;EAwCtC,MAAM,QAAQ,SAAS;EACvB,MAAM,YAAY,eAChB,OAAO,MAAM,kBAAkB,WAAW,MAAM,gBAAgB,KAAA,CAClE;;;;;;EAOA,MAAM,uBAAuB,IAAmB,IAAI;EACpD,MAAM,cAAc,eAClB,OAAO,MAAM,OAAO,WAChB,MAAM,KACL,qBAAqB,SAAS,KAAA,CACrC;EACA,MAAM,0BAAgC;GACpC,KACG,OAAO,MAAM,OAAO,YAAY,CAAC,MAAM,OACxC,qBAAqB,UAAU,MAE/B,qBAAqB,QAAQ,MAAM,OAAO;EAE9C;EAEA,MAAM,YAAY,eAA+B,WAAW;EAC5D,MAAM,cAAc,IAEV,IAAI;;EAGd,MAAM,YAAY,eAChB,YAAY,QAAQ,GAAG,YAAY,MAAM,YAAY,KAAA,CACvD;;;;;EAMA,MAAM,iBAAiB,eACK,YAAY,OAAO,cAC/C;EAEA,MAAM,YAAY,IAAI,KAAK;EAC3B,MAAM,UAAU,IAAI,IAAI;;;;;;EAOxB,MAAM,cAAc,IAAI,KAAK;;;;;;;;;;;EAY7B,MAAM,gBAAgB,SAA0B,KAAK,KAAK,CAAC,CAAC,WAAW;;EAOvE,MAAM,gBAAgB,eAAwB;GAC5C,IAAI,Q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QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,IAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGjBA,KAAAA,OAAO,QAAA,UAAA,GADf,mBAIM,OAJN,YAIM,CADJ,WAAoB,KAAA,QAAA,QAAA,CAAA,GAAA,KAAA,GAAA,IAAA,CAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAGd,QAAA,YAAA,UAAA,GADR,mBAIM,OAJN,YAIM,gBADD,MAAA,SAAA,CAAS,CAAA,kCAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;IAIN,yBAAA,SAAA,UAAA,GADR,YAUmC,sCAAA;;cAR7B;KAAJ,KAAI;KACH,sBAAsB,6BAAA;KACtB,kBAAkB,iBAAA;KAClB,aAAa,QAAA;KACb,WAAW,UAAA;KACX,OAAO,cAAA;KACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,aAAA,QAAY;KACnB,YAAQ,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,YAAA;MAAA,MAAA;MAAA,MAAA;KAAA,CAAA;KACd,UAAQ"}
@@ -1,9 +1,13 @@
1
+ import type { TranslateFn } from '@scalar/localization';
2
+ import { type ApiClientTranslationKey } from '../../../v2/features/localization/index.js';
1
3
  import type { PillContext } from './pill-context';
2
4
  type __VLS_Props = {
3
5
  /** Tooltip data — environment value or context-function description */
4
6
  context: PillContext;
5
7
  /** The pill element to attach the tooltip to */
6
8
  target: HTMLElement;
9
+ /** Carry the owning editor's locale into this separately mounted Vue app. */
10
+ translate?: TranslateFn<ApiClientTranslationKey>;
7
11
  };
8
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
13
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"PillTooltipHost.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"names":[],"mappings":"AA4FA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,KAAK,WAAW,GAAG;IACjB,uEAAuE;IACvE,OAAO,EAAE,WAAW,CAAA;IACpB,gDAAgD;IAChD,MAAM,EAAE,WAAW,CAAA;CACpB,CAAC;AA2DF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"PillTooltipHost.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"names":[],"mappings":"AA2GA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAA;AAEnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,KAAK,WAAW,GAAG;IACjB,uEAAuE;IACvE,OAAO,EAAE,WAAW,CAAA;IACpB,gDAAgD;IAChD,MAAM,EAAE,WAAW,CAAA;IACnB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAA;CACjD,CAAC;AAmEF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"PillTooltipHost.vue.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport { computed, h, ref, render } from 'vue'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n}>()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n 'Computed at request execution',\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() =>\n props.context.type === 'environment' ? props.context.value : '',\n)\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"PillTooltipHost.vue.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport type { TranslateFn } from '@scalar/localization'\nimport { computed, h, ref, render } from 'vue'\n\nimport {\n useLocalization,\n type ApiClientTranslationKey,\n} from '@/v2/features/localization'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n /** Carry the owning editor's locale into this separately mounted Vue app. */\n translate?: TranslateFn<ApiClientTranslationKey>\n}>()\n\nconst { translate: fallbackTranslate } = useLocalization()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst translate = props.translate ?? fallbackTranslate\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n translate('apiClient.pillTooltipHost.computedAtExecution'),\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() =>\n props.context.type === 'environment'\n ? props.context.isDefined\n ? props.context.value\n : translate('apiClient.pillTooltipHost.noValue')\n : '',\n)\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<!-- eslint-disable vue/valid-template-root -- Renderless: the tooltip attaches to the supplied target. -->\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import { useLocalization } from "../../features/localization/index.js";
1
2
  import { computed, defineComponent, h, ref, render } from "vue";
2
3
  import { useTooltip } from "@scalar/components/tooltip";
3
4
  //#region src/v2/components/code-input/PillTooltipHost.vue?vue&type=script&setup=true&lang.ts
@@ -6,7 +7,8 @@ var PillTooltipHost_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
6
7
  __name: "PillTooltipHost",
7
8
  props: {
8
9
  context: {},
9
- target: {}
10
+ target: {},
11
+ translate: { type: Function }
10
12
  },
11
13
  setup(__props) {
12
14
  /**
@@ -23,15 +25,17 @@ var PillTooltipHost_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
23
25
  * listeners onto it directly.
24
26
  */
25
27
  const props = __props;
28
+ const { translate: fallbackTranslate } = useLocalization();
29
+ const translate = props.translate ?? fallbackTranslate;
26
30
  const isContextFn = props.context.type === "contextFunction";
27
31
  /** Two-line HTML body for context-function tooltips. */
28
32
  const contextTooltipHtml = computed(() => {
29
33
  if (!isContextFn || typeof document === "undefined" || props.context.type !== "contextFunction") return "";
30
34
  const el = document.createElement("div");
31
- render(h("div", { class: "flex flex-col gap-1.5 text-left" }, [h("span", {}, props.context.details), h("div", { class: "text-[color:var(--scalar-color-3)] text-[10px] font-normal" }, "Computed at request execution")]), el);
35
+ render(h("div", { class: "flex flex-col gap-1.5 text-left" }, [h("span", {}, props.context.details), h("div", { class: "text-[color:var(--scalar-color-3)] text-[10px] font-normal" }, translate("apiClient.pillTooltipHost.computedAtExecution"))]), el);
32
36
  return el.innerHTML;
33
37
  });
34
- const environmentTooltipText = computed(() => props.context.type === "environment" ? props.context.value : "");
38
+ const environmentTooltipText = computed(() => props.context.type === "environment" ? props.context.isDefined ? props.context.value : translate("apiClient.pillTooltipHost.noValue") : "");
35
39
  const targetRef = ref(props.target);
36
40
  useTooltip({
37
41
  content: isContextFn ? contextTooltipHtml : environmentTooltipText,
@@ -1 +1 @@
1
- {"version":3,"file":"PillTooltipHost.vue.script.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport { computed, h, ref, render } from 'vue'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n}>()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n 'Computed at request execution',\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() =>\n props.context.type === 'environment' ? props.context.value : '',\n)\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAmBA,MAAM,QAAQ;EASd,MAAM,cAAc,MAAM,QAAQ,SAAS;;EAG3C,MAAM,qBAAqB,eAAe;GACxC,IACE,CAAC,eACD,OAAO,aAAa,eACpB,MAAM,QAAQ,SAAS,mBAEvB,OAAO;GAET,MAAM,KAAK,SAAS,cAAc,KAAK;GACvC,OACE,EAAE,OAAO,EAAE,OAAO,kCAAkC,GAAG,CACrD,EAAE,QAAQ,CAAC,GAAG,MAAM,QAAQ,OAAO,GACnC,EACE,OACA,EAAE,OAAO,6DAA6D,GACtE,+BACF,CACF,CAAC,GACD,EACF;GACA,OAAO,GAAG;EACZ,CAAC;EAED,MAAM,yBAAyB,eAC7B,MAAM,QAAQ,SAAS,gBAAgB,MAAM,QAAQ,QAAQ,EAC/D;EAEA,MAAM,YAAY,IAAiB,MAAM,MAAM;EAE/C,WAAW;GACT,SAAS,cAAc,qBAAqB;GAC5C,eAAe,cAAc,cAAc;GAC3C,OAAO;GACP,WAAW;GACX,QAAQ;GACR;EACF,CAAC"}
1
+ {"version":3,"file":"PillTooltipHost.vue.script.js","names":[],"sources":["../../../../src/v2/components/code-input/PillTooltipHost.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * PillTooltipHost\n *\n * Renderless adapter that attaches a tooltip to an existing DOM element.\n * Both the legacy CodeMirror widget pipeline and the new `CodeInputLite`\n * overlay mount one of these per pill via `createApp` — they keep ownership\n * of the pill DOM (text, classes, styles) and we only attach hover/focus\n * behaviour through `useTooltip`.\n *\n * The component renders nothing of its own; pass the pill element via the\n * `target` prop and `useTooltip` will wire mouseenter/mouseleave/focus/blur\n * listeners onto it directly.\n */\nimport { useTooltip } from '@scalar/components/tooltip'\nimport type { TranslateFn } from '@scalar/localization'\nimport { computed, h, ref, render } from 'vue'\n\nimport {\n useLocalization,\n type ApiClientTranslationKey,\n} from '@/v2/features/localization'\n\nimport type { PillContext } from './pill-context'\n\nconst props = defineProps<{\n /** Tooltip data — environment value or context-function description */\n context: PillContext\n /** The pill element to attach the tooltip to */\n target: HTMLElement\n /** Carry the owning editor's locale into this separately mounted Vue app. */\n translate?: TranslateFn<ApiClientTranslationKey>\n}>()\n\nconst { translate: fallbackTranslate } = useLocalization()\n\ndefineOptions({ name: 'PillTooltipHost' })\n\nconst translate = props.translate ?? fallbackTranslate\n\nconst isContextFn = props.context.type === 'contextFunction'\n\n/** Two-line HTML body for context-function tooltips. */\nconst contextTooltipHtml = computed(() => {\n if (\n !isContextFn ||\n typeof document === 'undefined' ||\n props.context.type !== 'contextFunction'\n ) {\n return ''\n }\n const el = document.createElement('div')\n render(\n h('div', { class: 'flex flex-col gap-1.5 text-left' }, [\n h('span', {}, props.context.details),\n h(\n 'div',\n { class: 'text-[color:var(--scalar-color-3)] text-[10px] font-normal' },\n translate('apiClient.pillTooltipHost.computedAtExecution'),\n ),\n ]),\n el,\n )\n return el.innerHTML\n})\n\nconst environmentTooltipText = computed(() =>\n props.context.type === 'environment'\n ? props.context.isDefined\n ? props.context.value\n : translate('apiClient.pillTooltipHost.noValue')\n : '',\n)\n\nconst targetRef = ref<HTMLElement>(props.target)\n\nuseTooltip({\n content: isContextFn ? contextTooltipHtml : environmentTooltipText,\n contentTarget: isContextFn ? 'innerHTML' : 'textContent',\n delay: 0,\n placement: 'bottom-start',\n offset: 6,\n targetRef,\n})\n</script>\n\n<!-- eslint-disable vue/valid-template-root -- Renderless: the tooltip attaches to the supplied target. -->\n<template>\n <!-- Renderless: behaviour attaches to props.target via useTooltip -->\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAyBA,MAAM,QAAQ;EASd,MAAM,EAAE,WAAW,sBAAsB,gBAAgB;EAIzD,MAAM,YAAY,MAAM,aAAa;EAErC,MAAM,cAAc,MAAM,QAAQ,SAAS;;EAG3C,MAAM,qBAAqB,eAAe;GACxC,IACE,CAAC,eACD,OAAO,aAAa,eACpB,MAAM,QAAQ,SAAS,mBAEvB,OAAO;GAET,MAAM,KAAK,SAAS,cAAc,KAAK;GACvC,OACE,EAAE,OAAO,EAAE,OAAO,kCAAkC,GAAG,CACrD,EAAE,QAAQ,CAAC,GAAG,MAAM,QAAQ,OAAO,GACnC,EACE,OACA,EAAE,OAAO,6DAA6D,GACtE,UAAU,+CAA+C,CAC3D,CACF,CAAC,GACD,EACF;GACA,OAAO,GAAG;EACZ,CAAC;EAED,MAAM,yBAAyB,eAC7B,MAAM,QAAQ,SAAS,gBACnB,MAAM,QAAQ,YACZ,MAAM,QAAQ,QACd,UAAU,mCAAmC,IAC/C,EACN;EAEA,MAAM,YAAY,IAAiB,MAAM,MAAM;EAE/C,WAAW;GACT,SAAS,cAAc,qBAAqB;GAC5C,eAAe,cAAc,cAAc;GAC3C,OAAO;GACP,WAAW;GACX,QAAQ;GACR;EACF,CAAC"}
@@ -1,5 +1,7 @@
1
+ import type { TranslateFn } from '@scalar/localization';
1
2
  import { type DecorationSet, EditorView, ViewPlugin, type ViewUpdate } from '@scalar/use-codemirror';
2
3
  import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
4
+ import type { ApiClientTranslationKey } from '../../../v2/features/localization/index.js';
3
5
  /**
4
6
  * Styles the active environment variable pill.
5
7
  * This plugin creates decorations for environment variables in the editor.
@@ -8,6 +10,7 @@ export declare const pillPlugin: (props: {
8
10
  environment: XScalarEnvironment | undefined;
9
11
  isReadOnly: boolean | undefined;
10
12
  isContextFunctionName?: (name: string) => boolean;
13
+ translate?: TranslateFn<ApiClientTranslationKey>;
11
14
  }) => ViewPlugin<{
12
15
  decorations: DecorationSet;
13
16
  lastEnvironment: XScalarEnvironment | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"code-variable-widget.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/code-variable-widget.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,aAAa,EAClB,UAAU,EAEV,UAAU,EACV,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAuGnH;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO;IAChC,WAAW,EAAE,kBAAkB,GAAG,SAAS,CAAA;IAC3C,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CAClD;iBAGkB,aAAa;qBACT,kBAAkB,GAAG,SAAS;mBAOhC,UAAU,GAAG,IAAI;2BAcT,UAAU,GAAG,aAAa;EAyCpD,CAAA;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,uCAoC3B,CAAA"}
1
+ {"version":3,"file":"code-variable-widget.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/code-variable-widget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAEL,KAAK,aAAa,EAClB,UAAU,EAEV,UAAU,EACV,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAwGzE;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO;IAChC,WAAW,EAAE,kBAAkB,GAAG,SAAS,CAAA;IAC3C,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACjD,SAAS,CAAC,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAA;CACjD;iBAGkB,aAAa;qBACT,kBAAkB,GAAG,SAAS;mBAOhC,UAAU,GAAG,IAAI;2BAcT,UAAU,GAAG,aAAa;EAyCpD,CAAA;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,uCAoC3B,CAAA"}
@@ -10,12 +10,14 @@ import { REGEX } from "@scalar/helpers/regex/regex-helpers";
10
10
  */
11
11
  var PillWidget = class PillWidget extends WidgetType {
12
12
  variableName;
13
+ translate;
13
14
  app;
14
15
  pillColor;
15
16
  variableInfo;
16
- constructor(variableName, environment, variant) {
17
+ constructor(variableName, environment, variant, translate) {
17
18
  super();
18
19
  this.variableName = variableName;
20
+ this.translate = translate;
19
21
  if (variant === "contextFunction") {
20
22
  this.pillColor = "var(--scalar-color-3)";
21
23
  this.variableInfo = {
@@ -43,7 +45,8 @@ var PillWidget = class PillWidget extends WidgetType {
43
45
  if (this.variableInfo.type === "environment") span.style.opacity = this.variableInfo.isDefined ? "1" : "0.5";
44
46
  this.app = createApp(PillTooltipHost_default, {
45
47
  context: this.variableInfo,
46
- target: span
48
+ target: span,
49
+ translate: this.translate
47
50
  });
48
51
  this.app.mount(document.createElement("div"));
49
52
  return span;
@@ -101,7 +104,7 @@ var pillPlugin = (props) => ViewPlugin.fromClass(class {
101
104
  if (view.state.doc.sliceString(start, end).includes("\n")) continue;
102
105
  const variant = isContextFn(variableName) ? "contextFunction" : "environment";
103
106
  builder.add(start, end, Decoration.widget({
104
- widget: new PillWidget(variableName, props.environment, variant),
107
+ widget: new PillWidget(variableName, props.environment, variant, props.translate),
105
108
  side: 1
106
109
  }));
107
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"code-variable-widget.js","names":[],"sources":["../../../../src/v2/components/code-input/code-variable-widget.ts"],"sourcesContent":["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport {\n Decoration,\n type DecorationSet,\n EditorView,\n RangeSetBuilder,\n ViewPlugin,\n type ViewUpdate,\n WidgetType,\n} from '@scalar/use-codemirror'\nimport { type ContextFunctionName, getContextFunctionComment } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { createApp } from 'vue'\n\nimport PillTooltipHost from './PillTooltipHost.vue'\nimport type { PillContext } from './pill-context'\n\n/**\n * Displays `{{name}}` as a pill: environment variables show the resolved value;\n * context functions (e.g. `{{$guid}}`) show that the value is generated at send time.\n */\nclass PillWidget extends WidgetType {\n private app: any\n private readonly pillColor: string\n private readonly variableInfo: PillContext\n\n constructor(\n private readonly variableName: string,\n environment: XScalarEnvironment | undefined,\n variant: PillContext['type'],\n ) {\n super()\n if (variant === 'contextFunction') {\n this.pillColor = 'var(--scalar-color-3)'\n this.variableInfo = {\n type: 'contextFunction',\n identifier: variableName,\n details: getContextFunctionComment(variableName as ContextFunctionName),\n }\n return\n }\n\n this.pillColor = environment?.color || 'var(--scalar-color-1)'\n\n const variable = environment?.variables?.find((v) => v.name === variableName)\n const value = variable ? (typeof variable.value === 'string' ? variable.value : variable.value?.default) : undefined\n this.variableInfo = {\n type: 'environment',\n name: variableName,\n value: value || 'No value',\n isDefined: Boolean(value),\n }\n }\n\n toDOM(): HTMLElement {\n const span = document.createElement('span')\n span.className = this.variableInfo.type === 'contextFunction' ? 'cm-pill cm-pill--context-fn' : 'cm-pill'\n span.textContent = this.variableName\n\n span.style.setProperty('--tw-bg-base', this.pillColor)\n\n if (this.variableInfo.type === 'environment') {\n span.style.opacity = this.variableInfo.isDefined ? '1' : '0.5'\n }\n\n // PillTooltipHost is renderless and attaches `useTooltip` listeners to\n // `target` directly — mount onto a throwaway container so the pill DOM\n // we just built is preserved.\n this.app = createApp(PillTooltipHost, {\n context: this.variableInfo,\n target: span,\n })\n this.app.mount(document.createElement('div'))\n\n return span\n }\n\n override destroy(): void {\n if (this.app) {\n this.app.unmount()\n this.app = null\n }\n }\n\n override eq(other: WidgetType): boolean {\n if (!(other instanceof PillWidget)) {\n return false\n }\n if (\n other.variableName !== this.variableName ||\n other.pillColor !== this.pillColor ||\n other.variableInfo.type !== this.variableInfo.type\n ) {\n return false\n }\n const a = other.variableInfo\n const b = this.variableInfo\n if (a.type !== b.type) {\n return false\n }\n if (a.type === 'environment' && b.type === 'environment') {\n return a.name === b.name && a.value === b.value && a.isDefined === b.isDefined\n }\n if (a.type === 'contextFunction' && b.type === 'contextFunction') {\n return a.identifier === b.identifier && a.details === b.details\n }\n return false\n }\n\n override ignoreEvent(): boolean {\n return false\n }\n}\n\n/**\n * Styles the active environment variable pill.\n * This plugin creates decorations for environment variables in the editor.\n */\nexport const pillPlugin = (props: {\n environment: XScalarEnvironment | undefined\n isReadOnly: boolean | undefined\n isContextFunctionName?: (name: string) => boolean\n}) =>\n ViewPlugin.fromClass(\n class {\n decorations: DecorationSet\n lastEnvironment: XScalarEnvironment | undefined\n\n constructor(view: EditorView) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(view)\n }\n\n update(update: ViewUpdate): void {\n // Rebuild decorations if environment changed\n if (props.environment !== this.lastEnvironment) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(update.view)\n return\n }\n\n // Only rebuild decorations if document or viewport changed\n if (update.docChanged || update.viewportChanged) {\n this.decorations = this.buildDecorations(update.view)\n }\n }\n\n buildDecorations(view: EditorView): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>()\n const isContextFn = props.isContextFunctionName ?? (() => false)\n\n for (const { from, to } of view.visibleRanges) {\n const text = view.state.doc.sliceString(from, to)\n\n // Create a new regex instance to ensure lastIndex is reset\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = from + match.index\n const end = start + match[0].length\n const variableName = match[1] ?? ''\n\n // Skip decorations that span line breaks as CodeMirror does not allow them\n const matchedText = view.state.doc.sliceString(start, end)\n if (matchedText.includes('\\n')) {\n continue\n }\n\n const variant: PillContext['type'] = isContextFn(variableName) ? 'contextFunction' : 'environment'\n\n builder.add(\n start,\n end,\n Decoration.widget({\n widget: new PillWidget(variableName, props.environment, variant),\n side: 1,\n }),\n )\n }\n }\n\n return builder.finish()\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n )\n\n/**\n * Custom backspace handler for the editor.\n * Handles special cases like removing entire variable syntax and clearing all content.\n */\nexport const backspaceCommand = EditorView.domEventHandlers({\n keydown(event, view): boolean {\n if (event.key !== 'Backspace') {\n return false\n }\n\n const { state } = view\n const { from, to } = state.selection.main\n\n // When selecting all content and pressing backspace,\n // prevent breaking line content addition on pill removal\n if (from === 0 && to === state.doc.length) {\n view.dispatch({\n changes: { from: 0, to: state.doc.length },\n selection: { anchor: 0 },\n })\n event.preventDefault()\n return true\n }\n\n // When cursor is after a variable closing bracket (}}),\n // remove the entire closing syntax at once\n if (from === to && from >= 2) {\n const before = state.doc.sliceString(from - 2, from)\n if (before === '}}') {\n view.dispatch({\n changes: { from: from - 2, to: from },\n selection: { anchor: from - 2 },\n })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n})\n"],"mappings":";;;;;;;;;;AAqBA,IAAM,aAAN,MAAM,mBAAmB,WAAW;CAMf;CALnB;CACA;CACA;CAEA,YACE,cACA,aACA,SACA;EACA,MAAM;EAJW,KAAA,eAAA;EAKjB,IAAI,YAAY,mBAAmB;GACjC,KAAK,YAAY;GACjB,KAAK,eAAe;IAClB,MAAM;IACN,YAAY;IACZ,SAAS,0BAA0B,YAAmC;GACxE;GACA;EACF;EAEA,KAAK,YAAY,aAAa,SAAS;EAEvC,MAAM,WAAW,aAAa,WAAW,MAAM,MAAM,EAAE,SAAS,YAAY;EAC5E,MAAM,QAAQ,WAAY,OAAO,SAAS,UAAU,WAAW,SAAS,QAAQ,SAAS,OAAO,UAAW,KAAA;EAC3G,KAAK,eAAe;GAClB,MAAM;GACN,MAAM;GACN,OAAO,SAAS;GAChB,WAAW,QAAQ,KAAK;EAC1B;CACF;CAEA,QAAqB;EACnB,MAAM,OAAO,SAAS,cAAc,MAAM;EAC1C,KAAK,YAAY,KAAK,aAAa,SAAS,oBAAoB,gCAAgC;EAChG,KAAK,cAAc,KAAK;EAExB,KAAK,MAAM,YAAY,gBAAgB,KAAK,SAAS;EAErD,IAAI,KAAK,aAAa,SAAS,eAC7B,KAAK,MAAM,UAAU,KAAK,aAAa,YAAY,MAAM;EAM3D,KAAK,MAAM,UAAU,yBAAiB;GACpC,S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T;;CAGF,OAAO;AACT,EACF,CAAC"}
1
+ {"version":3,"file":"code-variable-widget.js","names":[],"sources":["../../../../src/v2/components/code-input/code-variable-widget.ts"],"sourcesContent":["import { REGEX } from '@scalar/helpers/regex/regex-helpers'\nimport type { TranslateFn } from '@scalar/localization'\nimport {\n Decoration,\n type DecorationSet,\n EditorView,\n RangeSetBuilder,\n ViewPlugin,\n type ViewUpdate,\n WidgetType,\n} from '@scalar/use-codemirror'\nimport { type ContextFunctionName, getContextFunctionComment } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { createApp } from 'vue'\n\nimport type { ApiClientTranslationKey } from '@/v2/features/localization'\n\nimport PillTooltipHost from './PillTooltipHost.vue'\nimport type { PillContext } from './pill-context'\n\n/**\n * Displays `{{name}}` as a pill: environment variables show the resolved value;\n * context functions (e.g. `{{$guid}}`) show that the value is generated at send time.\n */\nclass PillWidget extends WidgetType {\n private app: any\n private readonly pillColor: string\n private readonly variableInfo: PillContext\n\n constructor(\n private readonly variableName: string,\n environment: XScalarEnvironment | undefined,\n variant: PillContext['type'],\n private readonly translate?: TranslateFn<ApiClientTranslationKey>,\n ) {\n super()\n if (variant === 'contextFunction') {\n this.pillColor = 'var(--scalar-color-3)'\n this.variableInfo = {\n type: 'contextFunction',\n identifier: variableName,\n details: getContextFunctionComment(variableName as ContextFunctionName),\n }\n return\n }\n\n this.pillColor = environment?.color || 'var(--scalar-color-1)'\n\n const variable = environment?.variables?.find((v) => v.name === variableName)\n const value = variable ? (typeof variable.value === 'string' ? variable.value : variable.value?.default) : undefined\n this.variableInfo = {\n type: 'environment',\n name: variableName,\n value: value || 'No value',\n isDefined: Boolean(value),\n }\n }\n\n toDOM(): HTMLElement {\n const span = document.createElement('span')\n span.className = this.variableInfo.type === 'contextFunction' ? 'cm-pill cm-pill--context-fn' : 'cm-pill'\n span.textContent = this.variableName\n\n span.style.setProperty('--tw-bg-base', this.pillColor)\n\n if (this.variableInfo.type === 'environment') {\n span.style.opacity = this.variableInfo.isDefined ? '1' : '0.5'\n }\n\n // PillTooltipHost is renderless and attaches `useTooltip` listeners to\n // `target` directly — mount onto a throwaway container so the pill DOM\n // we just built is preserved.\n this.app = createApp(PillTooltipHost, {\n context: this.variableInfo,\n target: span,\n translate: this.translate,\n })\n this.app.mount(document.createElement('div'))\n\n return span\n }\n\n override destroy(): void {\n if (this.app) {\n this.app.unmount()\n this.app = null\n }\n }\n\n override eq(other: WidgetType): boolean {\n if (!(other instanceof PillWidget)) {\n return false\n }\n if (\n other.variableName !== this.variableName ||\n other.pillColor !== this.pillColor ||\n other.variableInfo.type !== this.variableInfo.type\n ) {\n return false\n }\n const a = other.variableInfo\n const b = this.variableInfo\n if (a.type !== b.type) {\n return false\n }\n if (a.type === 'environment' && b.type === 'environment') {\n return a.name === b.name && a.value === b.value && a.isDefined === b.isDefined\n }\n if (a.type === 'contextFunction' && b.type === 'contextFunction') {\n return a.identifier === b.identifier && a.details === b.details\n }\n return false\n }\n\n override ignoreEvent(): boolean {\n return false\n }\n}\n\n/**\n * Styles the active environment variable pill.\n * This plugin creates decorations for environment variables in the editor.\n */\nexport const pillPlugin = (props: {\n environment: XScalarEnvironment | undefined\n isReadOnly: boolean | undefined\n isContextFunctionName?: (name: string) => boolean\n translate?: TranslateFn<ApiClientTranslationKey>\n}) =>\n ViewPlugin.fromClass(\n class {\n decorations: DecorationSet\n lastEnvironment: XScalarEnvironment | undefined\n\n constructor(view: EditorView) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(view)\n }\n\n update(update: ViewUpdate): void {\n // Rebuild decorations if environment changed\n if (props.environment !== this.lastEnvironment) {\n this.lastEnvironment = props.environment\n this.decorations = this.buildDecorations(update.view)\n return\n }\n\n // Only rebuild decorations if document or viewport changed\n if (update.docChanged || update.viewportChanged) {\n this.decorations = this.buildDecorations(update.view)\n }\n }\n\n buildDecorations(view: EditorView): DecorationSet {\n const builder = new RangeSetBuilder<Decoration>()\n const isContextFn = props.isContextFunctionName ?? (() => false)\n\n for (const { from, to } of view.visibleRanges) {\n const text = view.state.doc.sliceString(from, to)\n\n // Create a new regex instance to ensure lastIndex is reset\n const regex = new RegExp(REGEX.VARIABLES.source, REGEX.VARIABLES.flags)\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(text)) !== null) {\n const start = from + match.index\n const end = start + match[0].length\n const variableName = match[1] ?? ''\n\n // Skip decorations that span line breaks as CodeMirror does not allow them\n const matchedText = view.state.doc.sliceString(start, end)\n if (matchedText.includes('\\n')) {\n continue\n }\n\n const variant: PillContext['type'] = isContextFn(variableName) ? 'contextFunction' : 'environment'\n\n builder.add(\n start,\n end,\n Decoration.widget({\n widget: new PillWidget(variableName, props.environment, variant, props.translate),\n side: 1,\n }),\n )\n }\n }\n\n return builder.finish()\n }\n },\n {\n decorations: (v) => v.decorations,\n },\n )\n\n/**\n * Custom backspace handler for the editor.\n * Handles special cases like removing entire variable syntax and clearing all content.\n */\nexport const backspaceCommand = EditorView.domEventHandlers({\n keydown(event, view): boolean {\n if (event.key !== 'Backspace') {\n return false\n }\n\n const { state } = view\n const { from, to } = state.selection.main\n\n // When selecting all content and pressing backspace,\n // prevent breaking line content addition on pill removal\n if (from === 0 && to === state.doc.length) {\n view.dispatch({\n changes: { from: 0, to: state.doc.length },\n selection: { anchor: 0 },\n })\n event.preventDefault()\n return true\n }\n\n // When cursor is after a variable closing bracket (}}),\n // remove the entire closing syntax at once\n if (from === to && from >= 2) {\n const before = state.doc.sliceString(from - 2, from)\n if (before === '}}') {\n view.dispatch({\n changes: { from: from - 2, to: from },\n selection: { anchor: from - 2 },\n })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n})\n"],"mappings":";;;;;;;;;;AAwBA,IAAM,aAAN,MAAM,mBAAmB,WAAW;CAMf;CAGA;CARnB;CACA;CACA;CAEA,YACE,cACA,aACA,SACA,WACA;EACA,MAAM;EALW,KAAA,eAAA;EAGA,KAAA,YAAA;EAG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M,SAAS;KAChF,MAAM;IACR,CAAC,CACH;GACF;EACF;EAEA,OAAO,QAAQ,OAAO;CACxB;AACF,GACA,EACE,cAAc,MAAM,EAAE,YACxB,CACF;;;;;AAMF,IAAa,mBAAmB,WAAW,iBAAiB,EAC1D,QAAQ,OAAO,MAAe;CAC5B,IAAI,MAAM,QAAQ,aAChB,OAAO;CAGT,MAAM,EAAE,UAAU;CAClB,MAAM,EAAE,MAAM,OAAO,MAAM,UAAU;CAIrC,IAAI,SAAS,KAAK,OAAO,MAAM,IAAI,QAAQ;EACzC,KAAK,SAAS;GACZ,SAAS;IAAE,MAAM;IAAG,IAAI,MAAM,IAAI;GAAO;GACzC,WAAW,EAAE,QAAQ,EAAE;EACzB,CAAC;EACD,MAAM,eAAe;EACrB,OAAO;CACT;CAIA,IAAI,SAAS,MAAM,QAAQ;MACV,MAAM,IAAI,YAAY,OAAO,GAAG,IAC3C,MAAW,MAAM;GACnB,KAAK,SAAS;IACZ,SAAS;KAAE,MAAM,OAAO;KAAG,IAAI;IAAK;IACpC,WAAW,EAAE,QAAQ,OAAO,EAAE;GAChC,CAAC;GACD,MAAM,eAAe;GACrB,OAAO;EACT;;CAGF,OAAO;AACT,EACF,CAAC"}
@@ -9,7 +9,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
9
9
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
10
  "onUpdate:modelValue"?: ((v: boolean) => any) | undefined;
11
11
  }>, {
12
- ariaLabel: string;
13
12
  align: "left" | "center";
14
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
14
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableCheckbox.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/data-table/DataTableCheckbox.vue"],"names":[],"mappings":"AAgEA,KAAK,WAAW,GAAG;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC;AAkHJ,QAAA,MAAM,YAAY;;;;;eAnHF,MAAM;WADV,MAAM,GAAG,QAAQ;6EAwH3B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"DataTableCheckbox.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/data-table/DataTableCheckbox.vue"],"names":[],"mappings":"AAqEA,KAAK,WAAW,GAAG;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC;AAmHJ,QAAA,MAAM,YAAY;;;;;WArHN,MAAM,GAAG,QAAQ;6EAyH3B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableCheckbox.vue.js","names":[],"sources":["../../../../src/v2/components/data-table/DataTableCheckbox.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { cva } from '@scalar/use-hooks/useBindCx'\n\nimport DataTableCell from './DataTableCell.vue'\n\nwithDefaults(\n defineProps<{\n modelValue: boolean\n disabled?: boolean\n align?: 'left' | 'center'\n ariaLabel?: string\n }>(),\n {\n align: 'center',\n ariaLabel: 'Toggle',\n },\n)\n\ndefineEmits<{\n (e: 'update:modelValue', v: boolean): void\n}>()\n\nconst variants = cva({\n base: 'w-8 h-8 flex items-center justify-center text-b-2 peer-checked:text-c-1 pointer-events-none absolute',\n variants: {\n align: {\n left: 'left-0',\n center: 'centered',\n },\n },\n})\n</script>\n<template>\n <DataTableCell class=\"group/cell relative flex min-w-8\">\n <input\n :aria-label=\"ariaLabel\"\n :checked=\"modelValue\"\n class=\"peer absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-default\"\n :disabled=\"Boolean(disabled)\"\n type=\"checkbox\"\n @change=\"(e: any) => $emit('update:modelValue', e.target.checked)\" />\n <div :class=\"variants({ align })\">\n <div\n class=\"absolute m-auto size-3/4 rounded border-[1px] opacity-0\"\n :class=\"\n !disabled &&\n 'group-has-[:focus-visible]/cell:border-c-accent group-hover:opacity-100 group-has-[:focus-visible]/cell:opacity-100'\n \" />\n <ScalarIcon\n icon=\"Checkmark\"\n size=\"xs\"\n thickness=\"2.5\" />\n </div>\n </DataTableCell>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"DataTableCheckbox.vue.js","names":[],"sources":["../../../../src/v2/components/data-table/DataTableCheckbox.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { cva } from '@scalar/use-hooks/useBindCx'\n\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\n\nwithDefaults(\n defineProps<{\n modelValue: boolean\n disabled?: boolean\n align?: 'left' | 'center'\n ariaLabel?: string\n }>(),\n {\n align: 'center',\n },\n)\n\ndefineEmits<{\n (e: 'update:modelValue', v: boolean): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst variants = cva({\n base: 'w-8 h-8 flex items-center justify-center text-b-2 peer-checked:text-c-1 pointer-events-none absolute',\n variants: {\n align: {\n left: 'left-0',\n center: 'centered',\n },\n },\n})\n</script>\n<template>\n <DataTableCell class=\"group/cell relative flex min-w-8\">\n <input\n :aria-label=\"ariaLabel ?? translate('apiClient.dataTableCheckbox.toggle')\"\n :checked=\"modelValue\"\n class=\"peer absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-default\"\n :disabled=\"Boolean(disabled)\"\n type=\"checkbox\"\n @change=\"(e: any) => $emit('update:modelValue', e.target.checked)\" />\n <div :class=\"variants({ align })\">\n <div\n class=\"absolute m-auto size-3/4 rounded border-[1px] opacity-0\"\n :class=\"\n !disabled &&\n 'group-has-[:focus-visible]/cell:border-c-accent group-hover:opacity-100 group-has-[:focus-visible]/cell:opacity-100'\n \" />\n <ScalarIcon\n icon=\"Checkmark\"\n size=\"xs\"\n thickness=\"2.5\" />\n </div>\n </DataTableCell>\n</template>\n"],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import { useLocalization } from "../../features/localization/index.js";
1
2
  import DataTableCell_default from "./DataTableCell.vue.js";
2
3
  import { createBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, unref, withCtx } from "vue";
3
4
  import { cva } from "@scalar/use-hooks/useBindCx";
@@ -14,10 +15,11 @@ var DataTableCheckbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
14
15
  modelValue: { type: Boolean },
15
16
  disabled: { type: Boolean },
16
17
  align: { default: "center" },
17
- ariaLabel: { default: "Toggle" }
18
+ ariaLabel: {}
18
19
  },
19
20
  emits: ["update:modelValue"],
20
21
  setup(__props) {
22
+ const { translate } = useLocalization();
21
23
  const variants = cva({
22
24
  base: "w-8 h-8 flex items-center justify-center text-b-2 peer-checked:text-c-1 pointer-events-none absolute",
23
25
  variants: { align: {
@@ -28,7 +30,7 @@ var DataTableCheckbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
28
30
  return (_ctx, _cache) => {
29
31
  return openBlock(), createBlock(DataTableCell_default, { class: "group/cell relative flex min-w-8" }, {
30
32
  default: withCtx(() => [createElementVNode("input", {
31
- "aria-label": __props.ariaLabel,
33
+ "aria-label": __props.ariaLabel ?? unref(translate)("apiClient.dataTableCheckbox.toggle"),
32
34
  checked: __props.modelValue,
33
35
  class: "peer absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-default",
34
36
  disabled: Boolean(__props.disabled),
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableCheckbox.vue.script.js","names":["$emit"],"sources":["../../../../src/v2/components/data-table/DataTableCheckbox.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { cva } from '@scalar/use-hooks/useBindCx'\n\nimport DataTableCell from './DataTableCell.vue'\n\nwithDefaults(\n defineProps<{\n modelValue: boolean\n disabled?: boolean\n align?: 'left' | 'center'\n ariaLabel?: string\n }>(),\n {\n align: 'center',\n ariaLabel: 'Toggle',\n },\n)\n\ndefineEmits<{\n (e: 'update:modelValue', v: boolean): void\n}>()\n\nconst variants = cva({\n base: 'w-8 h-8 flex items-center justify-center text-b-2 peer-checked:text-c-1 pointer-events-none absolute',\n variants: {\n align: {\n left: 'left-0',\n center: 'centered',\n },\n },\n})\n</script>\n<template>\n <DataTableCell class=\"group/cell relative flex min-w-8\">\n <input\n :aria-label=\"ariaLabel\"\n :checked=\"modelValue\"\n class=\"peer absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-default\"\n :disabled=\"Boolean(disabled)\"\n type=\"checkbox\"\n @change=\"(e: any) => $emit('update:modelValue', e.target.checked)\" />\n <div :class=\"variants({ align })\">\n <div\n class=\"absolute m-auto size-3/4 rounded border-[1px] opacity-0\"\n :class=\"\n !disabled &&\n 'group-has-[:focus-visible]/cell:border-c-accent group-hover:opacity-100 group-has-[:focus-visible]/cell:opacity-100'\n \" />\n <ScalarIcon\n icon=\"Checkmark\"\n size=\"xs\"\n thickness=\"2.5\" />\n </div>\n </DataTableCell>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAuBA,MAAM,WAAW,IAAI;GACnB,MAAM;GACN,UAAU,EACR,OAAO;IACL,MAAM;IACN,QAAQ;GACV,EACF;EACF,CAAC;;uBAGC,YAoBgB,uBAAA,EApBD,OAAM,mCAAkC,GAAA;2BAOkB,CANvE,mBAMuE,SAAA;KALpE,cAAY,QAAA;KACZ,SAAS,QAAA;KACV,OAAM;KACL,UAAU,QAAQ,QAAA,QAAQ;KAC3B,MAAK;KACJ,UAAM,OAAA,OAAA,OAAA,MAAG,MAAWA,KAAAA,MAAK,qBAAsB,EAAE,OAAO,OAAO;8BAClE,mBAWM,OAAA,EAXA,OAAK,eAAE,MAAA,QAAA,CAAQ,CAAA,EAAA,OAAG,QAAA,MAAK,CAAA,CAAA,EAAA,GAAA,CAC3B,mBAKM,OAAA,EAJJ,OAAK,eAAA,CAAC,2DAAA,CACc,QAAA,YAAA,qHAAA,CAAA,EAAA,GAAA,MAAA,CAAA,GAItB,YAGoB,MAAA,UAAA,GAAA;KAFlB,MAAK;KACL,MAAK;KACL,WAAU"}
1
+ {"version":3,"file":"DataTableCheckbox.vue.script.js","names":["$emit"],"sources":["../../../../src/v2/components/data-table/DataTableCheckbox.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { cva } from '@scalar/use-hooks/useBindCx'\n\nimport { useLocalization } from '@/v2/features/localization'\n\nimport DataTableCell from './DataTableCell.vue'\n\nwithDefaults(\n defineProps<{\n modelValue: boolean\n disabled?: boolean\n align?: 'left' | 'center'\n ariaLabel?: string\n }>(),\n {\n align: 'center',\n },\n)\n\ndefineEmits<{\n (e: 'update:modelValue', v: boolean): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst variants = cva({\n base: 'w-8 h-8 flex items-center justify-center text-b-2 peer-checked:text-c-1 pointer-events-none absolute',\n variants: {\n align: {\n left: 'left-0',\n center: 'centered',\n },\n },\n})\n</script>\n<template>\n <DataTableCell class=\"group/cell relative flex min-w-8\">\n <input\n :aria-label=\"ariaLabel ?? translate('apiClient.dataTableCheckbox.toggle')\"\n :checked=\"modelValue\"\n class=\"peer absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-default\"\n :disabled=\"Boolean(disabled)\"\n type=\"checkbox\"\n @change=\"(e: any) => $emit('update:modelValue', e.target.checked)\" />\n <div :class=\"variants({ align })\">\n <div\n class=\"absolute m-auto size-3/4 rounded border-[1px] opacity-0\"\n :class=\"\n !disabled &&\n 'group-has-[:focus-visible]/cell:border-c-accent group-hover:opacity-100 group-has-[:focus-visible]/cell:opacity-100'\n \" />\n <ScalarIcon\n icon=\"Checkmark\"\n size=\"xs\"\n thickness=\"2.5\" />\n </div>\n </DataTableCell>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,WAAW,IAAI;GACnB,MAAM;GACN,UAAU,EACR,OAAO;IACL,MAAM;IACN,QAAQ;GACV,EACF;EACF,CAAC;;uBAGC,YAoBgB,uBAAA,EApBD,OAAM,mCAAkC,GAAA;2BAOkB,CANvE,mBAMuE,SAAA;KALpE,cAAY,QAAA,aAAa,MAAA,SAAA,CAAS,CAAA,oCAAA;KAClC,SAAS,QAAA;KACV,OAAM;KACL,UAAU,QAAQ,QAAA,QAAQ;KAC3B,MAAK;KACJ,UAAM,OAAA,OAAA,OAAA,MAAG,MAAWA,KAAAA,MAAK,qBAAsB,EAAE,OAAO,OAAO;8BAClE,mBAWM,OAAA,EAXA,OAAK,eAAE,MAAA,QAAA,CAAQ,CAAA,EAAA,OAAG,QAAA,MAAK,CAAA,CAAA,EAAA,GAAA,CAC3B,mBAKM,OAAA,EAJJ,OAAK,eAAA,CAAC,2DAAA,CACc,QAAA,YAAA,qHAAA,CAAA,EAAA,GAAA,MAAA,CAAA,GAItB,YAGoB,MAAA,UAAA,GAAA;KAFlB,MAAK;KACL,MAAK;KACL,WAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/data-table/DataTableInput.vue"],"names":[],"mappings":"AAkLA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAGnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM/C,KAAK,WAAW,GAAG;IACf,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,sEAAsE;IACtE,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC,QAAQ,CAAC,EAAE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