@blocklet/pages-kit 0.2.433 → 0.2.434
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.
- package/lib/cjs/builtin/async/ai-runtime.js +17 -0
- package/lib/cjs/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +3 -3
- package/lib/cjs/builtin/{components.js → components/index.js} +1 -1
- package/lib/cjs/components/CustomComponentRenderer/context.js +13 -0
- package/lib/cjs/components/CustomComponentRenderer/index.js +5 -1
- package/lib/cjs/components/CustomComponentRenderer/state.js +20 -6
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/builtin/async/ai-runtime.js +1 -0
- package/lib/esm/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.js → components/LanguageField/index.js} +2 -2
- package/lib/esm/builtin/components/index.js +1 -0
- package/lib/esm/components/CustomComponentRenderer/context.js +9 -0
- package/lib/esm/components/CustomComponentRenderer/index.js +5 -1
- package/lib/esm/components/CustomComponentRenderer/state.js +21 -7
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/types/builtin/async/ai-runtime.d.ts +1 -0
- package/lib/types/builtin/components/index.d.ts +1 -0
- package/lib/types/components/CustomComponentRenderer/context.d.ts +14 -0
- package/lib/types/components/CustomComponentRenderer/index.d.ts +1 -0
- package/lib/types/components/CustomComponentRenderer/state.d.ts +5 -1
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -5
- package/tsconfig.json +1 -1
- package/lib/cjs/builtin/async/ai-runtime/api/agent.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/api/asset.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/api/dataset.js +0 -134
- package/lib/cjs/builtin/async/ai-runtime/api/message.js +0 -46
- package/lib/cjs/builtin/async/ai-runtime/api/request.js +0 -74
- package/lib/cjs/builtin/async/ai-runtime/api/secret.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/api/session.js +0 -137
- package/lib/cjs/builtin/async/ai-runtime/components/ActionButton.js +0 -62
- package/lib/cjs/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -39
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -44
- package/lib/cjs/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -80
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -27
- package/lib/cjs/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -39
- package/lib/cjs/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -21
- package/lib/cjs/builtin/async/ai-runtime/components/LoadingButton.js +0 -40
- package/lib/cjs/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -146
- package/lib/cjs/builtin/async/ai-runtime/components/MenuButton.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -22
- package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -49
- package/lib/cjs/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -68
- package/lib/cjs/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/components/ScrollView.js +0 -92
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -6
- package/lib/cjs/builtin/async/ai-runtime/components/ShareActions/index.js +0 -255
- package/lib/cjs/builtin/async/ai-runtime/components/SocialShare.js +0 -108
- package/lib/cjs/builtin/async/ai-runtime/components/ThemeProvider.js +0 -191
- package/lib/cjs/builtin/async/ai-runtime/components/UserInfo.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/constants.js +0 -43
- package/lib/cjs/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -27
- package/lib/cjs/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -31
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -18
- package/lib/cjs/builtin/async/ai-runtime/contexts/Identity.js +0 -36
- package/lib/cjs/builtin/async/ai-runtime/contexts/Runtime.js +0 -52
- package/lib/cjs/builtin/async/ai-runtime/error.js +0 -10
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-appearances.js +0 -109
- package/lib/cjs/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -50
- package/lib/cjs/builtin/async/ai-runtime/index.js +0 -83
- package/lib/cjs/builtin/async/ai-runtime/locales/index.js +0 -237
- package/lib/cjs/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -116
- package/lib/cjs/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -138
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -19
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -186
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -11
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -24
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -85
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -64
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -30
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -46
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -2
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -65
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -150
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -26
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -16
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -38
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -42
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -94
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -79
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -34
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -45
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -28
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -82
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -69
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -55
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -54
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -189
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -252
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -300
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -158
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -60
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -153
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -80
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -25
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -68
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -56
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -12
- package/lib/cjs/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -13
- package/lib/cjs/builtin/async/ai-runtime/state/agent.js +0 -58
- package/lib/cjs/builtin/async/ai-runtime/state/runtime.js +0 -48
- package/lib/cjs/builtin/async/ai-runtime/state/session.js +0 -415
- package/lib/cjs/builtin/async/ai-runtime/utils/agent-inputs.js +0 -14
- package/lib/cjs/builtin/async/ai-runtime/utils/download-image.js +0 -40
- package/lib/cjs/builtin/async/ai-runtime/utils/fonts.js +0 -35
- package/lib/cjs/builtin/async/ai-runtime/utils/map-right.js +0 -10
- package/lib/cjs/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -7
- package/lib/cjs/builtin/async/ai-runtime/utils/zustand.js +0 -9
- package/lib/esm/builtin/async/ai-runtime/api/agent.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/api/asset.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/api/dataset.js +0 -121
- package/lib/esm/builtin/async/ai-runtime/api/message.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/api/request.js +0 -68
- package/lib/esm/builtin/async/ai-runtime/api/secret.js +0 -21
- package/lib/esm/builtin/async/ai-runtime/api/session.js +0 -128
- package/lib/esm/builtin/async/ai-runtime/components/ActionButton.js +0 -56
- package/lib/esm/builtin/async/ai-runtime/components/AgentErrorBoundary.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/BooleanField.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/NumberField.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/RadioField.js +0 -37
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/SelectField.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/StringField.js +0 -33
- package/lib/esm/builtin/async/ai-runtime/components/AgentInputField/index.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.js +0 -76
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/index.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/components/GlobalLoading/state.js +0 -36
- package/lib/esm/builtin/async/ai-runtime/components/Header/SimpleHeader.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/components/Layout/SimpleLayout.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/components/LoadingButton.js +0 -38
- package/lib/esm/builtin/async/ai-runtime/components/MarkdownRenderer/index.js +0 -118
- package/lib/esm/builtin/async/ai-runtime/components/MenuButton.js +0 -52
- package/lib/esm/builtin/async/ai-runtime/components/OutputFieldContainer/index.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.js +0 -46
- package/lib/esm/builtin/async/ai-runtime/components/PopperMenuButton/index.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/components/RuntimeCommonProvider.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/components/ScrollView.js +0 -63
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/Community.js +0 -4
- package/lib/esm/builtin/async/ai-runtime/components/ShareActions/index.js +0 -226
- package/lib/esm/builtin/async/ai-runtime/components/SocialShare.js +0 -100
- package/lib/esm/builtin/async/ai-runtime/components/ThemeProvider.js +0 -185
- package/lib/esm/builtin/async/ai-runtime/components/UserInfo.js +0 -47
- package/lib/esm/builtin/async/ai-runtime/constants.js +0 -39
- package/lib/esm/builtin/async/ai-runtime/contexts/ActiveAgent.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/contexts/ComponentPreferences.js +0 -24
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentAgent.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/contexts/CurrentMessage.js +0 -14
- package/lib/esm/builtin/async/ai-runtime/contexts/Identity.js +0 -28
- package/lib/esm/builtin/async/ai-runtime/contexts/Runtime.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/error.js +0 -6
- package/lib/esm/builtin/async/ai-runtime/hooks/use-agent-admin.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/hooks/use-appearances.js +0 -103
- package/lib/esm/builtin/async/ai-runtime/hooks/use-header-menu.js +0 -44
- package/lib/esm/builtin/async/ai-runtime/index.js +0 -37
- package/lib/esm/builtin/async/ai-runtime/locales/index.js +0 -234
- package/lib/esm/builtin/async/ai-runtime/runtime/ChatBotButton/index.js +0 -87
- package/lib/esm/builtin/async/ai-runtime/runtime/Runtime/index.js +0 -19
- package/lib/esm/builtin/async/ai-runtime/runtime-components/AutoForm/index.js +0 -132
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.js +0 -13
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.js +0 -157
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.js +0 -30
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.js +0 -8
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ChatOutput/index.js +0 -18
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.js +0 -56
- package/lib/esm/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.js +0 -58
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ImagesView/index.js +0 -24
- package/lib/esm/builtin/async/ai-runtime/runtime-components/MarkdownView/index.js +0 -7
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.js +0 -1
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.js +0 -59
- package/lib/esm/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.js +0 -144
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.js +0 -20
- package/lib/esm/builtin/async/ai-runtime/runtime-components/ShareView/index.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.js +0 -35
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.js +0 -39
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.js +0 -65
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.js +0 -50
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.js +0 -28
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.js +0 -22
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleChat/index.js +0 -53
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.js +0 -40
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SimplePage/index.js +0 -49
- package/lib/esm/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.js +0 -48
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Input.js +0 -183
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Output.js +0 -246
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/Page.js +0 -294
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.js +0 -149
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.js +0 -55
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/Loading.js +0 -146
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.js +0 -75
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.js +0 -23
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.js +0 -42
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.js +0 -52
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/index.js +0 -3
- package/lib/esm/builtin/async/ai-runtime/runtime-components/V0/utils.js +0 -9
- package/lib/esm/builtin/async/ai-runtime/state/agent.js +0 -55
- package/lib/esm/builtin/async/ai-runtime/state/runtime.js +0 -45
- package/lib/esm/builtin/async/ai-runtime/state/session.js +0 -408
- package/lib/esm/builtin/async/ai-runtime/utils/agent-inputs.js +0 -10
- package/lib/esm/builtin/async/ai-runtime/utils/download-image.js +0 -36
- package/lib/esm/builtin/async/ai-runtime/utils/fonts.js +0 -32
- package/lib/esm/builtin/async/ai-runtime/utils/map-right.js +0 -7
- package/lib/esm/builtin/async/ai-runtime/utils/runtime-output-schema.js +0 -4
- package/lib/esm/builtin/async/ai-runtime/utils/zustand.js +0 -6
- package/lib/esm/builtin/components.js +0 -1
- package/lib/types/builtin/async/ai-runtime/api/agent.d.ts +0 -51
- package/lib/types/builtin/async/ai-runtime/api/asset.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/api/dataset.d.ts +0 -39
- package/lib/types/builtin/async/ai-runtime/api/message.d.ts +0 -35
- package/lib/types/builtin/async/ai-runtime/api/request.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/api/secret.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/api/session.d.ts +0 -61
- package/lib/types/builtin/async/ai-runtime/components/ActionButton.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/components/AgentErrorBoundary.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/BooleanField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/NumberField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/RadioField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/SelectField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/StringField.d.ts +0 -8
- package/lib/types/builtin/async/ai-runtime/components/AgentInputField/index.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/AgentSettings/AgentSettingsDialog.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/GlobalLoading/state.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/Header/SimpleHeader.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/Layout/SimpleLayout.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/LoadingButton.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/components/MarkdownRenderer/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/MenuButton.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/OutputFieldContainer/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/LoadingMenuItem.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/components/PopperMenuButton/index.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/components/RuntimeCommonProvider.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/components/ScrollView.d.ts +0 -10
- package/lib/types/builtin/async/ai-runtime/components/ShareActions/Community.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/ShareActions/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/components/SocialShare.d.ts +0 -20
- package/lib/types/builtin/async/ai-runtime/components/ThemeProvider.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/components/UserInfo.d.ts +0 -18
- package/lib/types/builtin/async/ai-runtime/constants.d.ts +0 -21
- package/lib/types/builtin/async/ai-runtime/contexts/ActiveAgent.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/contexts/ComponentPreferences.d.ts +0 -11
- package/lib/types/builtin/async/ai-runtime/contexts/CurrentAgent.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/contexts/CurrentMessage.d.ts +0 -15
- package/lib/types/builtin/async/ai-runtime/contexts/Identity.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/contexts/Runtime.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/error.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/hooks/use-agent-admin.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/hooks/use-appearances.d.ts +0 -78
- package/lib/types/builtin/async/ai-runtime/hooks/use-header-menu.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/index.d.ts +0 -36
- package/lib/types/builtin/async/ai-runtime/locales/index.d.ts +0 -210
- package/lib/types/builtin/async/ai-runtime/runtime/ChatBotButton/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime/Runtime/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/AutoForm/index.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageErrorView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageItemView.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageMetadataRenderer.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/MessageSuggestedQuestions.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/ReferenceLinks.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/ChatOutput/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchRelatedQuestionsView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/GoogleSearch/GoogleSearchSourcesView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/ImagesView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/MarkdownView/index.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/OpeningQuestionsView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/OutputFieldView/type.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGallery/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/PhotoGalleryItem/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/ReferencedLinksView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/ShareView/index.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/BackgroundImage.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/DrawerOpenCloseIcon.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/InputsView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessageView.d.ts +0 -9
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/MessagesView.d.ts +0 -2
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/OpeningMessageView.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/UserMessageView.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleChat/index.d.ts +0 -16
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimpleOutput/index.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/SimplePage/index.d.ts +0 -6
- package/lib/types/builtin/async/ai-runtime/runtime-components/SuggestedQuestionsView/index.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Input.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Output.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/Page.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/CodePreview.d.ts +0 -20
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/ConfirmDialog.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/Loading.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/PropertiesSetting.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/TransparentTooltip.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/components/UserQuestion.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/contexts/V0Runtime.d.ts +0 -17
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/index.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/runtime-components/V0/utils.d.ts +0 -7
- package/lib/types/builtin/async/ai-runtime/state/agent.d.ts +0 -12
- package/lib/types/builtin/async/ai-runtime/state/runtime.d.ts +0 -14
- package/lib/types/builtin/async/ai-runtime/state/session.d.ts +0 -60
- package/lib/types/builtin/async/ai-runtime/utils/agent-inputs.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/utils/download-image.d.ts +0 -4
- package/lib/types/builtin/async/ai-runtime/utils/fonts.d.ts +0 -5
- package/lib/types/builtin/async/ai-runtime/utils/map-right.d.ts +0 -1
- package/lib/types/builtin/async/ai-runtime/utils/runtime-output-schema.d.ts +0 -3
- package/lib/types/builtin/async/ai-runtime/utils/zustand.d.ts +0 -2
- package/lib/types/builtin/components.d.ts +0 -1
- /package/lib/cjs/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
- /package/lib/esm/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.js +0 -0
- /package/lib/types/builtin/{async/ai-runtime/components/AgentInputField/LanguageField.d.ts → components/LanguageField/index.d.ts} +0 -0
- /package/lib/types/builtin/{async/ai-runtime/utils → components/LanguageField}/languages.d.ts +0 -0
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import Empty from '@arcblock/ux/lib/Empty';
|
|
12
|
-
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
13
|
-
import { Icon } from '@iconify/react';
|
|
14
|
-
import { Masonry } from '@mui/lab';
|
|
15
|
-
import { Box, Button, Chip, Container, IconButton, Stack, ThemeProvider, Tooltip, Typography, createTheme, useTheme, } from '@mui/material';
|
|
16
|
-
import { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
17
|
-
import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
|
|
18
|
-
import { useLocaleContext } from '../../../../locale';
|
|
19
|
-
import { AgentErrorView } from '../../components/AgentErrorBoundary';
|
|
20
|
-
import { useActiveAgent } from '../../contexts/ActiveAgent';
|
|
21
|
-
import CurrentAgentProvider from '../../contexts/CurrentAgent';
|
|
22
|
-
import CurrentMessageProvider from '../../contexts/CurrentMessage';
|
|
23
|
-
import useAppearances from '../../hooks/use-appearances';
|
|
24
|
-
import { useRuntimeState } from '../../state/runtime';
|
|
25
|
-
import { useAutoLoadSessionState, useCurrentSessionState, useSessionState } from '../../state/session';
|
|
26
|
-
import mapRight from '../../utils/map-right';
|
|
27
|
-
import { CodeRenderByMessageMemo as CodeRenderByMessage } from './components/CodePreview';
|
|
28
|
-
import ConfirmDialog from './components/ConfirmDialog';
|
|
29
|
-
import Loading from './components/Loading';
|
|
30
|
-
import UserQuestion from './components/UserQuestion';
|
|
31
|
-
import { V0RuntimeProvider, useV0RuntimeContext } from './contexts/V0Runtime';
|
|
32
|
-
import { getLineClamp } from './utils';
|
|
33
|
-
const sliderWidth = 200;
|
|
34
|
-
function V0Page({ textColor = '#333', primaryColor = '#333' }) {
|
|
35
|
-
const inheritedTheme = useTheme();
|
|
36
|
-
const theme = useMemo(() => {
|
|
37
|
-
let { primary } = inheritedTheme.palette;
|
|
38
|
-
try {
|
|
39
|
-
if (primaryColor) {
|
|
40
|
-
primary = inheritedTheme.palette.augmentColor({ color: { main: primaryColor } });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
console.error('augment primary color error', { error });
|
|
45
|
-
}
|
|
46
|
-
return createTheme(inheritedTheme, {
|
|
47
|
-
palette: { primary, textColor, background: { block: '#f6f6f6' } },
|
|
48
|
-
shape: {
|
|
49
|
-
borderRadius: 8,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
}, [inheritedTheme, primaryColor, textColor]);
|
|
53
|
-
useAutoLoadSessionState({
|
|
54
|
-
autoSetCurrentSessionId: false,
|
|
55
|
-
});
|
|
56
|
-
const { currentSessionId } = useSessionState((s) => s) || {};
|
|
57
|
-
const { activeAgentId } = useActiveAgent();
|
|
58
|
-
const { isMobile } = useV0RuntimeContext();
|
|
59
|
-
return (_jsx(ThemeProvider, { theme: theme, children: _jsx(CurrentAgentProvider, { agentId: activeAgentId, children: _jsx(Box, { flex: 1, children: _jsxs(Container, { sx: {
|
|
60
|
-
height: 'calc(100vh - 64px - 1px)',
|
|
61
|
-
textAlign: 'center',
|
|
62
|
-
pt: 3,
|
|
63
|
-
gap: 2,
|
|
64
|
-
display: 'flex',
|
|
65
|
-
flexDirection: 'column',
|
|
66
|
-
position: 'relative',
|
|
67
|
-
'.code-preview-wrapper': {},
|
|
68
|
-
}, children: [_jsx(Box, { sx: {
|
|
69
|
-
flex: 1,
|
|
70
|
-
height: !isMobile && currentSessionId ? 'calc(100% - 48px - 16px - 16px)' : 'unset',
|
|
71
|
-
}, children: currentSessionId ? _jsx(V0DetailRender, {}) : _jsx(V0ListRender, {}) }), _jsx(Box, { sx: {
|
|
72
|
-
position: 'sticky',
|
|
73
|
-
bottom: 0,
|
|
74
|
-
backgroundColor: 'white',
|
|
75
|
-
py: 2,
|
|
76
|
-
pt: currentSessionId ? 0 : 2,
|
|
77
|
-
zIndex: 1100,
|
|
78
|
-
}, children: _jsx(AgentInputRender, {}) })] }) }) }) }));
|
|
79
|
-
}
|
|
80
|
-
export default function Page() {
|
|
81
|
-
return (_jsx(V0RuntimeProvider, { children: _jsx(V0Page, {}) }));
|
|
82
|
-
}
|
|
83
|
-
function V0ListRender() {
|
|
84
|
-
var _a, _b;
|
|
85
|
-
const ConfirmDialogRef = useRef();
|
|
86
|
-
const { sessions: sessionsList, setCurrentSessionId, loadLatestMessagesForAllSessions, sessionMap, deleteSession, loading, } = useSessionState((s) => s) || {};
|
|
87
|
-
const { isMobile } = useV0RuntimeContext();
|
|
88
|
-
const { agent } = useRuntimeState();
|
|
89
|
-
const { t } = useLocaleContext();
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
const loadData = () => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
if (sessionsList === null || sessionsList === void 0 ? void 0 : sessionsList.length) {
|
|
93
|
-
yield loadLatestMessagesForAllSessions();
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
loadData();
|
|
97
|
-
}, [sessionsList === null || sessionsList === void 0 ? void 0 : sessionsList.length]);
|
|
98
|
-
return (_jsxs(Box, { flex: 1, children: [_jsx(Typography, { variant: "h2", color: "textColor", sx: { fontWeight: 'bold', mt: isMobile ? 3 : 6 }, children: ((_a = agent === null || agent === void 0 ? void 0 : agent.project) === null || _a === void 0 ? void 0 : _a.name) || t('v0.title') }), _jsx(Typography, { variant: "h5", color: "textColor", sx: Object.assign(Object.assign({}, getLineClamp(5)), { mt: 2 }), children: ((_b = agent === null || agent === void 0 ? void 0 : agent.project) === null || _b === void 0 ? void 0 : _b.description) || t('v0.description') }), loading ? (_jsx(Loading, { sx: {
|
|
99
|
-
position: 'relative',
|
|
100
|
-
height: '40vh',
|
|
101
|
-
width: '100%',
|
|
102
|
-
} })) : (_jsxs(Box, { sx: {
|
|
103
|
-
mt: isMobile ? 4 : 8,
|
|
104
|
-
display: 'flex',
|
|
105
|
-
alignContent: 'center',
|
|
106
|
-
justifyContent: 'center',
|
|
107
|
-
}, children: [(sessionsList === null || sessionsList === void 0 ? void 0 : sessionsList.length) ? (_jsx(Masonry, { columns: { xs: 1, sm: 2, md: 3, lg: 4 }, sequential: true, spacing: 2, children: sessionsList === null || sessionsList === void 0 ? void 0 : sessionsList.map((item) => {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
const { name, id } = item;
|
|
110
|
-
const latestMessage = (_b = (_a = sessionMap === null || sessionMap === void 0 ? void 0 : sessionMap[id]) === null || _a === void 0 ? void 0 : _a.messages) === null || _b === void 0 ? void 0 : _b.at(0);
|
|
111
|
-
return (_jsxs(Box, { sx: {
|
|
112
|
-
display: 'flex',
|
|
113
|
-
justifyContent: 'center',
|
|
114
|
-
flexDirection: 'column',
|
|
115
|
-
gap: 1,
|
|
116
|
-
}, children: [_jsx(Box, { sx: {
|
|
117
|
-
border: 2,
|
|
118
|
-
borderRadius: 1,
|
|
119
|
-
borderColor: 'background.block',
|
|
120
|
-
backgroundColor: 'background.block',
|
|
121
|
-
display: 'flex',
|
|
122
|
-
alignItems: 'center',
|
|
123
|
-
justifyContent: 'center',
|
|
124
|
-
cursor: 'pointer',
|
|
125
|
-
transition: 'all 0.3s',
|
|
126
|
-
overflow: 'hidden',
|
|
127
|
-
// minHeight: sliderWidth,
|
|
128
|
-
// maxHeight: '50vh',
|
|
129
|
-
height: 300,
|
|
130
|
-
'&:hover': {
|
|
131
|
-
borderColor: 'primary.main',
|
|
132
|
-
},
|
|
133
|
-
}, onClick: () => {
|
|
134
|
-
setCurrentSessionId(id);
|
|
135
|
-
}, children: _jsx(CodeRenderByMessage, { zoom: 0.5, message: latestMessage, sx: {
|
|
136
|
-
pointerEvents: 'none',
|
|
137
|
-
} }) }), _jsxs(Box, { sx: {
|
|
138
|
-
display: 'flex',
|
|
139
|
-
alignItems: 'center',
|
|
140
|
-
justifyContent: 'space-between',
|
|
141
|
-
}, children: [_jsx(UserQuestion, { question: name }), _jsx(Box, { children: _jsx(IconButton, { color: "error", size: "small", onClick: () => {
|
|
142
|
-
var _a, _b;
|
|
143
|
-
(_b = (_a = ConfirmDialogRef === null || ConfirmDialogRef === void 0 ? void 0 : ConfirmDialogRef.current) === null || _a === void 0 ? void 0 : _a.open) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
144
|
-
title: t('v0.deleteSessionTitle', { name }),
|
|
145
|
-
children: _jsx(Box, { children: t('v0.deleteSessionTip') }),
|
|
146
|
-
onConfirm: () => __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
yield deleteSession({
|
|
148
|
-
sessionId: id,
|
|
149
|
-
autoSetCurrentSessionId: false,
|
|
150
|
-
});
|
|
151
|
-
}),
|
|
152
|
-
onConfirmProps: {
|
|
153
|
-
color: 'error',
|
|
154
|
-
children: t('delete'),
|
|
155
|
-
},
|
|
156
|
-
onCancelProps: {
|
|
157
|
-
color: 'inherit',
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
}, children: _jsx(Icon, { icon: "tabler:trash" }) }) })] })] }, id));
|
|
161
|
-
}) }, "masonry-list")) : (_jsx(Box, { sx: {
|
|
162
|
-
mt: 12,
|
|
163
|
-
}, children: _jsx(Empty, { children: t('v0.noData') }) })), _jsx(ConfirmDialog, { ref: ConfirmDialogRef })] }))] }, "list-render"));
|
|
164
|
-
}
|
|
165
|
-
function V0DetailRender() {
|
|
166
|
-
var _a;
|
|
167
|
-
const { setCurrentSessionId } = useSessionState((s) => s) || {};
|
|
168
|
-
const { messages: messagesListOriginal, loading } = useCurrentSessionState((s) => s) || {};
|
|
169
|
-
const { currentMessageTaskId, setCurrentMessageTaskId, propertiesValueMap, isMobile } = useV0RuntimeContext();
|
|
170
|
-
const [sliderOpenInMobile, setSliderOpenInMobile] = useState(!isMobile);
|
|
171
|
-
const { t } = useLocaleContext();
|
|
172
|
-
// FIXME: 现在临时把 error 的消息隐藏了,后续需要优化
|
|
173
|
-
const messagesList = (_a = messagesListOriginal === null || messagesListOriginal === void 0 ? void 0 : messagesListOriginal.filter((message, index) => { var _a, _b; return (!(message === null || message === void 0 ? void 0 : message.error) && ((_b = (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.length)) || message.id === currentMessageTaskId || index === 0; })) !== null && _a !== void 0 ? _a : [];
|
|
174
|
-
const currentMessage = messagesList.find((message) => message.id === currentMessageTaskId);
|
|
175
|
-
useEffect(() => {
|
|
176
|
-
if (messagesList.length) {
|
|
177
|
-
const latestMessage = messagesList === null || messagesList === void 0 ? void 0 : messagesList.at(0);
|
|
178
|
-
// no currentMessageTaskId or has new message
|
|
179
|
-
if (!currentMessageTaskId || (currentMessageTaskId === (latestMessage === null || latestMessage === void 0 ? void 0 : latestMessage.id) && messagesList.length > 1)) {
|
|
180
|
-
// @ts-ignore
|
|
181
|
-
setCurrentMessageTaskId(latestMessage.id);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}, [messagesList, currentMessageTaskId]);
|
|
185
|
-
const sliderOpen = isMobile ? sliderOpenInMobile : true;
|
|
186
|
-
const sliderWrapperSx = {
|
|
187
|
-
height: isMobile ? 'unset' : '100%',
|
|
188
|
-
backgroundColor: 'background.block',
|
|
189
|
-
borderRadius: 1,
|
|
190
|
-
p: 2,
|
|
191
|
-
position: 'relative',
|
|
192
|
-
};
|
|
193
|
-
return (_jsxs(Box, { flex: 1, sx: {
|
|
194
|
-
display: 'flex',
|
|
195
|
-
gap: 2,
|
|
196
|
-
height: '100%',
|
|
197
|
-
flexDirection: isMobile ? 'column' : 'row',
|
|
198
|
-
}, children: [_jsxs(Box, { sx: Object.assign({ width: isMobile ? '100%' : sliderWidth, gap: 2, display: 'flex', flexDirection: 'column' }, (isMobile ? {} : Object.assign({}, sliderWrapperSx))), children: [_jsxs(Box, { sx: {
|
|
199
|
-
display: 'flex',
|
|
200
|
-
justifyContent: 'space-between',
|
|
201
|
-
alignItems: 'center',
|
|
202
|
-
gap: 2,
|
|
203
|
-
}, children: [_jsx(Button, { variant: "outlined", size: "small", startIcon: _jsx(Icon, { icon: "tabler:chevron-left" }), onClick: () => {
|
|
204
|
-
setCurrentMessageTaskId(undefined);
|
|
205
|
-
setCurrentSessionId('');
|
|
206
|
-
}, sx: {
|
|
207
|
-
backgroundColor: 'white',
|
|
208
|
-
width: isMobile ? 'auto' : '100%',
|
|
209
|
-
}, children: t('back') }), isMobile ? (_jsx(Button, { startIcon: _jsx(Icon, { icon: sliderOpenInMobile ? 'tabler:chevron-up' : 'tabler:chevron-down' }), size: "small", onClick: () => setSliderOpenInMobile(!sliderOpenInMobile), children: sliderOpenInMobile ? t('v0.hideSlider') : t('v0.showSlider') })) : null, loading && (_jsx(Loading, { sx: Object.assign({ position: 'absolute', zIndex: 99999, top: 0, left: 0, right: 0, bottom: 0, margin: 'auto', background: 'rgba(255, 255, 255, 0.8)', opacity: 0.8, borderRadius: 1, boxShadow: '0 0 10px rgba(0, 0, 0, 0.1)' }, (isMobile
|
|
210
|
-
? {
|
|
211
|
-
width: '40px',
|
|
212
|
-
height: '40px',
|
|
213
|
-
}
|
|
214
|
-
: {
|
|
215
|
-
width: '80px',
|
|
216
|
-
height: '80px',
|
|
217
|
-
})) }))] }), sliderOpen && (_jsx(Stack, { spacing: 2, direction: isMobile ? 'row' : 'column', sx: Object.assign(Object.assign({}, (isMobile
|
|
218
|
-
? Object.assign({ overflowY: 'hidden', overflowX: 'auto' }, sliderWrapperSx) : {
|
|
219
|
-
overflowY: 'auto',
|
|
220
|
-
overflowX: 'hidden',
|
|
221
|
-
})), {
|
|
222
|
-
// scrollbarWidth: 'thin',
|
|
223
|
-
// scrollbarColor: 'grey transparent',
|
|
224
|
-
'&::-webkit-scrollbar': {
|
|
225
|
-
display: 'none',
|
|
226
|
-
} }), children: mapRight(messagesList, (item, i) => {
|
|
227
|
-
const { inputs: parameters, id: taskId, updatedAt } = item;
|
|
228
|
-
const isCurrent = taskId === (currentMessageTaskId || undefined);
|
|
229
|
-
return (_jsx(Box, { sx: {
|
|
230
|
-
display: 'flex',
|
|
231
|
-
justifyContent: 'center',
|
|
232
|
-
flexDirection: 'column',
|
|
233
|
-
gap: 1,
|
|
234
|
-
}, children: _jsxs(Box, { id: taskId, onClick: () => {
|
|
235
|
-
// @ts-ignore
|
|
236
|
-
setCurrentMessageTaskId(item.id);
|
|
237
|
-
}, sx: Object.assign({ cursor: 'pointer', color: 'textColor', borderRadius: 1, border: 1, borderColor: isCurrent ? 'primary.main' : 'background.block', backgroundColor: 'white', position: 'relative', transition: 'all 0.3s', '&:hover': {
|
|
238
|
-
borderColor: 'primary.main',
|
|
239
|
-
} }, (isMobile
|
|
240
|
-
? {
|
|
241
|
-
width: sliderWidth / 2,
|
|
242
|
-
height: sliderWidth / 2,
|
|
243
|
-
}
|
|
244
|
-
: {
|
|
245
|
-
minHeight: sliderWidth / 2,
|
|
246
|
-
maxHeight: '50vh',
|
|
247
|
-
})), children: [_jsx(CodeRenderByMessage, { zoom: 0.25, message: item, sx: {
|
|
248
|
-
pointerEvents: 'none',
|
|
249
|
-
}, propertiesValueMap: propertiesValueMap }), _jsx(Tooltip, { placement: "right", arrow: true, PopperProps: {
|
|
250
|
-
// disablePortal: true,
|
|
251
|
-
}, TransitionProps: {
|
|
252
|
-
timeout: {
|
|
253
|
-
appear: 500,
|
|
254
|
-
enter: 500,
|
|
255
|
-
exit: 0,
|
|
256
|
-
},
|
|
257
|
-
}, title: _jsxs(Box, { children: [_jsx(Typography, { sx: {
|
|
258
|
-
fontSize: 13,
|
|
259
|
-
fontWeight: 500,
|
|
260
|
-
color: 'white',
|
|
261
|
-
}, children: parameters === null || parameters === void 0 ? void 0 : parameters.question }), _jsx(Box, { sx: {
|
|
262
|
-
fontSize: 12,
|
|
263
|
-
opacity: 0.75,
|
|
264
|
-
}, children: _jsx(RelativeTime, { value: updatedAt }) })] }), children: _jsx(Chip, { label: `V${messagesList.length - i - 1}`, size: "small", variant: "outlined", sx: {
|
|
265
|
-
fontWeight: 500,
|
|
266
|
-
fontSize: 10,
|
|
267
|
-
height: 20,
|
|
268
|
-
position: 'absolute',
|
|
269
|
-
bottom: 4,
|
|
270
|
-
right: 4,
|
|
271
|
-
backgroundColor: 'background.block',
|
|
272
|
-
borderColor: isCurrent ? 'primary.main' : 'textColor',
|
|
273
|
-
color: isCurrent ? 'primary.main' : 'textColor',
|
|
274
|
-
borderRadius: 1,
|
|
275
|
-
} }) }, taskId)] }, taskId) }, taskId));
|
|
276
|
-
}) }))] }, "slider"), _jsx(Box, { sx: {
|
|
277
|
-
borderRadius: 1,
|
|
278
|
-
backgroundColor: 'background.block',
|
|
279
|
-
flex: 1,
|
|
280
|
-
maxWidth: isMobile ? '100%' : `calc(100% - ${sliderWidth}px - 16px)`,
|
|
281
|
-
}, children: currentMessage && _jsx(AgentOutputRender, { message: currentMessage }) })] }));
|
|
282
|
-
}
|
|
283
|
-
function AgentInputRender() {
|
|
284
|
-
const { appearanceInput } = useAppearances();
|
|
285
|
-
if (!(appearanceInput === null || appearanceInput === void 0 ? void 0 : appearanceInput.componentId))
|
|
286
|
-
return null;
|
|
287
|
-
return (_jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceInput.componentId, properties: appearanceInput.componentProperties }) }));
|
|
288
|
-
}
|
|
289
|
-
function AgentOutputRender({ message }) {
|
|
290
|
-
const { appearanceOutput } = useAppearances();
|
|
291
|
-
if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId) || !message)
|
|
292
|
-
return null;
|
|
293
|
-
return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }, message.id) }) }) }));
|
|
294
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { SubscriptionErrorType } from '@blocklet/ai-kit/api';
|
|
23
|
-
import { Icon } from '@iconify/react';
|
|
24
|
-
import { Box, Typography } from '@mui/material';
|
|
25
|
-
import { memo, useCallback, useState } from 'react';
|
|
26
|
-
import CustomComponentRenderer from '../../../../../../components/CustomComponentRenderer';
|
|
27
|
-
import { useLocaleContext } from '../../../../../locale';
|
|
28
|
-
import { AgentErrorView } from '../../../components/AgentErrorBoundary';
|
|
29
|
-
import LoadingButton from '../../../components/LoadingButton';
|
|
30
|
-
import { useCurrentAgent } from '../../../contexts/CurrentAgent';
|
|
31
|
-
import { useRuntimeState } from '../../../state/runtime';
|
|
32
|
-
import MessageErrorView from '../../ChatOutput/MessageErrorView';
|
|
33
|
-
import { useV0RuntimeContext } from '../contexts/V0Runtime';
|
|
34
|
-
import { AIRunningLoading } from './Loading';
|
|
35
|
-
import TransparentTooltip from './TransparentTooltip';
|
|
36
|
-
const codeField = 'code';
|
|
37
|
-
function RetryComponent({ message, tip }) {
|
|
38
|
-
var _a;
|
|
39
|
-
const { t } = useLocaleContext();
|
|
40
|
-
const { execute } = useRuntimeState();
|
|
41
|
-
const { aid } = useCurrentAgent();
|
|
42
|
-
const { setCurrentMessageTaskId } = useV0RuntimeContext();
|
|
43
|
-
const [loading, setLoading] = useState(false);
|
|
44
|
-
return (_jsxs(Box, { sx: {
|
|
45
|
-
width: '100%',
|
|
46
|
-
height: '100%',
|
|
47
|
-
display: 'flex',
|
|
48
|
-
flexDirection: 'column',
|
|
49
|
-
justifyContent: 'flex-start',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
gap: 2,
|
|
52
|
-
p: 4,
|
|
53
|
-
}, children: [_jsx(Box, { component: Icon, icon: "unjs:automd", sx: {
|
|
54
|
-
mt: 6,
|
|
55
|
-
fontSize: 120,
|
|
56
|
-
} }), ((_a = message === null || message === void 0 ? void 0 : message.error) === null || _a === void 0 ? void 0 : _a.type) === SubscriptionErrorType.UNSUBSCRIBED ? (_jsx(Box, { width: "100%", children: _jsx(AgentErrorView, { error: message.error }) })) : (_jsxs(Typography, { variant: "h6", sx: {
|
|
57
|
-
display: 'flex',
|
|
58
|
-
alignItems: 'center',
|
|
59
|
-
}, children: [tip || t('v0.retryTip'), _jsx(TransparentTooltip, { arrow: true, placement: "top", title: _jsx(MessageErrorView, { error: (message === null || message === void 0 ? void 0 : message.error) || new Error('Code syntax errors'), sx: {
|
|
60
|
-
mr: 0,
|
|
61
|
-
} }), children: _jsx(Box, { component: Icon, icon: "akar-icons:info", sx: {
|
|
62
|
-
ml: 1,
|
|
63
|
-
} }) })] })), _jsx(LoadingButton, { variant: "contained", loading: loading, color: "primary", onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
setLoading(true);
|
|
65
|
-
try {
|
|
66
|
-
const { inputs } = message || {};
|
|
67
|
-
// remove $ starting parameters object
|
|
68
|
-
const canUseParameters = Object.fromEntries(Object.entries(inputs || {}).filter(([key]) => !key.startsWith('$')));
|
|
69
|
-
yield execute({
|
|
70
|
-
aid,
|
|
71
|
-
parameters: canUseParameters,
|
|
72
|
-
onResponseStart: () => {
|
|
73
|
-
setCurrentMessageTaskId(undefined);
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.error(error);
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
setLoading(false);
|
|
82
|
-
}
|
|
83
|
-
}), children: t('v0.retry') })] }));
|
|
84
|
-
}
|
|
85
|
-
export default function CodePreview(_a) {
|
|
86
|
-
var { componentId = 'mock-dev-component', code, propertiesValue, message } = _a, restProps = __rest(_a, ["componentId", "code", "propertiesValue", "message"]);
|
|
87
|
-
const { t, locale } = useLocaleContext();
|
|
88
|
-
if (!code)
|
|
89
|
-
return null;
|
|
90
|
-
return (_jsx(Box, Object.assign({ id: componentId, className: "code-preview-wrapper" }, restProps, { children: _jsx(CustomComponentRenderer, { componentId: componentId, locale: locale, props: propertiesValue || {},
|
|
91
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
92
|
-
fallbackRender: () => _jsx(RetryComponent, { message: message, tip: t('v0.errorCodeTip') }), dev: {
|
|
93
|
-
components: {
|
|
94
|
-
[componentId]: {
|
|
95
|
-
data: {
|
|
96
|
-
id: componentId,
|
|
97
|
-
createdAt: '',
|
|
98
|
-
updatedAt: '',
|
|
99
|
-
renderer: {
|
|
100
|
-
type: 'react-component',
|
|
101
|
-
script: code,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
} }) }), componentId));
|
|
107
|
-
}
|
|
108
|
-
export const CodePreviewMemo = memo(CodePreview);
|
|
109
|
-
export function CodeRenderByMessage({ zoom, message, minHeight = 200, sx, propertiesValueMap, }) {
|
|
110
|
-
var _a;
|
|
111
|
-
const { locale } = useLocaleContext();
|
|
112
|
-
const zoomSx = {
|
|
113
|
-
'& > *': {
|
|
114
|
-
zoom,
|
|
115
|
-
minHeight,
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
const isMessageLoading = ((message === null || message === void 0 ? void 0 : message.loading) || !(message === null || message === void 0 ? void 0 : message.outputs)) && !(message === null || message === void 0 ? void 0 : message.error);
|
|
119
|
-
const ContentRender = useCallback(() => {
|
|
120
|
-
var _a, _b, _c, _d;
|
|
121
|
-
if (isMessageLoading) {
|
|
122
|
-
return (_jsx(Box, { className: "code-message-loading", sx: {
|
|
123
|
-
py: 8,
|
|
124
|
-
display: 'flex',
|
|
125
|
-
justifyContent: 'center',
|
|
126
|
-
alignItems: 'center',
|
|
127
|
-
}, children: _jsx(AIRunningLoading, {}) }));
|
|
128
|
-
}
|
|
129
|
-
if ((message === null || message === void 0 ? void 0 : message.error) || !((_b = (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
130
|
-
return _jsx(RetryComponent, { message: message });
|
|
131
|
-
}
|
|
132
|
-
return (_d = (_c = message === null || message === void 0 ? void 0 : message.outputs) === null || _c === void 0 ? void 0 : _c.objects) === null || _d === void 0 ? void 0 : _d.map((item) => {
|
|
133
|
-
var _a, _b;
|
|
134
|
-
const { taskId } = item;
|
|
135
|
-
// @ts-ignore
|
|
136
|
-
const code = item === null || item === void 0 ? void 0 : item[codeField];
|
|
137
|
-
return (_jsx(CodePreviewMemo, { componentId: `code-preview-${taskId}`, code: code, propertiesValue: ((_a = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _a === void 0 ? void 0 : _a[locale]) || ((_b = propertiesValueMap === null || propertiesValueMap === void 0 ? void 0 : propertiesValueMap[taskId]) === null || _b === void 0 ? void 0 : _b.en) || {}, message: message }, item.taskId));
|
|
138
|
-
});
|
|
139
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
140
|
-
}, [isMessageLoading, (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects, propertiesValueMap, locale]);
|
|
141
|
-
return (_jsx(Box, { sx: Object.assign(Object.assign(Object.assign({ transition: 'all 0.3s', overflow: 'hidden', borderRadius: 1, width: '100%', height: '100%', backgroundColor: 'white' }, zoomSx), sx), { '.code-preview-wrapper': {
|
|
142
|
-
// p: 2,
|
|
143
|
-
} }), children: _jsx(ContentRender, {}) }, message === null || message === void 0 ? void 0 : message.id));
|
|
144
|
-
}
|
|
145
|
-
export const CodeRenderByMessageMemo = memo(CodeRenderByMessage);
|
|
146
|
-
export function getCurrentCodeByTaskId(message) {
|
|
147
|
-
var _a, _b, _c;
|
|
148
|
-
return (_c = (_b = (_a = message === null || message === void 0 ? void 0 : message.outputs) === null || _a === void 0 ? void 0 : _a.objects) === null || _b === void 0 ? void 0 : _b.find((i) => i === null || i === void 0 ? void 0 : i[codeField])) === null || _c === void 0 ? void 0 : _c[codeField];
|
|
149
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { Icon } from '@iconify/react';
|
|
12
|
-
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Typography } from '@mui/material';
|
|
13
|
-
import { forwardRef, useImperativeHandle, useState } from 'react';
|
|
14
|
-
import { useLocaleContext } from '../../../../../locale';
|
|
15
|
-
import LoadingButton from '../../../components/LoadingButton';
|
|
16
|
-
const ConfirmDialog = forwardRef((props, ref) => {
|
|
17
|
-
const [openDialog, setOpenDialog] = useState(false);
|
|
18
|
-
const [openParams, setOpenParams] = useState({});
|
|
19
|
-
const { t } = useLocaleContext();
|
|
20
|
-
const open = (params) => {
|
|
21
|
-
setOpenParams(params);
|
|
22
|
-
setOpenDialog(true);
|
|
23
|
-
};
|
|
24
|
-
const close = () => {
|
|
25
|
-
setOpenDialog(false);
|
|
26
|
-
};
|
|
27
|
-
useImperativeHandle(ref, () => ({
|
|
28
|
-
open,
|
|
29
|
-
close,
|
|
30
|
-
}));
|
|
31
|
-
const { title, children, onConfirm, onCancel, onConfirmProps, onCancelProps } = openParams;
|
|
32
|
-
return (_jsxs(Dialog, Object.assign({ disableScrollLock: true, onClose: close, fullWidth: true, maxWidth: "sm" }, props, { open: openDialog, children: [_jsxs(DialogTitle, { sx: {
|
|
33
|
-
display: 'flex',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
justifyContent: 'space-between',
|
|
36
|
-
}, children: [_jsx(Typography, { component: "h5", sx: { fontSize: 24, fontWeight: 700 }, children: title }), _jsx(Button, { onClick: close,
|
|
37
|
-
// variant="text"
|
|
38
|
-
color: "inherit", disableElevation: true, sx: {
|
|
39
|
-
minWidth: 32,
|
|
40
|
-
minHeight: 32,
|
|
41
|
-
p: 0,
|
|
42
|
-
fontSize: 22,
|
|
43
|
-
}, children: _jsx(Icon, { icon: "tabler:x" }) })] }), _jsx(DialogContent, { children: children }), _jsxs(DialogActions, { sx: {
|
|
44
|
-
px: 3,
|
|
45
|
-
pt: 0,
|
|
46
|
-
pb: 2,
|
|
47
|
-
}, children: [_jsx(Button, Object.assign({ variant: "contained", color: "inherit" }, onCancelProps, { onClick: () => {
|
|
48
|
-
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
49
|
-
setOpenDialog(false);
|
|
50
|
-
}, children: (onCancelProps === null || onCancelProps === void 0 ? void 0 : onCancelProps.children) || t('cancel') })), _jsx(LoadingButton, Object.assign({ variant: "contained" }, onConfirmProps, { onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
yield (onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm());
|
|
52
|
-
setOpenDialog(false);
|
|
53
|
-
}), children: (onConfirmProps === null || onConfirmProps === void 0 ? void 0 : onConfirmProps.children) || t('submit') }))] })] })));
|
|
54
|
-
});
|
|
55
|
-
export default ConfirmDialog;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import Spinner from '@arcblock/ux/lib/Spinner';
|
|
14
|
-
import { Box, Skeleton } from '@mui/material';
|
|
15
|
-
export default function Loading(props) {
|
|
16
|
-
const { sx } = props, restProps = __rest(props, ["sx"]);
|
|
17
|
-
return (_jsx(Box, Object.assign({ sx: Object.assign({ flex: 1, display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'fixed', top: 0, left: 0, width: '100vw', height: '100vh', backgroundColor: 'rgba(255, 255, 255, 0.8)' }, sx) }, restProps, { children: _jsx(Spinner, {}) })));
|
|
18
|
-
}
|
|
19
|
-
export function AIRunningLoading(props) {
|
|
20
|
-
const { sx } = props, restProps = __rest(props, ["sx"]);
|
|
21
|
-
const animationTimeList = [
|
|
22
|
-
{
|
|
23
|
-
time: 2,
|
|
24
|
-
width: 60,
|
|
25
|
-
height: 60,
|
|
26
|
-
extraProps: {
|
|
27
|
-
variant: 'circular',
|
|
28
|
-
sx: {
|
|
29
|
-
backgroundColor: 'grey.200',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
time: 3,
|
|
35
|
-
width: 100,
|
|
36
|
-
height: 20,
|
|
37
|
-
extraProps: {
|
|
38
|
-
sx: {
|
|
39
|
-
backgroundColor: 'grey.100',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
time: 2,
|
|
45
|
-
width: 250,
|
|
46
|
-
height: 10,
|
|
47
|
-
extraProps: {
|
|
48
|
-
sx: {
|
|
49
|
-
backgroundColor: 'grey.200',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
time: 4,
|
|
55
|
-
width: 150,
|
|
56
|
-
height: 10,
|
|
57
|
-
extraProps: {
|
|
58
|
-
sx: {
|
|
59
|
-
backgroundColor: 'grey.200',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
time: 8,
|
|
65
|
-
width: '100%',
|
|
66
|
-
height: '100%',
|
|
67
|
-
Component: Box,
|
|
68
|
-
extraProps: {
|
|
69
|
-
children: [
|
|
70
|
-
_jsx(Skeleton, { variant: "rectangular", sx: {
|
|
71
|
-
width: 60,
|
|
72
|
-
height: 50,
|
|
73
|
-
borderRadius: 1,
|
|
74
|
-
backgroundColor: 'grey.200',
|
|
75
|
-
} }),
|
|
76
|
-
_jsx(Skeleton, { variant: "rectangular", sx: {
|
|
77
|
-
width: 90,
|
|
78
|
-
height: 50,
|
|
79
|
-
borderRadius: 1,
|
|
80
|
-
backgroundColor: 'grey.200',
|
|
81
|
-
} }),
|
|
82
|
-
_jsx(Skeleton, { variant: "rectangular", sx: {
|
|
83
|
-
width: 120,
|
|
84
|
-
height: 50,
|
|
85
|
-
borderRadius: 1,
|
|
86
|
-
backgroundColor: 'grey.200',
|
|
87
|
-
} }),
|
|
88
|
-
],
|
|
89
|
-
sx: {
|
|
90
|
-
px: 2,
|
|
91
|
-
py: 1,
|
|
92
|
-
display: 'flex',
|
|
93
|
-
gap: 1.5,
|
|
94
|
-
justifyContent: 'space-between',
|
|
95
|
-
overflow: 'hidden',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
time: 60,
|
|
101
|
-
width: 290,
|
|
102
|
-
height: 150,
|
|
103
|
-
extraProps: {
|
|
104
|
-
sx: {
|
|
105
|
-
backgroundColor: 'grey.200',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
];
|
|
110
|
-
return (_jsx(Box, Object.assign({ sx: Object.assign({ flex: 1, display: 'inline-flex', justifyContent: 'center', alignItems: 'center', backgroundColor: 'white', flexDirection: 'column', gap: 1.5, width: '100%', overflow: 'hidden', '@keyframes loading': {
|
|
111
|
-
'0%': {
|
|
112
|
-
transform: 'translateY(-8px) scaleX(1.3)',
|
|
113
|
-
opacity: 0,
|
|
114
|
-
height: '100%',
|
|
115
|
-
},
|
|
116
|
-
'50%': {
|
|
117
|
-
transform: 'translateY(0px)',
|
|
118
|
-
opacity: 0.5,
|
|
119
|
-
zoom: 1,
|
|
120
|
-
height: '100%',
|
|
121
|
-
},
|
|
122
|
-
'100%': {
|
|
123
|
-
transform: 'translateY(4px)',
|
|
124
|
-
opacity: 1,
|
|
125
|
-
zoom: 1,
|
|
126
|
-
height: '100%',
|
|
127
|
-
},
|
|
128
|
-
} }, sx) }, restProps, { children: animationTimeList.map((item, index) => {
|
|
129
|
-
// 计算 index 之前的累计时间之和,作为动画延迟时间
|
|
130
|
-
const delay = animationTimeList.slice(0, index).reduce((prev, current) => prev + current.time, 0);
|
|
131
|
-
const { time, width, height, Component = Skeleton } = item, _a = item.extraProps, _b = _a === void 0 ? {} : _a, { sx } = _b, restSkeletonProps = __rest(_b, ["sx"]);
|
|
132
|
-
const isLast = index === animationTimeList.length - 1;
|
|
133
|
-
return (_jsx(Box, { sx: {
|
|
134
|
-
animation: `loading ${time}s 1 ${delay}s forwards`,
|
|
135
|
-
borderRadius: 1,
|
|
136
|
-
overflow: 'hidden',
|
|
137
|
-
opacity: 0,
|
|
138
|
-
transition: 'all 0.3s',
|
|
139
|
-
}, children: _jsx(Component
|
|
140
|
-
// @ts-ignore
|
|
141
|
-
, Object.assign({
|
|
142
|
-
// @ts-ignore
|
|
143
|
-
variant: "rectangular", sx: Object.assign({ width,
|
|
144
|
-
height, animationIterationCount: isLast ? 'infinite' : 1, animationFillMode: isLast ? 'forwards' : 'none' }, sx) }, restSkeletonProps)) }, index));
|
|
145
|
-
}) })));
|
|
146
|
-
}
|