@sanity/assist 1.2.14 → 1.2.15-lang.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/README.md +546 -24
  2. package/dist/index.cjs.mjs +1 -0
  3. package/dist/index.d.ts +253 -11
  4. package/dist/index.esm.js +2367 -393
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/index.js +2361 -386
  7. package/dist/index.js.map +1 -1
  8. package/package.json +15 -14
  9. package/src/_lib/form/DocumentForm.tsx +3 -2
  10. package/src/_lib/form/constants.ts +1 -0
  11. package/src/assistDocument/AssistDocumentInput.tsx +24 -4
  12. package/src/assistDocument/RequestRunInstructionProvider.tsx +37 -21
  13. package/src/assistDocument/components/instruction/InstructionInput.tsx +5 -4
  14. package/src/assistDocument/components/instruction/InstructionOutputField.tsx +45 -0
  15. package/src/assistDocument/components/instruction/InstructionOutputInput.tsx +205 -0
  16. package/src/assistDocument/hooks/useStudioAssistDocument.ts +5 -32
  17. package/src/assistFormComponents/AssistField.tsx +11 -5
  18. package/src/assistFormComponents/AssistFormBlock.tsx +2 -3
  19. package/src/assistFormComponents/validation/listItem.tsx +2 -2
  20. package/src/assistInspector/AssistInspector.tsx +6 -0
  21. package/src/assistInspector/FieldAutocomplete.tsx +1 -0
  22. package/src/assistInspector/InstructionTaskHistoryButton.tsx +2 -3
  23. package/src/assistInspector/helpers.ts +9 -11
  24. package/src/assistLayout/AssistLayout.tsx +9 -9
  25. package/src/components/ImageContext.tsx +19 -9
  26. package/src/components/SafeValueInput.tsx +4 -1
  27. package/src/coverage/.tmp/coverage-0.json +1 -0
  28. package/src/coverage/base.css +224 -0
  29. package/src/coverage/block-navigation.js +87 -0
  30. package/src/coverage/clover.xml +8613 -0
  31. package/src/coverage/coverage-final.json +107 -0
  32. package/src/coverage/favicon.png +0 -0
  33. package/src/coverage/index.html +461 -0
  34. package/src/coverage/lcov-report/base.css +224 -0
  35. package/src/coverage/lcov-report/block-navigation.js +87 -0
  36. package/src/coverage/lcov-report/favicon.png +0 -0
  37. package/src/coverage/lcov-report/index.html +461 -0
  38. package/src/coverage/lcov-report/prettify.css +1 -0
  39. package/src/coverage/lcov-report/prettify.js +2 -0
  40. package/src/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  41. package/src/coverage/lcov-report/sorter.js +196 -0
  42. package/src/coverage/lcov-report/src/_lib/connector/ConnectFromRegion.tsx.html +157 -0
  43. package/src/coverage/lcov-report/src/_lib/connector/ConnectToRegion.tsx.html +151 -0
  44. package/src/coverage/lcov-report/src/_lib/connector/ConnectorRegion.tsx.html +154 -0
  45. package/src/coverage/lcov-report/src/_lib/connector/ConnectorsProvider.tsx.html +142 -0
  46. package/src/coverage/lcov-report/src/_lib/connector/ConnectorsStore.ts.html +451 -0
  47. package/src/coverage/lcov-report/src/_lib/connector/ConnectorsStoreContext.ts.html +97 -0
  48. package/src/coverage/lcov-report/src/_lib/connector/helpers.ts.html +100 -0
  49. package/src/coverage/lcov-report/src/_lib/connector/index.html +281 -0
  50. package/src/coverage/lcov-report/src/_lib/connector/index.ts.html +112 -0
  51. package/src/coverage/lcov-report/src/_lib/connector/mapConnectorToLine.ts.html +334 -0
  52. package/src/coverage/lcov-report/src/_lib/connector/types.ts.html +253 -0
  53. package/src/coverage/lcov-report/src/_lib/connector/useConnectorsStore.ts.html +124 -0
  54. package/src/coverage/lcov-report/src/_lib/connector/useRegionRects.ts.html +508 -0
  55. package/src/coverage/lcov-report/src/_lib/fixedListenQuery.ts.html +388 -0
  56. package/src/coverage/lcov-report/src/_lib/form/DocumentForm.tsx.html +676 -0
  57. package/src/coverage/lcov-report/src/_lib/form/helpers.ts.html +178 -0
  58. package/src/coverage/lcov-report/src/_lib/form/index.html +146 -0
  59. package/src/coverage/lcov-report/src/_lib/form/index.ts.html +88 -0
  60. package/src/coverage/lcov-report/src/_lib/index.html +161 -0
  61. package/src/coverage/lcov-report/src/_lib/randomKey.ts.html +172 -0
  62. package/src/coverage/lcov-report/src/_lib/useListeningQuery.ts.html +268 -0
  63. package/src/coverage/lcov-report/src/_lib/usePrevious.ts.html +112 -0
  64. package/src/coverage/lcov-report/src/assistConnectors/AssistConnectorsOverlay.tsx.html +481 -0
  65. package/src/coverage/lcov-report/src/assistConnectors/ConnectorPath.tsx.html +271 -0
  66. package/src/coverage/lcov-report/src/assistConnectors/draw/arrowPath.ts.html +112 -0
  67. package/src/coverage/lcov-report/src/assistConnectors/draw/connectorPath.ts.html +511 -0
  68. package/src/coverage/lcov-report/src/assistConnectors/draw/index.html +131 -0
  69. package/src/coverage/lcov-report/src/assistConnectors/index.html +146 -0
  70. package/src/coverage/lcov-report/src/assistConnectors/index.ts.html +88 -0
  71. package/src/coverage/lcov-report/src/assistDocument/AssistDocumentContext.tsx.html +178 -0
  72. package/src/coverage/lcov-report/src/assistDocument/AssistDocumentContextProvider.tsx.html +136 -0
  73. package/src/coverage/lcov-report/src/assistDocument/AssistDocumentInput.tsx.html +280 -0
  74. package/src/coverage/lcov-report/src/assistDocument/RequestRunInstructionProvider.tsx.html +283 -0
  75. package/src/coverage/lcov-report/src/assistDocument/components/AssistDocumentForm.tsx.html +775 -0
  76. package/src/coverage/lcov-report/src/assistDocument/components/FieldRefPreview.tsx.html +166 -0
  77. package/src/coverage/lcov-report/src/assistDocument/components/InstructionsArrayField.tsx.html +109 -0
  78. package/src/coverage/lcov-report/src/assistDocument/components/InstructionsArrayInput.tsx.html +163 -0
  79. package/src/coverage/lcov-report/src/assistDocument/components/SelectedFieldContext.tsx.html +115 -0
  80. package/src/coverage/lcov-report/src/assistDocument/components/generic/HiddenFieldTitle.tsx.html +100 -0
  81. package/src/coverage/lcov-report/src/assistDocument/components/generic/index.html +116 -0
  82. package/src/coverage/lcov-report/src/assistDocument/components/helpers.ts.html +148 -0
  83. package/src/coverage/lcov-report/src/assistDocument/components/index.html +191 -0
  84. package/src/coverage/lcov-report/src/assistDocument/components/instruction/BackToInstructionsLink.tsx.html +178 -0
  85. package/src/coverage/lcov-report/src/assistDocument/components/instruction/FieldRefInput.tsx.html +244 -0
  86. package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionInput.tsx.html +349 -0
  87. package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionOutputField.tsx.html +220 -0
  88. package/src/coverage/lcov-report/src/assistDocument/components/instruction/InstructionOutputInput.tsx.html +700 -0
  89. package/src/coverage/lcov-report/src/assistDocument/components/instruction/PromptInput.tsx.html +241 -0
  90. package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/IconInput.tsx.html +223 -0
  91. package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/InstructionVisibility.tsx.html +196 -0
  92. package/src/coverage/lcov-report/src/assistDocument/components/instruction/appearance/index.html +131 -0
  93. package/src/coverage/lcov-report/src/assistDocument/components/instruction/index.html +191 -0
  94. package/src/coverage/lcov-report/src/assistDocument/hooks/index.html +161 -0
  95. package/src/coverage/lcov-report/src/assistDocument/hooks/useAssistDocumentContextValue.tsx.html +289 -0
  96. package/src/coverage/lcov-report/src/assistDocument/hooks/useDocumentState.ts.html +103 -0
  97. package/src/coverage/lcov-report/src/assistDocument/hooks/useInstructionToaster.tsx.html +307 -0
  98. package/src/coverage/lcov-report/src/assistDocument/hooks/useStudioAssistDocument.ts.html +379 -0
  99. package/src/coverage/lcov-report/src/assistDocument/index.html +176 -0
  100. package/src/coverage/lcov-report/src/assistDocument/index.ts.html +88 -0
  101. package/src/coverage/lcov-report/src/assistFormComponents/AssistField.tsx.html +301 -0
  102. package/src/coverage/lcov-report/src/assistFormComponents/AssistFormBlock.tsx.html +175 -0
  103. package/src/coverage/lcov-report/src/assistFormComponents/AssistInlineFormBlock.tsx.html +124 -0
  104. package/src/coverage/lcov-report/src/assistFormComponents/AssistItem.tsx.html +145 -0
  105. package/src/coverage/lcov-report/src/assistFormComponents/index.html +161 -0
  106. package/src/coverage/lcov-report/src/assistFormComponents/validation/index.html +131 -0
  107. package/src/coverage/lcov-report/src/assistFormComponents/validation/listItem.tsx.html +274 -0
  108. package/src/coverage/lcov-report/src/assistFormComponents/validation/validationList.tsx.html +352 -0
  109. package/src/coverage/lcov-report/src/assistInspector/AssistInspector.tsx.html +1318 -0
  110. package/src/coverage/lcov-report/src/assistInspector/FieldAutocomplete.tsx.html +505 -0
  111. package/src/coverage/lcov-report/src/assistInspector/InstructionTaskHistoryButton.tsx.html +865 -0
  112. package/src/coverage/lcov-report/src/assistInspector/constants.ts.html +88 -0
  113. package/src/coverage/lcov-report/src/assistInspector/helpers.ts.html +724 -0
  114. package/src/coverage/lcov-report/src/assistInspector/index.html +191 -0
  115. package/src/coverage/lcov-report/src/assistInspector/index.ts.html +163 -0
  116. package/src/coverage/lcov-report/src/assistLayout/AiAssistanceConfigContext.tsx.html +331 -0
  117. package/src/coverage/lcov-report/src/assistLayout/AssistLayout.tsx.html +199 -0
  118. package/src/coverage/lcov-report/src/assistLayout/RunInstructionProvider.tsx.html +751 -0
  119. package/src/coverage/lcov-report/src/assistLayout/index.html +146 -0
  120. package/src/coverage/lcov-report/src/components/AssistFeatureBadge.tsx.html +112 -0
  121. package/src/coverage/lcov-report/src/components/FadeInContent.tsx.html +205 -0
  122. package/src/coverage/lcov-report/src/components/HideReferenceChangedBannerInput.tsx.html +160 -0
  123. package/src/coverage/lcov-report/src/components/ImageContext.tsx.html +229 -0
  124. package/src/coverage/lcov-report/src/components/SafeValueInput.tsx.html +313 -0
  125. package/src/coverage/lcov-report/src/components/TimeAgo.tsx.html +139 -0
  126. package/src/coverage/lcov-report/src/components/index.html +191 -0
  127. package/src/coverage/lcov-report/src/constants.ts.html +145 -0
  128. package/src/coverage/lcov-report/src/fieldActions/PrivateIcon.tsx.html +145 -0
  129. package/src/coverage/lcov-report/src/fieldActions/assistFieldActions.tsx.html +907 -0
  130. package/src/coverage/lcov-report/src/fieldActions/generateCaptionActions.tsx.html +259 -0
  131. package/src/coverage/lcov-report/src/fieldActions/generateImageActions.tsx.html +256 -0
  132. package/src/coverage/lcov-report/src/fieldActions/index.html +161 -0
  133. package/src/coverage/lcov-report/src/helpers/assistSupported.ts.html +226 -0
  134. package/src/coverage/lcov-report/src/helpers/conditionalMembers.ts.html +466 -0
  135. package/src/coverage/lcov-report/src/helpers/ids.ts.html +142 -0
  136. package/src/coverage/lcov-report/src/helpers/index.html +191 -0
  137. package/src/coverage/lcov-report/src/helpers/misc.ts.html +133 -0
  138. package/src/coverage/lcov-report/src/helpers/typeUtils.ts.html +208 -0
  139. package/src/coverage/lcov-report/src/helpers/useAssistSupported.ts.html +106 -0
  140. package/src/coverage/lcov-report/src/index.html +176 -0
  141. package/src/coverage/lcov-report/src/index.ts.html +112 -0
  142. package/src/coverage/lcov-report/src/onboarding/FieldActionsOnboarding.tsx.html +286 -0
  143. package/src/coverage/lcov-report/src/onboarding/FirstAssistedPathProvider.tsx.html +172 -0
  144. package/src/coverage/lcov-report/src/onboarding/InspectorOnboarding.tsx.html +223 -0
  145. package/src/coverage/lcov-report/src/onboarding/index.html +161 -0
  146. package/src/coverage/lcov-report/src/onboarding/onboardingStore.ts.html +184 -0
  147. package/src/coverage/lcov-report/src/plugin.tsx.html +427 -0
  148. package/src/coverage/lcov-report/src/presence/AiFieldPresence.tsx.html +163 -0
  149. package/src/coverage/lcov-report/src/presence/AssistAvatar.tsx.html +373 -0
  150. package/src/coverage/lcov-report/src/presence/AssistDocumentPresence.tsx.html +259 -0
  151. package/src/coverage/lcov-report/src/presence/index.html +161 -0
  152. package/src/coverage/lcov-report/src/presence/useAssistPresence.ts.html +268 -0
  153. package/src/coverage/lcov-report/src/schemas/assistDocumentSchema.tsx.html +1552 -0
  154. package/src/coverage/lcov-report/src/schemas/contextDocumentSchema.tsx.html +253 -0
  155. package/src/coverage/lcov-report/src/schemas/index.html +176 -0
  156. package/src/coverage/lcov-report/src/schemas/index.ts.html +277 -0
  157. package/src/coverage/lcov-report/src/schemas/serialize/SchemTypeTool.tsx.html +391 -0
  158. package/src/coverage/lcov-report/src/schemas/serialize/index.html +146 -0
  159. package/src/coverage/lcov-report/src/schemas/serialize/schemaUtils.ts.html +196 -0
  160. package/src/coverage/lcov-report/src/schemas/serialize/serializeSchema.ts.html +754 -0
  161. package/src/coverage/lcov-report/src/schemas/serializedSchemaTypeSchema.ts.html +262 -0
  162. package/src/coverage/lcov-report/src/schemas/typeDefExtensions.ts.html +397 -0
  163. package/src/coverage/lcov-report/src/translate/FieldTranslationProvider.tsx.html +1003 -0
  164. package/src/coverage/lcov-report/src/translate/getLanguageParams.ts.html +163 -0
  165. package/src/coverage/lcov-report/src/translate/index.html +191 -0
  166. package/src/coverage/lcov-report/src/translate/languageStore.ts.html +139 -0
  167. package/src/coverage/lcov-report/src/translate/paths.ts.html +577 -0
  168. package/src/coverage/lcov-report/src/translate/translateActions.tsx.html +637 -0
  169. package/src/coverage/lcov-report/src/translate/types.ts.html +565 -0
  170. package/src/coverage/lcov-report/src/types.ts.html +649 -0
  171. package/src/coverage/lcov-report/src/useApiClient.ts.html +1015 -0
  172. package/src/coverage/lcov.info +9519 -0
  173. package/src/coverage/prettify.css +1 -0
  174. package/src/coverage/prettify.js +2 -0
  175. package/src/coverage/sort-arrow-sprite.png +0 -0
  176. package/src/coverage/sorter.js +196 -0
  177. package/src/coverage/src/_lib/connector/ConnectFromRegion.tsx.html +157 -0
  178. package/src/coverage/src/_lib/connector/ConnectToRegion.tsx.html +151 -0
  179. package/src/coverage/src/_lib/connector/ConnectorRegion.tsx.html +154 -0
  180. package/src/coverage/src/_lib/connector/ConnectorsProvider.tsx.html +142 -0
  181. package/src/coverage/src/_lib/connector/ConnectorsStore.ts.html +451 -0
  182. package/src/coverage/src/_lib/connector/ConnectorsStoreContext.ts.html +97 -0
  183. package/src/coverage/src/_lib/connector/helpers.ts.html +100 -0
  184. package/src/coverage/src/_lib/connector/index.html +281 -0
  185. package/src/coverage/src/_lib/connector/index.ts.html +112 -0
  186. package/src/coverage/src/_lib/connector/mapConnectorToLine.ts.html +334 -0
  187. package/src/coverage/src/_lib/connector/types.ts.html +253 -0
  188. package/src/coverage/src/_lib/connector/useConnectorsStore.ts.html +124 -0
  189. package/src/coverage/src/_lib/connector/useRegionRects.ts.html +508 -0
  190. package/src/coverage/src/_lib/fixedListenQuery.ts.html +388 -0
  191. package/src/coverage/src/_lib/form/DocumentForm.tsx.html +676 -0
  192. package/src/coverage/src/_lib/form/helpers.ts.html +178 -0
  193. package/src/coverage/src/_lib/form/index.html +146 -0
  194. package/src/coverage/src/_lib/form/index.ts.html +88 -0
  195. package/src/coverage/src/_lib/index.html +161 -0
  196. package/src/coverage/src/_lib/randomKey.ts.html +172 -0
  197. package/src/coverage/src/_lib/useListeningQuery.ts.html +268 -0
  198. package/src/coverage/src/_lib/usePrevious.ts.html +112 -0
  199. package/src/coverage/src/assistConnectors/AssistConnectorsOverlay.tsx.html +481 -0
  200. package/src/coverage/src/assistConnectors/ConnectorPath.tsx.html +271 -0
  201. package/src/coverage/src/assistConnectors/draw/arrowPath.ts.html +112 -0
  202. package/src/coverage/src/assistConnectors/draw/connectorPath.ts.html +511 -0
  203. package/src/coverage/src/assistConnectors/draw/index.html +131 -0
  204. package/src/coverage/src/assistConnectors/index.html +146 -0
  205. package/src/coverage/src/assistConnectors/index.ts.html +88 -0
  206. package/src/coverage/src/assistDocument/AssistDocumentContext.tsx.html +178 -0
  207. package/src/coverage/src/assistDocument/AssistDocumentContextProvider.tsx.html +136 -0
  208. package/src/coverage/src/assistDocument/AssistDocumentInput.tsx.html +280 -0
  209. package/src/coverage/src/assistDocument/RequestRunInstructionProvider.tsx.html +283 -0
  210. package/src/coverage/src/assistDocument/components/AssistDocumentForm.tsx.html +775 -0
  211. package/src/coverage/src/assistDocument/components/FieldRefPreview.tsx.html +166 -0
  212. package/src/coverage/src/assistDocument/components/InstructionsArrayField.tsx.html +109 -0
  213. package/src/coverage/src/assistDocument/components/InstructionsArrayInput.tsx.html +163 -0
  214. package/src/coverage/src/assistDocument/components/SelectedFieldContext.tsx.html +115 -0
  215. package/src/coverage/src/assistDocument/components/generic/HiddenFieldTitle.tsx.html +100 -0
  216. package/src/coverage/src/assistDocument/components/generic/index.html +116 -0
  217. package/src/coverage/src/assistDocument/components/helpers.ts.html +148 -0
  218. package/src/coverage/src/assistDocument/components/index.html +191 -0
  219. package/src/coverage/src/assistDocument/components/instruction/BackToInstructionsLink.tsx.html +178 -0
  220. package/src/coverage/src/assistDocument/components/instruction/FieldRefInput.tsx.html +244 -0
  221. package/src/coverage/src/assistDocument/components/instruction/InstructionInput.tsx.html +349 -0
  222. package/src/coverage/src/assistDocument/components/instruction/InstructionOutputField.tsx.html +220 -0
  223. package/src/coverage/src/assistDocument/components/instruction/InstructionOutputInput.tsx.html +700 -0
  224. package/src/coverage/src/assistDocument/components/instruction/PromptInput.tsx.html +241 -0
  225. package/src/coverage/src/assistDocument/components/instruction/appearance/IconInput.tsx.html +223 -0
  226. package/src/coverage/src/assistDocument/components/instruction/appearance/InstructionVisibility.tsx.html +196 -0
  227. package/src/coverage/src/assistDocument/components/instruction/appearance/index.html +131 -0
  228. package/src/coverage/src/assistDocument/components/instruction/index.html +191 -0
  229. package/src/coverage/src/assistDocument/hooks/index.html +161 -0
  230. package/src/coverage/src/assistDocument/hooks/useAssistDocumentContextValue.tsx.html +289 -0
  231. package/src/coverage/src/assistDocument/hooks/useDocumentState.ts.html +103 -0
  232. package/src/coverage/src/assistDocument/hooks/useInstructionToaster.tsx.html +307 -0
  233. package/src/coverage/src/assistDocument/hooks/useStudioAssistDocument.ts.html +379 -0
  234. package/src/coverage/src/assistDocument/index.html +176 -0
  235. package/src/coverage/src/assistDocument/index.ts.html +88 -0
  236. package/src/coverage/src/assistFormComponents/AssistField.tsx.html +301 -0
  237. package/src/coverage/src/assistFormComponents/AssistFormBlock.tsx.html +175 -0
  238. package/src/coverage/src/assistFormComponents/AssistInlineFormBlock.tsx.html +124 -0
  239. package/src/coverage/src/assistFormComponents/AssistItem.tsx.html +145 -0
  240. package/src/coverage/src/assistFormComponents/index.html +161 -0
  241. package/src/coverage/src/assistFormComponents/validation/index.html +131 -0
  242. package/src/coverage/src/assistFormComponents/validation/listItem.tsx.html +274 -0
  243. package/src/coverage/src/assistFormComponents/validation/validationList.tsx.html +352 -0
  244. package/src/coverage/src/assistInspector/AssistInspector.tsx.html +1318 -0
  245. package/src/coverage/src/assistInspector/FieldAutocomplete.tsx.html +505 -0
  246. package/src/coverage/src/assistInspector/InstructionTaskHistoryButton.tsx.html +865 -0
  247. package/src/coverage/src/assistInspector/constants.ts.html +88 -0
  248. package/src/coverage/src/assistInspector/helpers.ts.html +724 -0
  249. package/src/coverage/src/assistInspector/index.html +191 -0
  250. package/src/coverage/src/assistInspector/index.ts.html +163 -0
  251. package/src/coverage/src/assistLayout/AiAssistanceConfigContext.tsx.html +331 -0
  252. package/src/coverage/src/assistLayout/AssistLayout.tsx.html +199 -0
  253. package/src/coverage/src/assistLayout/RunInstructionProvider.tsx.html +751 -0
  254. package/src/coverage/src/assistLayout/index.html +146 -0
  255. package/src/coverage/src/components/AssistFeatureBadge.tsx.html +112 -0
  256. package/src/coverage/src/components/FadeInContent.tsx.html +205 -0
  257. package/src/coverage/src/components/HideReferenceChangedBannerInput.tsx.html +160 -0
  258. package/src/coverage/src/components/ImageContext.tsx.html +229 -0
  259. package/src/coverage/src/components/SafeValueInput.tsx.html +313 -0
  260. package/src/coverage/src/components/TimeAgo.tsx.html +139 -0
  261. package/src/coverage/src/components/index.html +191 -0
  262. package/src/coverage/src/constants.ts.html +145 -0
  263. package/src/coverage/src/fieldActions/PrivateIcon.tsx.html +145 -0
  264. package/src/coverage/src/fieldActions/assistFieldActions.tsx.html +907 -0
  265. package/src/coverage/src/fieldActions/generateCaptionActions.tsx.html +259 -0
  266. package/src/coverage/src/fieldActions/generateImageActions.tsx.html +256 -0
  267. package/src/coverage/src/fieldActions/index.html +161 -0
  268. package/src/coverage/src/helpers/assistSupported.ts.html +226 -0
  269. package/src/coverage/src/helpers/conditionalMembers.ts.html +466 -0
  270. package/src/coverage/src/helpers/ids.ts.html +142 -0
  271. package/src/coverage/src/helpers/index.html +191 -0
  272. package/src/coverage/src/helpers/misc.ts.html +133 -0
  273. package/src/coverage/src/helpers/typeUtils.ts.html +208 -0
  274. package/src/coverage/src/helpers/useAssistSupported.ts.html +106 -0
  275. package/src/coverage/src/index.html +176 -0
  276. package/src/coverage/src/index.ts.html +112 -0
  277. package/src/coverage/src/onboarding/FieldActionsOnboarding.tsx.html +286 -0
  278. package/src/coverage/src/onboarding/FirstAssistedPathProvider.tsx.html +172 -0
  279. package/src/coverage/src/onboarding/InspectorOnboarding.tsx.html +223 -0
  280. package/src/coverage/src/onboarding/index.html +161 -0
  281. package/src/coverage/src/onboarding/onboardingStore.ts.html +184 -0
  282. package/src/coverage/src/plugin.tsx.html +427 -0
  283. package/src/coverage/src/presence/AiFieldPresence.tsx.html +163 -0
  284. package/src/coverage/src/presence/AssistAvatar.tsx.html +373 -0
  285. package/src/coverage/src/presence/AssistDocumentPresence.tsx.html +259 -0
  286. package/src/coverage/src/presence/index.html +161 -0
  287. package/src/coverage/src/presence/useAssistPresence.ts.html +268 -0
  288. package/src/coverage/src/schemas/assistDocumentSchema.tsx.html +1552 -0
  289. package/src/coverage/src/schemas/contextDocumentSchema.tsx.html +253 -0
  290. package/src/coverage/src/schemas/index.html +176 -0
  291. package/src/coverage/src/schemas/index.ts.html +277 -0
  292. package/src/coverage/src/schemas/serialize/SchemTypeTool.tsx.html +391 -0
  293. package/src/coverage/src/schemas/serialize/index.html +146 -0
  294. package/src/coverage/src/schemas/serialize/schemaUtils.ts.html +196 -0
  295. package/src/coverage/src/schemas/serialize/serializeSchema.ts.html +754 -0
  296. package/src/coverage/src/schemas/serializedSchemaTypeSchema.ts.html +262 -0
  297. package/src/coverage/src/schemas/typeDefExtensions.ts.html +397 -0
  298. package/src/coverage/src/translate/FieldTranslationProvider.tsx.html +1003 -0
  299. package/src/coverage/src/translate/getLanguageParams.ts.html +163 -0
  300. package/src/coverage/src/translate/index.html +191 -0
  301. package/src/coverage/src/translate/languageStore.ts.html +139 -0
  302. package/src/coverage/src/translate/paths.ts.html +577 -0
  303. package/src/coverage/src/translate/translateActions.tsx.html +637 -0
  304. package/src/coverage/src/translate/types.ts.html +565 -0
  305. package/src/coverage/src/types.ts.html +649 -0
  306. package/src/coverage/src/useApiClient.ts.html +1015 -0
  307. package/src/fieldActions/assistFieldActions.tsx +42 -13
  308. package/src/fieldActions/generateCaptionActions.tsx +2 -2
  309. package/src/fieldActions/generateImageActions.tsx +57 -0
  310. package/src/helpers/assistSupported.ts +10 -16
  311. package/src/helpers/conditionalMembers.test.ts +200 -0
  312. package/src/helpers/conditionalMembers.ts +127 -0
  313. package/src/helpers/typeUtils.ts +19 -5
  314. package/src/index.ts +3 -0
  315. package/src/node_modules/.vitest/deps/_metadata.json +8 -0
  316. package/src/node_modules/.vitest/deps/package.json +3 -0
  317. package/src/node_modules/.vitest/results.json +1 -0
  318. package/src/plugin.tsx +14 -5
  319. package/src/presence/AssistAvatar.tsx +1 -1
  320. package/src/schemas/assistDocumentSchema.tsx +40 -1
  321. package/src/schemas/serialize/serializeSchema.test.ts +239 -8
  322. package/src/schemas/serialize/serializeSchema.ts +77 -10
  323. package/src/schemas/typeDefExtensions.ts +89 -5
  324. package/src/translate/FieldTranslationProvider.tsx +306 -0
  325. package/src/translate/getLanguageParams.ts +26 -0
  326. package/src/translate/languageStore.ts +18 -0
  327. package/src/translate/paths.test.ts +133 -0
  328. package/src/translate/paths.ts +175 -0
  329. package/src/translate/translateActions.tsx +186 -0
  330. package/src/translate/types.ts +160 -0
  331. package/src/types.ts +33 -12
  332. package/src/useApiClient.ts +130 -2
  333. package/src/assistLayout/AlphaMigration.tsx +0 -310
  334. package/src/legacy-types.ts +0 -72
@@ -1,310 +0,0 @@
1
- import {SanityClient, SanityDocument, useClient} from 'sanity'
2
- import {useCallback, useEffect, useState} from 'react'
3
- import {Box, Button, Card, Dialog, Spinner, Stack, Text, useToast} from '@sanity/ui'
4
- import {CheckmarkIcon} from '@sanity/icons'
5
- import {
6
- LegacyAssistDocument,
7
- legacyAssistDocumentIdPrefix,
8
- legacyAssistDocumentTypeName,
9
- legacyAssistStatusDocumentTypeName,
10
- LegacyContextBlock,
11
- legacyContextDocumentTypeName,
12
- LegacyFieldRef,
13
- LegacyPromptBlock,
14
- LegacyPromptTextBlock,
15
- LegacyUserInputBlock,
16
- } from '../legacy-types'
17
- import {assistDocumentId} from '../helpers/ids'
18
- import {
19
- assistDocumentIdPrefix,
20
- assistDocumentTypeName,
21
- AssistField,
22
- assistFieldTypeName,
23
- contextDocumentTypeName,
24
- fieldReferenceTypeName,
25
- InlinePromptBlock,
26
- instructionContextTypeName,
27
- instructionTypeName,
28
- PromptBlock,
29
- userInputTypeName,
30
- } from '../types'
31
- import {PortableTextSpan} from '@portabletext/types'
32
- import {pluginTitle} from '../constants'
33
-
34
- const NO_ASSIST_DOCS: LegacyAssistDocument[] = []
35
- const NO_CONTEXT_DOCS: SanityDocument[] = []
36
- const NO_IDS: string[] = []
37
-
38
- interface MigratedContextDoc {
39
- _id: string
40
- _alphaId: string
41
- }
42
-
43
- type Task = (subtaskProgress: (percentage: number) => void) => Promise<void>
44
-
45
- export function AlphaMigration() {
46
- const [alphaAssistDocs, setAlphaAssistDocs] = useState(NO_ASSIST_DOCS)
47
- const [contextDocs, setContextDocs] = useState(NO_CONTEXT_DOCS)
48
- const [staleStatusDocIds, setStaleStatusDocs] = useState(NO_IDS)
49
- const [error, setError] = useState<Error | undefined>(undefined)
50
- const [progress, setProgress] = useState<number | undefined>(undefined)
51
- const toast = useToast()
52
- const client = useClient({apiVersion: '2023-06-01'})
53
-
54
- useEffect(() => {
55
- let canUpdate = true
56
- client
57
- .fetch<{
58
- assistDocs?: LegacyAssistDocument[]
59
- staleStatusDocIds?: string[]
60
- contextDocs?: SanityDocument[]
61
- }>(
62
- `
63
- {
64
- "assistDocs": *[_type=="${legacyAssistDocumentTypeName}"],
65
- "staleStatusDocIds": *[_type=="${legacyAssistStatusDocumentTypeName}"]._id,
66
- "contextDocs": *[_type=="${legacyContextDocumentTypeName}"],
67
- }
68
- `
69
- )
70
- .then((result) => {
71
- if (!canUpdate || !result) {
72
- return
73
- }
74
- setAlphaAssistDocs(result?.assistDocs ?? NO_ASSIST_DOCS)
75
- setStaleStatusDocs(result?.staleStatusDocIds ?? NO_IDS)
76
- setContextDocs(result?.contextDocs ?? NO_CONTEXT_DOCS)
77
- })
78
- return () => {
79
- canUpdate = false
80
- }
81
- }, [client, setAlphaAssistDocs, setStaleStatusDocs, setContextDocs])
82
-
83
- const convert = useCallback(async () => {
84
- try {
85
- setProgress(0.0001)
86
-
87
- const tasks: Task[] = [
88
- () => convertContextDocs(client, contextDocs),
89
- (subtaskProgress) => deleteDocs(client, staleStatusDocIds, subtaskProgress),
90
- (subtaskProgress) => convertDocs(client, alphaAssistDocs, subtaskProgress),
91
- (subtaskProgress) =>
92
- deleteDocs(
93
- client,
94
- contextDocs.map((d) => d._id),
95
- subtaskProgress
96
- ),
97
- ]
98
-
99
- const taskSize = 1 / tasks.length
100
- for (let i = 0; i < tasks.length; i++) {
101
- const startProgress = i / tasks.length
102
- await tasks[i]((subProgress) => setProgress(startProgress + subProgress * taskSize))
103
- setProgress((i + 1) / tasks.length)
104
- }
105
-
106
- setProgress(1)
107
- setAlphaAssistDocs(NO_ASSIST_DOCS)
108
- setContextDocs(NO_CONTEXT_DOCS)
109
- setStaleStatusDocs(NO_IDS)
110
- toast.push({
111
- title: `Converted instructions to new format.`,
112
- status: 'success',
113
- closable: true,
114
- })
115
- } catch (e: any) {
116
- console.error(e)
117
- toast.push({
118
- title: `An error occurred`,
119
- status: 'error',
120
- closable: true,
121
- })
122
- setError(e)
123
- setProgress(undefined)
124
- }
125
- }, [contextDocs, client, alphaAssistDocs, staleStatusDocIds, setProgress, toast])
126
-
127
- if (
128
- (alphaAssistDocs.length || staleStatusDocIds.length || contextDocs.length) &&
129
- (!progress || progress < 1)
130
- ) {
131
- return (
132
- <Dialog id="outdated-assist-docs" header={pluginTitle}>
133
- <Card padding={3}>
134
- <Stack space={4} style={{maxWidth: 500}}>
135
- <Text size={1}>
136
- It seems like this workspace contains documents from an{' '}
137
- <strong>older version of {pluginTitle}</strong>.
138
- </Text>
139
- <Text size={1}>Cleanup is required.</Text>
140
- {error ? (
141
- <Card padding={2} tone="critical" border>
142
- <Text size={1}>An error occurred. See console for details.</Text>{' '}
143
- </Card>
144
- ) : null}
145
- <Button
146
- icon={
147
- progress ? (
148
- <Box style={{marginTop: 5}}>
149
- <Spinner />
150
- </Box>
151
- ) : (
152
- CheckmarkIcon
153
- )
154
- }
155
- disabled={!!progress}
156
- text={progress ? `${Math.floor(progress * 100)}%` : 'Ok, convert to new format!'}
157
- tone="primary"
158
- onClick={convert}
159
- />
160
- </Stack>
161
- </Card>
162
- </Dialog>
163
- )
164
- }
165
-
166
- return null
167
- }
168
-
169
- async function deleteDocs(
170
- client: SanityClient,
171
- ids: string[],
172
- updateProgress: (percentage: number) => void
173
- ) {
174
- const chunkSize = 50
175
- for (let i = 0; i < ids.length; i += chunkSize) {
176
- const progressCount = Math.min(ids.length, i + chunkSize)
177
- const chunk = ids.slice(i, progressCount)
178
- const trans = client.transaction()
179
- chunk.forEach((id) => trans.delete(id))
180
- await trans.commit()
181
- updateProgress(progressCount / ids.length)
182
- }
183
- }
184
-
185
- async function convertContextDocs(client: SanityClient, docs: SanityDocument[]) {
186
- const trans = client.transaction()
187
-
188
- for (const doc of docs) {
189
- const {_id, _type, ...rest} = doc
190
- trans.createOrReplace({
191
- ...rest,
192
- _id: `port.${_id}`,
193
- _alphaId: _id,
194
- _type: contextDocumentTypeName,
195
- })
196
- }
197
-
198
- await trans.commit()
199
- }
200
-
201
- async function convertDocs(
202
- client: SanityClient,
203
- docs: LegacyAssistDocument[],
204
- updateProgress: (percentage: number) => void
205
- ) {
206
- const chunkSize = 10
207
- for (let i = 0; i < docs.length; i += chunkSize) {
208
- const progressCount = Math.min(docs.length, i + chunkSize)
209
- const chunk = docs.slice(i, progressCount)
210
-
211
- const trans = client.transaction()
212
- const contextDocs: MigratedContextDoc[] = await client.fetch(
213
- `*[_type=="${contextDocumentTypeName}" && _alphaId != null]{_id, _alphaId}`
214
- )
215
-
216
- chunk.forEach((oldDoc) => {
217
- const documentType = oldDoc._id.replace(
218
- new RegExp(`^(${legacyAssistDocumentIdPrefix}|${assistDocumentIdPrefix})`),
219
- ''
220
- )
221
-
222
- const id = assistDocumentId(documentType)
223
-
224
- const fields: AssistField[] = (oldDoc.fields ?? [])
225
- .filter((field) => field.instructions?.length)
226
- .map((oldField) => {
227
- const instructions = (oldField.instructions ?? []).map((inst) => {
228
- // eslint-disable-next-line max-nested-callbacks
229
- const prompt = (inst.prompt ?? []).map((block) => {
230
- return mapBlock(block, contextDocs) as PromptBlock
231
- })
232
- return {
233
- ...inst,
234
- _type: instructionTypeName,
235
- prompt,
236
- }
237
- })
238
- return {
239
- ...oldField,
240
- _type: assistFieldTypeName,
241
- instructions,
242
- }
243
- })
244
-
245
- if (fields.length) {
246
- trans.createOrReplace({
247
- _id: id,
248
- _type: assistDocumentTypeName,
249
- fields,
250
- })
251
- }
252
- trans.delete(oldDoc._id)
253
- })
254
- await trans.commit()
255
- updateProgress(progressCount / docs.length)
256
- }
257
- }
258
-
259
- type Blocks = LegacyPromptBlock | LegacyPromptTextBlock | PortableTextSpan
260
-
261
- function isFieldRef(block: Blocks): block is LegacyFieldRef {
262
- return block._type === 'sanity.ai.prompt.fieldRef'
263
- }
264
-
265
- function isContext(block: Blocks): block is LegacyContextBlock {
266
- return block._type === 'sanity.ai.prompt.context'
267
- }
268
-
269
- function isUserInput(block: Blocks): block is LegacyUserInputBlock {
270
- return block._type === 'sanity.ai.prompt.userInput'
271
- }
272
-
273
- function isSpan(block: Blocks): block is PortableTextSpan {
274
- return block._type === 'span'
275
- }
276
-
277
- function mapBlock(
278
- block: Blocks,
279
- migratedContexts: MigratedContextDoc[]
280
- ): PromptBlock | InlinePromptBlock {
281
- if (isFieldRef(block)) {
282
- return {...block, _type: fieldReferenceTypeName}
283
- }
284
- if (isUserInput(block)) {
285
- return {...block, _type: userInputTypeName}
286
- }
287
- if (isContext(block)) {
288
- const newBlock = {
289
- ...block,
290
- _type: instructionContextTypeName,
291
- reference: {
292
- _type: 'reference',
293
- _ref:
294
- migratedContexts.find((c) => c._alphaId === block.reference?._ref)?._id ??
295
- block.reference?._ref,
296
- },
297
- } as const
298
- return newBlock
299
- }
300
- if (isSpan(block)) {
301
- return block
302
- }
303
- const textBlock = block
304
- return {
305
- ...textBlock,
306
- children: (textBlock.children ?? []).map(
307
- (child) => mapBlock(child, migratedContexts) as InlinePromptBlock
308
- ),
309
- }
310
- }
@@ -1,72 +0,0 @@
1
- import {SanityDocument} from 'sanity'
2
- import {PortableTextBlock, PortableTextMarkDefinition, PortableTextSpan} from '@portabletext/types'
3
-
4
- //id prefixes
5
- export const legacyAssistDocumentIdPrefix = 'sanity.ai.'
6
-
7
- export const legacyAssistDocumentTypeName = 'sanity.ai.docType' as const
8
- const aiFieldTypeName = 'sanity.ai.docType.field' as const
9
- const instructionTypeName = 'sanity.ai.field.instruction' as const
10
-
11
- const userInputTypeName = 'sanity.ai.prompt.userInput' as const
12
- const promptContextTypeName = 'sanity.ai.prompt.context' as const
13
- const fieldReferenceTypeName = 'sanity.ai.prompt.fieldRef' as const
14
-
15
- export const legacyContextDocumentTypeName = 'ai.instruction.context' as const
16
-
17
- export const legacyAssistStatusDocumentTypeName = 'sanity.ai.instructionStatus' as const
18
-
19
- export interface FieldPrompts {
20
- _key: string
21
- _type: typeof aiFieldTypeName
22
- path?: string
23
- instructions?: LegacyInstruction[]
24
- }
25
-
26
- export interface LegacyAssistDocument extends SanityDocument {
27
- fields: FieldPrompts[]
28
- }
29
-
30
- export interface LegacyFieldRef extends PortableTextMarkDefinition {
31
- _type: typeof fieldReferenceTypeName
32
- path?: string
33
- }
34
-
35
- export interface LegacyContextBlock {
36
- _type: typeof promptContextTypeName
37
- reference?: {
38
- _type: 'reference'
39
- _ref?: string
40
- }
41
- }
42
-
43
- export interface LegacyUserInputBlock {
44
- _type: typeof userInputTypeName
45
- _key: string
46
- message?: string
47
- description?: string
48
- }
49
-
50
- export type LegacyPromptTextBlock = PortableTextBlock<
51
- never,
52
- PortableTextSpan | LegacyFieldRef | LegacyUserInputBlock | LegacyContextBlock,
53
- 'normal',
54
- never
55
- >
56
-
57
- export type LegacyPromptBlock =
58
- | LegacyPromptTextBlock
59
- | LegacyFieldRef
60
- | LegacyContextBlock
61
- | LegacyUserInputBlock
62
-
63
- export interface LegacyInstruction {
64
- _key: string
65
- _type: typeof instructionTypeName
66
- prompt?: LegacyPromptBlock[]
67
-
68
- icon?: string
69
- userId?: string
70
- title?: string
71
- placeholder?: string
72
- }