@blocklet/pages-kit 0.2.299 → 0.2.301

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 (253) hide show
  1. package/lib/cjs/builtin/async/ai-runtime/api/{assistant.js → agent.js} +5 -7
  2. package/lib/cjs/builtin/async/ai-runtime/api/session.js +20 -18
  3. package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +1 -2
  4. package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +2 -2
  5. package/lib/cjs/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +5 -2
  6. package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormHeader.js → Header/SimpleHeader.js} +9 -16
  7. package/lib/cjs/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +6 -8
  8. package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer.js +2 -2
  9. package/lib/cjs/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +2 -2
  10. package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +40 -57
  11. package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +8 -3
  12. package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
  13. package/lib/cjs/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
  14. package/lib/cjs/builtin/async/ai-runtime/constants.js +4 -1
  15. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +4 -4
  16. package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +32 -0
  17. package/lib/cjs/builtin/async/ai-runtime/index.js +16 -63
  18. package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +72 -0
  19. package/lib/cjs/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +11 -7
  20. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
  21. package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +7 -4
  22. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
  23. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +6 -6
  24. package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
  25. package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +102 -0
  26. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
  27. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
  28. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
  29. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.js +25 -12
  30. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +12 -12
  31. package/lib/cjs/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
  32. package/lib/cjs/builtin/async/ai-runtime/state/session.js +91 -92
  33. package/lib/esm/builtin/async/ai-runtime/api/{assistant.js → agent.js} +3 -5
  34. package/lib/esm/builtin/async/ai-runtime/api/session.js +19 -17
  35. package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +1 -1
  36. package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.js +1 -1
  37. package/lib/esm/builtin/async/ai-runtime/components/{GlobalLoading.js → GlobalLoading/index.js} +2 -1
  38. package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +23 -0
  39. package/lib/esm/builtin/async/ai-runtime/components/{runtime-form/RuntimeFormSubmit.js → Layout/SimpleLayout.js} +5 -4
  40. package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer.js +1 -1
  41. package/lib/esm/builtin/async/ai-runtime/components/{RuntimeProvider.js → RuntimeCommonProvider.js} +1 -1
  42. package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +19 -57
  43. package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +8 -3
  44. package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -21
  45. package/lib/esm/builtin/async/ai-runtime/components/{common/UserInfo.js → UserInfo.js} +1 -1
  46. package/lib/esm/builtin/async/ai-runtime/constants.js +3 -0
  47. package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.js +3 -3
  48. package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +26 -0
  49. package/lib/esm/builtin/async/ai-runtime/index.js +13 -58
  50. package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +66 -0
  51. package/lib/esm/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.js +9 -5
  52. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.js +4 -4
  53. package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.js +2 -2
  54. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.js +2 -2
  55. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.js +5 -5
  56. package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.js +1 -1
  57. package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +73 -0
  58. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/PhotoGalleryItem/index.js +17 -8
  59. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleChat/index.js +34 -22
  60. package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.js +5 -3
  61. package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +63 -0
  62. package/lib/esm/builtin/async/ai-runtime/{components/runtime/state/assistant.js → state/agent.js} +9 -9
  63. package/lib/esm/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.js +5 -10
  64. package/lib/esm/builtin/async/ai-runtime/state/session.js +91 -88
  65. package/lib/types/builtin/async/ai-runtime/api/{assistant.d.ts → agent.d.ts} +4 -4
  66. package/lib/types/builtin/async/ai-runtime/api/session.d.ts +7 -13
  67. package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +1 -1
  68. package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/index.d.ts +1 -1
  69. package/lib/types/builtin/async/ai-runtime/components/{GlobalLoading.d.ts → GlobalLoading/index.d.ts} +1 -0
  70. package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +5 -0
  71. package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +2 -0
  72. package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +2 -1
  73. package/lib/types/builtin/async/ai-runtime/components/{RuntimeProvider.d.ts → RuntimeCommonProvider.d.ts} +1 -1
  74. package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +8 -59
  75. package/lib/types/builtin/async/ai-runtime/constants.d.ts +3 -0
  76. package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentAgent.d.ts +1 -1
  77. package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +14 -0
  78. package/lib/types/builtin/async/ai-runtime/index.d.ts +13 -24
  79. package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +5 -0
  80. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +4 -0
  81. package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +1 -0
  82. package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +6 -0
  83. package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +17 -0
  84. package/lib/types/builtin/async/ai-runtime/{components/runtime/state → state}/runtime.d.ts +2 -2
  85. package/lib/types/builtin/async/ai-runtime/state/session.d.ts +10 -18
  86. package/lib/types/builtin/async/react-scroll-to-bottom.d.ts +2 -2
  87. package/package.json +7 -7
  88. package/lib/cjs/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -49
  89. package/lib/cjs/builtin/async/ai-runtime/components/PoweredBy.js +0 -22
  90. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
  91. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
  92. package/lib/cjs/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
  93. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
  94. package/lib/cjs/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
  95. package/lib/cjs/builtin/async/ai-runtime/components/common/ChatBot.js +0 -104
  96. package/lib/cjs/builtin/async/ai-runtime/components/common/index.js +0 -12
  97. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -89
  98. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -66
  99. package/lib/cjs/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -61
  100. package/lib/cjs/builtin/async/ai-runtime/components/form/QuestionField.js +0 -44
  101. package/lib/cjs/builtin/async/ai-runtime/components/form/SettingButton.js +0 -88
  102. package/lib/cjs/builtin/async/ai-runtime/components/lottie/index.js +0 -34
  103. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -35
  104. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -177
  105. package/lib/cjs/builtin/async/ai-runtime/components/message/MessageListView.js +0 -48
  106. package/lib/cjs/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -121
  107. package/lib/cjs/builtin/async/ai-runtime/components/runtime/constants.js +0 -6
  108. package/lib/cjs/builtin/async/ai-runtime/components/runtime/state/session.js +0 -213
  109. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -133
  110. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -60
  111. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -59
  112. package/lib/cjs/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -28
  113. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -138
  114. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -31
  115. package/lib/cjs/builtin/async/ai-runtime/components/runtime-form/index.js +0 -54
  116. package/lib/cjs/builtin/async/ai-runtime/components/session/CheckSession.js +0 -74
  117. package/lib/cjs/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
  118. package/lib/cjs/builtin/async/ai-runtime/hooks/auth.js +0 -31
  119. package/lib/cjs/builtin/async/ai-runtime/hooks/header.js +0 -69
  120. package/lib/cjs/builtin/async/ai-runtime/hooks/navigate.js +0 -38
  121. package/lib/cjs/builtin/async/ai-runtime/hooks/subscribe.js +0 -37
  122. package/lib/cjs/builtin/async/ai-runtime/hooks/useAsync.js +0 -32
  123. package/lib/cjs/builtin/async/ai-runtime/state/assistant.js +0 -59
  124. package/lib/cjs/builtin/async/ai-runtime/state/index.js +0 -423
  125. package/lib/cjs/builtin/async/ai-runtime/state/subscription.js +0 -52
  126. package/lib/cjs/builtin/async/ai-runtime/utils.js +0 -49
  127. package/lib/esm/builtin/async/ai-runtime/components/LoadingListItemButton.js +0 -46
  128. package/lib/esm/builtin/async/ai-runtime/components/PoweredBy.js +0 -19
  129. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionEditDialog.js +0 -92
  130. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionListView.js +0 -197
  131. package/lib/esm/builtin/async/ai-runtime/components/collection/CollectionView.js +0 -122
  132. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentListView.js +0 -152
  133. package/lib/esm/builtin/async/ai-runtime/components/collection/DocumentView.js +0 -135
  134. package/lib/esm/builtin/async/ai-runtime/components/common/ChatBot.js +0 -98
  135. package/lib/esm/builtin/async/ai-runtime/components/common/index.js +0 -3
  136. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterForm.js +0 -60
  137. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormDialog.js +0 -59
  138. package/lib/esm/builtin/async/ai-runtime/components/form/ParameterFormFields.js +0 -54
  139. package/lib/esm/builtin/async/ai-runtime/components/form/QuestionField.js +0 -38
  140. package/lib/esm/builtin/async/ai-runtime/components/form/SettingButton.js +0 -82
  141. package/lib/esm/builtin/async/ai-runtime/components/lottie/index.js +0 -8
  142. package/lib/esm/builtin/async/ai-runtime/components/message/MessageErrorView.js +0 -29
  143. package/lib/esm/builtin/async/ai-runtime/components/message/MessageItemView.js +0 -146
  144. package/lib/esm/builtin/async/ai-runtime/components/message/MessageListView.js +0 -42
  145. package/lib/esm/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.js +0 -92
  146. package/lib/esm/builtin/async/ai-runtime/components/runtime/components/SimplePage/index.js +0 -50
  147. package/lib/esm/builtin/async/ai-runtime/components/runtime/constants.js +0 -3
  148. package/lib/esm/builtin/async/ai-runtime/components/runtime/state/session.js +0 -209
  149. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/InitialForm.js +0 -102
  150. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.js +0 -34
  151. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.js +0 -53
  152. package/lib/esm/builtin/async/ai-runtime/components/runtime-chat/index.js +0 -22
  153. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.js +0 -132
  154. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.js +0 -30
  155. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.js +0 -25
  156. package/lib/esm/builtin/async/ai-runtime/components/runtime-form/index.js +0 -48
  157. package/lib/esm/builtin/async/ai-runtime/components/session/CheckSession.js +0 -68
  158. package/lib/esm/builtin/async/ai-runtime/components/session/SessionListView.js +0 -88
  159. package/lib/esm/builtin/async/ai-runtime/hooks/auth.js +0 -27
  160. package/lib/esm/builtin/async/ai-runtime/hooks/header.js +0 -62
  161. package/lib/esm/builtin/async/ai-runtime/hooks/navigate.js +0 -32
  162. package/lib/esm/builtin/async/ai-runtime/hooks/subscribe.js +0 -33
  163. package/lib/esm/builtin/async/ai-runtime/hooks/useAsync.js +0 -29
  164. package/lib/esm/builtin/async/ai-runtime/state/assistant.js +0 -54
  165. package/lib/esm/builtin/async/ai-runtime/state/index.js +0 -423
  166. package/lib/esm/builtin/async/ai-runtime/state/subscription.js +0 -47
  167. package/lib/esm/builtin/async/ai-runtime/utils.js +0 -42
  168. package/lib/types/builtin/async/ai-runtime/components/LoadingListItemButton.d.ts +0 -5
  169. package/lib/types/builtin/async/ai-runtime/components/PoweredBy.d.ts +0 -4
  170. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionEditDialog.d.ts +0 -0
  171. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionListView.d.ts +0 -0
  172. package/lib/types/builtin/async/ai-runtime/components/collection/CollectionView.d.ts +0 -0
  173. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentListView.d.ts +0 -0
  174. package/lib/types/builtin/async/ai-runtime/components/collection/DocumentView.d.ts +0 -0
  175. package/lib/types/builtin/async/ai-runtime/components/common/ChatBot.d.ts +0 -13
  176. package/lib/types/builtin/async/ai-runtime/components/common/index.d.ts +0 -3
  177. package/lib/types/builtin/async/ai-runtime/components/form/ParameterForm.d.ts +0 -13
  178. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormDialog.d.ts +0 -28
  179. package/lib/types/builtin/async/ai-runtime/components/form/ParameterFormFields.d.ts +0 -11
  180. package/lib/types/builtin/async/ai-runtime/components/form/QuestionField.d.ts +0 -14
  181. package/lib/types/builtin/async/ai-runtime/components/form/SettingButton.d.ts +0 -9
  182. package/lib/types/builtin/async/ai-runtime/components/lottie/index.d.ts +0 -4
  183. package/lib/types/builtin/async/ai-runtime/components/message/MessageErrorView.d.ts +0 -5
  184. package/lib/types/builtin/async/ai-runtime/components/message/MessageItemView.d.ts +0 -15
  185. package/lib/types/builtin/async/ai-runtime/components/message/MessageListView.d.ts +0 -7
  186. package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGallery/index.d.ts +0 -5
  187. package/lib/types/builtin/async/ai-runtime/components/runtime/components/PhotoGalleryItem/index.d.ts +0 -1
  188. package/lib/types/builtin/async/ai-runtime/components/runtime/components/SimpleChat/index.d.ts +0 -3
  189. package/lib/types/builtin/async/ai-runtime/components/runtime/constants.d.ts +0 -3
  190. package/lib/types/builtin/async/ai-runtime/components/runtime/state/assistant.d.ts +0 -17
  191. package/lib/types/builtin/async/ai-runtime/components/runtime/state/session.d.ts +0 -29
  192. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/InitialForm.d.ts +0 -10
  193. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatHeader.d.ts +0 -5
  194. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/RuntimeChatSession.d.ts +0 -6
  195. package/lib/types/builtin/async/ai-runtime/components/runtime-chat/index.d.ts +0 -5
  196. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormForms.d.ts +0 -5
  197. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormHeader.d.ts +0 -5
  198. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormResult.d.ts +0 -5
  199. package/lib/types/builtin/async/ai-runtime/components/runtime-form/RuntimeFormSubmit.d.ts +0 -5
  200. package/lib/types/builtin/async/ai-runtime/components/runtime-form/index.d.ts +0 -4
  201. package/lib/types/builtin/async/ai-runtime/components/session/CheckSession.d.ts +0 -8
  202. package/lib/types/builtin/async/ai-runtime/components/session/SessionListView.d.ts +0 -0
  203. package/lib/types/builtin/async/ai-runtime/hooks/auth.d.ts +0 -4
  204. package/lib/types/builtin/async/ai-runtime/hooks/header.d.ts +0 -5
  205. package/lib/types/builtin/async/ai-runtime/hooks/navigate.d.ts +0 -25
  206. package/lib/types/builtin/async/ai-runtime/hooks/subscribe.d.ts +0 -7
  207. package/lib/types/builtin/async/ai-runtime/hooks/useAsync.d.ts +0 -1
  208. package/lib/types/builtin/async/ai-runtime/state/assistant.d.ts +0 -15
  209. package/lib/types/builtin/async/ai-runtime/state/index.d.ts +0 -0
  210. package/lib/types/builtin/async/ai-runtime/state/subscription.d.ts +0 -15
  211. package/lib/types/builtin/async/ai-runtime/utils.d.ts +0 -20
  212. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
  213. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
  214. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
  215. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
  216. /package/lib/cjs/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
  217. /package/lib/cjs/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
  218. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
  219. /package/lib/cjs/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
  220. /package/lib/cjs/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
  221. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
  222. /package/lib/cjs/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
  223. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.js +0 -0
  224. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.js +0 -0
  225. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.js +0 -0
  226. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.js +0 -0
  227. /package/lib/esm/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.js +0 -0
  228. /package/lib/esm/builtin/async/ai-runtime/{state/loading.js → components/GlobalLoading/state.js} +0 -0
  229. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.js +0 -0
  230. /package/lib/esm/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.js +0 -0
  231. /package/lib/esm/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.js +0 -0
  232. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.js +0 -0
  233. /package/lib/esm/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.js +0 -0
  234. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/LanguageField.d.ts +0 -0
  235. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/NumberField.d.ts +0 -0
  236. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/RadioField.d.ts +0 -0
  237. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/SelectField.d.ts +0 -0
  238. /package/lib/types/builtin/async/ai-runtime/components/{parameters → AgentInputField}/StringField.d.ts +0 -0
  239. /package/lib/types/builtin/async/ai-runtime/{state/loading.d.ts → components/GlobalLoading/state.d.ts} +0 -0
  240. /package/lib/types/builtin/async/ai-runtime/components/{common/UserInfo.d.ts → UserInfo.d.ts} +0 -0
  241. /package/lib/types/builtin/async/ai-runtime/{components/runtime/contexts → contexts}/CurrentMessage.d.ts +0 -0
  242. /package/lib/types/builtin/async/ai-runtime/{components/runtime → runtime/Runtime}/index.d.ts +0 -0
  243. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/AutoForm/index.d.ts +0 -0
  244. /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/MessageActions.d.ts +0 -0
  245. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageErrorView.d.ts +0 -0
  246. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/MessageItemView.d.ts +0 -0
  247. /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageMetadataRenderer.d.ts +0 -0
  248. /package/lib/types/builtin/async/ai-runtime/{components/common → runtime-components/ChatOutput}/MessageSuggestedQuestions.d.ts +0 -0
  249. /package/lib/types/builtin/async/ai-runtime/{components/message → runtime-components/ChatOutput}/ReferenceLinks.d.ts +0 -0
  250. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/ChatOutput/index.d.ts +0 -0
  251. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimpleOutput/index.d.ts +0 -0
  252. /package/lib/types/builtin/async/ai-runtime/{components/runtime/components → runtime-components}/SimplePage/index.d.ts +0 -0
  253. /package/lib/types/builtin/async/ai-runtime/{components/runtime/utils → utils}/map-right.d.ts +0 -0
@@ -1,24 +1,13 @@
1
- import { Assistant } from './api/assistant';
2
- import type { ChatBotProps } from './components/common/ChatBot';
3
- export * from './components/runtime/contexts/CurrentAgent';
4
- export * from './components/runtime/contexts/CurrentMessage';
5
- export * from './components/runtime/state/runtime';
6
- export * from './components/runtime/state/session';
7
- export { default as Runtime } from './components/runtime';
8
- export { default as SimplePage } from './components/runtime/components/SimplePage';
9
- export { default as SimpleChat } from './components/runtime/components/SimpleChat';
10
- export { default as PhotoGallery } from './components/runtime/components/PhotoGallery';
11
- export { default as AutoForm } from './components/runtime/components/AutoForm';
12
- export { default as SimpleOutput } from './components/runtime/components/SimpleOutput';
13
- export { default as ChatOutput } from './components/runtime/components/ChatOutput';
14
- export { default as PhotoGalleryItem } from './components/runtime/components/PhotoGalleryItem';
15
- export default function App(props: {
16
- preload?: {
17
- assistantId: string;
18
- assistant: Assistant;
19
- };
20
- }): import("react/jsx-runtime").JSX.Element;
21
- export declare function AIRuntime({ cacheId }: {
22
- cacheId: string;
23
- }): import("react/jsx-runtime").JSX.Element;
24
- export declare function ChatBot(props: ChatBotProps): import("react/jsx-runtime").JSX.Element;
1
+ export * from './contexts/CurrentAgent';
2
+ export * from './contexts/CurrentMessage';
3
+ export * from './state/runtime';
4
+ export * from './state/session';
5
+ export { default as Runtime } from './runtime/Runtime';
6
+ export { default as ChatBotButton } from './runtime/ChatBotButton';
7
+ export { default as SimplePage } from './runtime-components/SimplePage';
8
+ export { default as SimpleChat } from './runtime-components/SimpleChat';
9
+ export { default as PhotoGallery } from './runtime-components/PhotoGallery';
10
+ export { default as AutoForm } from './runtime-components/AutoForm';
11
+ export { default as SimpleOutput } from './runtime-components/SimpleOutput';
12
+ export { default as ChatOutput } from './runtime-components/ChatOutput';
13
+ export { default as PhotoGalleryItem } from './runtime-components/PhotoGalleryItem';
@@ -0,0 +1,5 @@
1
+ export interface ChatBotProps {
2
+ aid: string;
3
+ working?: boolean;
4
+ }
5
+ export default function ChatBotButton({ aid, working }: ChatBotProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function PhotoGallery({ resultTitle, primaryColor }: {
2
+ resultTitle?: string;
3
+ primaryColor?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function PhotoGalleryItem(): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from 'react';
2
+ import ScrollView from '../../components/ScrollView';
3
+ export default function SimpleChat({ primaryColor, scrollViewProps, }: {
4
+ primaryColor?: string;
5
+ scrollViewProps?: ComponentProps<typeof ScrollView>;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { StoreApi, UseBoundStore } from 'zustand';
2
+ import { Agent } from '../api/agent';
3
+ export interface AgentState {
4
+ loading?: boolean;
5
+ agent?: Agent;
6
+ error?: Error;
7
+ load: () => Promise<void>;
8
+ }
9
+ export declare const createAgentState: ({ aid, working, agent }: {
10
+ aid: string;
11
+ working?: boolean;
12
+ agent?: Agent;
13
+ }) => UseBoundStore<StoreApi<AgentState>>;
14
+ export declare function useAgentState({ aid, working }: {
15
+ aid: string;
16
+ working?: boolean;
17
+ }): readonly [Agent, AgentState];
@@ -1,8 +1,8 @@
1
1
  import { RuntimeOutputAppearancePage } from '@blocklet/ai-runtime/types';
2
2
  export declare function useRuntimeState(): {
3
3
  aid: string;
4
- working: boolean;
5
- agent: import("../../../api/assistant").Assistant;
4
+ working: boolean | undefined;
5
+ agent: import("../api/agent").Agent;
6
6
  appearancePage: RuntimeOutputAppearancePage | undefined;
7
7
  sessionState: import("./session").SessionState;
8
8
  childAgentId: string;
@@ -1,37 +1,29 @@
1
- import { RuntimeOutputVariablesSchema } from '@blocklet/ai-runtime/types';
2
1
  import { StoreApi, UseBoundStore } from 'zustand';
3
2
  import { Message } from '../api/message';
4
3
  import { Session } from '../api/session';
5
4
  export interface MessageItem extends Omit<Message, 'id'> {
5
+ id?: string;
6
6
  loading?: boolean;
7
7
  }
8
8
  export interface SessionState {
9
9
  loading?: boolean;
10
+ loaded?: boolean;
10
11
  running?: boolean;
11
12
  session?: Session;
12
13
  messages?: MessageItem[];
14
+ noMoreMessage?: boolean;
15
+ messageLoading?: boolean;
13
16
  error?: Error;
14
- metadata?: RuntimeOutputVariablesSchema;
15
- updateSession: ({ parameters }: {
16
- parameters: any;
17
- }) => Promise<void>;
17
+ reset: () => void;
18
18
  load: () => Promise<void>;
19
+ loadMoreMessages: () => Promise<void>;
19
20
  execute: (options: {
20
- assistantId: string;
21
+ aid: string;
22
+ working?: boolean;
21
23
  parameters: any;
22
24
  onResponseStart?: () => void;
23
- includeSessionParameters?: boolean;
24
25
  }) => Promise<void>;
25
26
  }
26
- export declare const createSessionState: ({ sessionId, session }: {
27
- sessionId: string;
28
- session?: Session;
27
+ export declare const createSessionState: ({ aid }: {
28
+ aid: string;
29
29
  }) => UseBoundStore<StoreApi<SessionState>>;
30
- export declare function useSessionState(options: {
31
- sessionId: string;
32
- required: true;
33
- }): [Session, SessionState];
34
- export declare function useSessionState(options: {
35
- sessionId: string;
36
- required?: false;
37
- }): [Session | undefined, SessionState];
@@ -9,7 +9,7 @@ declare const _default: () => Promise<{
9
9
  debug?: boolean | undefined;
10
10
  followButtonClassName?: string | undefined;
11
11
  initialScrollBehavior?: "auto" | "smooth" | undefined;
12
- mode?: "bottom" | "top" | undefined;
12
+ mode?: "top" | "bottom" | undefined;
13
13
  nonce?: string | undefined;
14
14
  scroller?: ((values: {
15
15
  maxValue: number;
@@ -34,7 +34,7 @@ declare const _default: () => Promise<{
34
34
  useAtEnd(): [boolean];
35
35
  useAtStart(): [boolean];
36
36
  useAtTop(): [boolean];
37
- useMode(): ["bottom" | "top"];
37
+ useMode(): ["top" | "bottom"];
38
38
  useSticky(): [boolean];
39
39
  FunctionContext: import("react").Context<{
40
40
  scrollTo: (scrollTop: number | "100%") => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/pages-kit",
3
- "version": "0.2.299",
3
+ "version": "0.2.301",
4
4
  "description": "Pages Kit components and utils",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -81,9 +81,9 @@
81
81
  "url": "git+https://github.com/blocklet/pages-kit.git"
82
82
  },
83
83
  "dependencies": {
84
- "@arcblock/did-connect": "^2.9.76",
85
- "@blocklet/ai-kit": "^0.1.29",
86
- "@blocklet/ai-runtime": "^0.1.365",
84
+ "@arcblock/did-connect": "^2.9.77",
85
+ "@blocklet/ai-kit": "^0.1.30",
86
+ "@blocklet/ai-runtime": "^0.1.375",
87
87
  "@blocklet/js-sdk": "1.16.26",
88
88
  "@blocklet/sdk": "^1.16.26",
89
89
  "@iconify/react": "^4.1.1",
@@ -99,7 +99,7 @@
99
99
  "react-error-boundary": "^4.0.13",
100
100
  "react-frame-component": "^5.2.6",
101
101
  "react-helmet": "^6.1.0",
102
- "react-hook-form": "^7.51.3",
102
+ "react-hook-form": "^7.51.4",
103
103
  "react-markdown": "^9.0.1",
104
104
  "react-scroll-to-bottom": "^4.2.0",
105
105
  "react-share": "^5.1.0",
@@ -123,14 +123,14 @@
123
123
  "react-router-dom": "^6.16.0"
124
124
  },
125
125
  "devDependencies": {
126
- "@arcblock/ux": "^2.9.76",
126
+ "@arcblock/ux": "^2.9.77",
127
127
  "@emotion/cache": "^11.11.0",
128
128
  "@emotion/css": "^11.11.2",
129
129
  "@emotion/react": "^11.11.4",
130
130
  "@mui/icons-material": "^5.15.16",
131
131
  "@mui/lab": "^5.0.0-alpha.170",
132
132
  "@mui/material": "^5.15.16",
133
- "@types/lodash": "^4.17.0",
133
+ "@types/lodash": "^4.17.1",
134
134
  "@types/mustache": "^4.2.5",
135
135
  "@types/node-fetch": "^2.6.11",
136
136
  "@types/react": "^18.3.1",
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- const jsx_runtime_1 = require("react/jsx-runtime");
24
- const material_1 = require("@mui/material");
25
- const react_1 = require("react");
26
- function LoadingListItemButton(_a) {
27
- var { children, confirmation } = _a, props = __rest(_a, ["children", "confirmation"]);
28
- const [clicked, setClicked] = (0, react_1.useState)(false);
29
- const [loading, setLoading] = (0, react_1.useState)(false);
30
- const handleClick = (e) => __awaiter(this, void 0, void 0, function* () {
31
- var _b;
32
- if (loading)
33
- return;
34
- if (!clicked && confirmation) {
35
- setClicked(true);
36
- return;
37
- }
38
- try {
39
- setLoading(true);
40
- yield ((_b = props.onClick) === null || _b === void 0 ? void 0 : _b.call(props, e));
41
- }
42
- finally {
43
- setClicked(false);
44
- setLoading(false);
45
- }
46
- });
47
- return ((0, jsx_runtime_1.jsxs)(material_1.ListItemButton, Object.assign({}, props, { onClick: handleClick, sx: Object.assign(Object.assign({}, props.sx), { display: 'flex', alignItems: 'center', gap: 1 }), children: [(clicked && confirmation) || children, (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", sx: { width: 18 }, children: loading && (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 14 }) })] })));
48
- }
49
- exports.default = LoadingListItemButton;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- const jsx_runtime_1 = require("react/jsx-runtime");
15
- const material_1 = require("@mui/material");
16
- const locale_1 = require("../../../locale");
17
- function PoweredBy(_a) {
18
- var { assistantId } = _a, props = __rest(_a, ["assistantId"]);
19
- const { t } = (0, locale_1.useLocaleContext)();
20
- return ((0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ py: 0.5 }, props, { children: (0, jsx_runtime_1.jsx)(material_1.Stack, { className: "ai-chat-powered-by", direction: "row", justifyContent: "center", children: (0, jsx_runtime_1.jsxs)(material_1.Typography, { variant: "caption", sx: { display: 'inline-flex', alignItems: 'center', a: { display: 'inline-flex', alignItems: 'center' } }, children: [(0, jsx_runtime_1.jsxs)(material_1.Typography, { component: "span", fontSize: 12, color: "text.poweredBy", children: [t('poweredBy'), ' '] }), "\u00A0", (0, jsx_runtime_1.jsxs)(material_1.Link, { href: "https://www.arcblock.io", target: "_blank", color: "text.poweredBy", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", src: "https://www.arcblock.io/.well-known/service/blocklet/logo", sx: { height: 16, verticalAlign: 'middle', mr: 0.5, borderRadius: 0.5 } }), "ArcBlock"] }), "\u00A0\u00B7\u00A0", (0, jsx_runtime_1.jsxs)(material_1.Link, { href: "https://www.aigne.io", target: "_blank", color: "text.poweredBy", children: [(0, jsx_runtime_1.jsx)(material_1.Box, { component: "img", src: "https://www.aigne.io/.well-known/service/blocklet/logo", sx: { height: 16, verticalAlign: 'middle', mr: 0.5, borderRadius: 0.5 } }), "AIGNE"] })] }) }) })));
21
- }
22
- exports.default = PoweredBy;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- // import { Icon } from '@iconify/react';
3
- // import {
4
- // Button,
5
- // Dialog,
6
- // DialogActions,
7
- // DialogContent,
8
- // DialogProps,
9
- // DialogTitle,
10
- // Stack,
11
- // TextField,
12
- // Typography,
13
- // } from '@mui/material';
14
- // import { useEffect } from 'react';
15
- // import { useForm } from 'react-hook-form';
16
- // import { useLocaleContext } from '../../../../locale';
17
- // import LoadingButton from '../LoadingButton';
18
- // export default function CollectionEditDialog({
19
- // DialogProps,
20
- // onSubmit,
21
- // defaultValues,
22
- // }: {
23
- // DialogProps?: DialogProps;
24
- // onSubmit?: () => any;
25
- // defaultValues?: any;
26
- // }) {
27
- // const { t } = useLocaleContext();
28
- // const form = useForm();
29
- // useEffect(() => {
30
- // if (DialogProps?.open) {
31
- // form.reset({
32
- // id: defaultValues?.id,
33
- // name: defaultValues?.name || '',
34
- // description: defaultValues?.description || '',
35
- // });
36
- // }
37
- // }, [DialogProps?.open]);
38
- // const isUpdate = !!form.watch('id');
39
- // return (
40
- // <Dialog
41
- // {...DialogProps}
42
- // open={DialogProps?.open || false}
43
- // fullWidth
44
- // maxWidth="sm"
45
- // component="form"
46
- // onSubmit={form.handleSubmit(onSubmit)}>
47
- // <DialogTitle>{t(isUpdate ? 'editObject' : 'newObject', { object: t('collection') })}</DialogTitle>
48
- // <DialogContent dividers>
49
- // <Stack gap={2.5}>
50
- // <Stack gap={0.5}>
51
- // <Typography sx={{ fontWeight: 500 }}>{t('name')}</Typography>
52
- // <TextField
53
- // size="small"
54
- // fullWidth
55
- // hiddenLabel
56
- // autoFocus
57
- // placeholder={t('name')}
58
- // {...form.register('name')}
59
- // />
60
- // </Stack>
61
- // <Stack gap={0.5}>
62
- // <Typography sx={{ fontWeight: 500 }}>{t('description')}</Typography>
63
- // <TextField
64
- // size="small"
65
- // fullWidth
66
- // hiddenLabel
67
- // multiline
68
- // placeholder={t('description')}
69
- // minRows={3}
70
- // {...form.register('description')}
71
- // />
72
- // </Stack>
73
- // </Stack>
74
- // </DialogContent>
75
- // <DialogActions>
76
- // <Button variant="outlined" color="black" size="small" onClick={DialogProps?.onClose}>
77
- // {t('cancel')}
78
- // </Button>
79
- // <LoadingButton
80
- // variant="contained"
81
- // type="submit"
82
- // color="black"
83
- // size="small"
84
- // startIcon={<Icon icon={isUpdate ? 'tabler:device-floppy' : 'tabler:plus'} />}
85
- // loadingPosition="start"
86
- // loading={form.formState.isSubmitting}>
87
- // {t(isUpdate ? 'save' : 'create')}
88
- // </LoadingButton>
89
- // </DialogActions>
90
- // </Dialog>
91
- // );
92
- // }
@@ -1,197 +0,0 @@
1
- "use strict";
2
- // import { Icon } from '@iconify/react';
3
- // import {
4
- // Box,
5
- // Button,
6
- // CircularProgress,
7
- // ClickAwayListener,
8
- // List,
9
- // ListItemButton,
10
- // Paper,
11
- // Popper,
12
- // Stack,
13
- // Typography,
14
- // } from '@mui/material';
15
- // import { useEffect, useState } from 'react';
16
- // import { Link as RouterLink } from 'react-router-dom';
17
- // import { Toast } from '../../../../arcblock/ux';
18
- // import { useLocaleContext } from '../../../../locale';
19
- // import { useSessionContext } from '../../../../session';
20
- // import { Dataset } from '../../api/dataset';
21
- // import { useNavigateTo, useNavigateWithQuery } from '../../hooks/navigate';
22
- // import { createDatasetState } from '../../state';
23
- // import Layout from '../layout';
24
- // import LoadingListItemButton from '../LoadingListItemButton';
25
- // import CollectionEditDialog from './CollectionEditDialog';
26
- // export function CollectionListView({ releaseId }: { releaseId: string }) {
27
- // const { t } = useLocaleContext();
28
- // const { session: authSession } = useSessionContext();
29
- // const datasetState = createDatasetState({ releaseId })();
30
- // const navigate = useNavigateWithQuery();
31
- // useEffect(() => {
32
- // if (!datasetState.list && authSession.user) {
33
- // datasetState.reload();
34
- // }
35
- // }, [authSession.user]);
36
- // const [editTarget, setEditTarget] = useState<Partial<Dataset>>();
37
- // const createCollection = async ({ id, name, description }: { id?: string; name?: string; description?: string }) => {
38
- // try {
39
- // if (id) {
40
- // await datasetState.updateDataset(id, { name, description });
41
- // setEditTarget(undefined);
42
- // } else {
43
- // const dataset = await datasetState.createDataset({ name, description });
44
- // setEditTarget(undefined);
45
- // navigate({ page: 'collection', datasetId: dataset.id });
46
- // }
47
- // } catch (error) {
48
- // Toast.error(error.message);
49
- // console.error('create collection error', error);
50
- // }
51
- // };
52
- // const onEdit = async (item: Dataset) => {
53
- // if (!authSession.user) {
54
- // await new Promise<void>((resolve) => {
55
- // authSession.login(() => resolve());
56
- // });
57
- // }
58
- // setEditTarget(item);
59
- // };
60
- // return (
61
- // <Layout>
62
- // <Stack my={2.5}>
63
- // <Typography component="h1" sx={{ fontSize: 18, lineHeight: '32px', fontWeight: 500, textAlign: 'center' }}>
64
- // {t('collections')}
65
- // </Typography>
66
- // </Stack>
67
- // <CollectionsView releaseId={releaseId} onEdit={onEdit} />
68
- // <CollectionEditDialog
69
- // DialogProps={{ open: !!editTarget, onClose: () => setEditTarget(undefined) }}
70
- // defaultValues={editTarget}
71
- // onSubmit={createCollection}
72
- // />
73
- // </Layout>
74
- // );
75
- // }
76
- // function CollectionsView({ releaseId, onEdit }: { releaseId: string; onEdit?: (dataset?: Dataset) => void }) {
77
- // const { t } = useLocaleContext();
78
- // const datasetState = createDatasetState({ releaseId })();
79
- // const to = useNavigateTo();
80
- // const [menuState, setMenuState] = useState<{
81
- // anchorEl: HTMLElement;
82
- // dataset: Dataset;
83
- // }>();
84
- // return (
85
- // <>
86
- // <Stack
87
- // gap={1.5}
88
- // sx={{
89
- // userSelect: 'none',
90
- // '.item': {
91
- // '.item-content': {
92
- // borderRadius: 1,
93
- // cursor: 'pointer',
94
- // display: 'flex',
95
- // flexDirection: 'row',
96
- // alignItems: 'center',
97
- // gap: 1,
98
- // pl: 2.5,
99
- // pr: 1.5,
100
- // boxShadow: 1,
101
- // bgcolor: 'background.paper',
102
- // '.item-title': {
103
- // py: 1.5,
104
- // },
105
- // },
106
- // '.hover-visible': { display: 'none' },
107
- // '&.active,:hover': {
108
- // '.item-content': {
109
- // boxShadow: 2,
110
- // '.hover-visible': {
111
- // display: 'block',
112
- // },
113
- // },
114
- // },
115
- // },
116
- // }}>
117
- // {!datasetState.list?.length && (
118
- // <Stack alignItems="center" gap={0.5} mt="10vh" mx={3}>
119
- // {datasetState.loading ? (
120
- // <CircularProgress size={24} />
121
- // ) : (
122
- // <>
123
- // <Typography fontSize={18}>📚</Typography>
124
- // <Typography fontSize={12} sx={{ color: 'text.secondary' }}>
125
- // {t('noData', { data: t('collection') })}
126
- // </Typography>
127
- // </>
128
- // )}
129
- // </Stack>
130
- // )}
131
- // {datasetState.list?.map((item) => (
132
- // <Stack
133
- // key={item.id}
134
- // className={`item ${item.id === menuState?.dataset?.id ? 'active' : ''}`}
135
- // component={RouterLink}
136
- // to={to({ page: 'collection', datasetId: item.id })}>
137
- // <Stack className="item-content">
138
- // <Typography className="item-title" noWrap flex={1} fontSize={13} fontWeight={500}>
139
- // {item.name || t('unnamed')}
140
- // </Typography>
141
- // <Box className="hover-visible">
142
- // <Button
143
- // sx={{ minWidth: 28, minHeight: 28, p: 0 }}
144
- // onClick={(e) => {
145
- // e.preventDefault();
146
- // setMenuState({
147
- // anchorEl: e.currentTarget,
148
- // dataset: item,
149
- // });
150
- // }}>
151
- // <Icon icon="mdi:more-horiz" fontSize={18} />
152
- // </Button>
153
- // </Box>
154
- // </Stack>
155
- // </Stack>
156
- // ))}
157
- // <Box textAlign="center">
158
- // <Button onClick={() => onEdit?.({})}>{t('createObject', { object: t('collection') })}</Button>
159
- // </Box>
160
- // </Stack>
161
- // <Popper
162
- // open={Boolean(menuState)}
163
- // anchorEl={menuState?.anchorEl}
164
- // placement="bottom-end"
165
- // sx={{ zIndex: (theme) => theme.zIndex.modal + 1 }}>
166
- // <ClickAwayListener onClickAway={() => setMenuState(undefined)}>
167
- // <Paper
168
- // sx={{
169
- // mx: 1,
170
- // mt: -0.25,
171
- // boxShadow: `0px 8px 16px 0px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08)`,
172
- // }}>
173
- // <List dense sx={{ p: 0.5, '.MuiButtonBase-root': { borderRadius: 1 } }}>
174
- // <ListItemButton
175
- // onClick={async () => {
176
- // if (!menuState?.dataset) return;
177
- // setMenuState(undefined);
178
- // onEdit?.(menuState.dataset);
179
- // }}>
180
- // {t('rename')}
181
- // </ListItemButton>
182
- // <LoadingListItemButton
183
- // sx={{ color: 'error.main' }}
184
- // onClick={async () => {
185
- // if (!menuState?.dataset) return;
186
- // await datasetState.deleteDataset(menuState.dataset.id);
187
- // setMenuState(undefined);
188
- // }}>
189
- // {t('delete')}
190
- // </LoadingListItemButton>
191
- // </List>
192
- // </Paper>
193
- // </ClickAwayListener>
194
- // </Popper>
195
- // </>
196
- // );
197
- // }