mtxuilib 0.6.2 → 0.6.6
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/package.json +2 -2
- package/src/assistant-ui/CodeHeader.tsx +0 -27
- package/src/assistant-ui/assistant-modal.tsx +0 -76
- package/src/assistant-ui/index.ts +0 -14
- package/src/assistant-ui/markdown-text-lz.tsx +0 -5
- package/src/assistant-ui/markdown-text.tsx +0 -204
- package/src/assistant-ui/syntax-highlighter.tsx +0 -25
- package/src/assistant-ui/thread.tsx +0 -93
- package/src/assistant-ui/tooltip-icon-button.tsx +0 -53
- package/src/cli/build_tsc.ts +0 -40
- package/src/cli/build_vite.ts +0 -11
- package/src/cli/compile-migrations.ts +0 -23
- package/src/cli/main.ts +0 -66
- package/src/cloudflare/cfWsTunnelHandler.ts-- +0 -60
- package/src/cloudflare/cfWsTunnelServe.ts-- +0 -214
- package/src/cloudflare/common.ts +0 -1
- package/src/cloudflare/worker-vless.ts +0 -1069
- package/src/components/AutoResizingTextarea.tsx +0 -52
- package/src/components/ChatMessageBubble.tsx +0 -56
- package/src/components/ClipboardCopy.tsx +0 -49
- package/src/components/DebugFormState.tsx +0 -19
- package/src/components/DeleteComfirm.tsx +0 -123
- package/src/components/FullCenter.tsx +0 -16
- package/src/components/GlobalSearch.tsx +0 -43
- package/src/components/HtmlChangesObserver.tsx +0 -71
- package/src/components/InlineCode.tsx +0 -20
- package/src/components/IntermediateStep.tsx +0 -55
- package/src/components/MtErrorBoundary.tsx +0 -33
- package/src/components/MtImage.tsx +0 -42
- package/src/components/MtProgressBar.tsx +0 -13
- package/src/components/MtSuspenseBoundary.tsx +0 -22
- package/src/components/NotFoundGoBack.tsx +0 -19
- package/src/components/ShowError.tsx +0 -20
- package/src/components/SlntTree/Slnt.z.tsx +0 -19
- package/src/components/SlntTree/SlntTreeNode.tsx +0 -104
- package/src/components/area-chart.tsx-- +0 -369
- package/src/components/button-scroll-to-bottom.tsx +0 -35
- package/src/components/confirm/ConfirmProvider.tsx +0 -145
- package/src/components/confirm/Confrom.tsx +0 -52
- package/src/components/devtools/DebugValue.tsx +0 -57
- package/src/components/devtools/DevTools.tsx +0 -27
- package/src/components/devtools/DevToolsView.tsx +0 -48
- package/src/components/devtools/index.tsx +0 -4
- package/src/components/empty-screen.tsx +0 -23
- package/src/components/external-link.tsx +0 -32
- package/src/components/hidden-copyable-input.tsx +0 -45
- package/src/components/mtlink.tsx +0 -61
- package/src/components/pip/ReactDocumentPictureInPicture.tsx +0 -250
- package/src/components/pip/globals.d.ts +0 -8
- package/src/components/schema-form/SchemaFormFieldsRender.tsx +0 -48
- package/src/components/schema-form/SchemaFormView.tsx +0 -48
- package/src/components/schema-form/schema-form.z.ts +0 -25
- package/src/components/skeletons/SkeletonDocument.tsx +0 -15
- package/src/components/skeletons/SkeletonListView.tsx +0 -16
- package/src/components/skeletons/SkeletonLoading.tsx +0 -16
- package/src/components/skeletons/index.ts +0 -3
- package/src/components/spinner.tsx +0 -16
- package/src/components/table/SimpleTable.tsx +0 -45
- package/src/components/table/cells/ExpenderCell.tsx +0 -20
- package/src/components/table/cells/SelectCell.tsx +0 -53
- package/src/components/table/cells/SortOrderCell.tsx-- +0 -29
- package/src/components/table/cells/Text.tsx +0 -29
- package/src/components/table/cells/ViewLink.tsx +0 -54
- package/src/components/table/cells/container/cellWrapper.tsx +0 -12
- package/src/components/table/cells/number.tsx +0 -15
- package/src/components/table/cells/string.tsx +0 -75
- package/src/components/table/columns/columns-example.tsx-- +0 -83
- package/src/components/table/data-table-pagination.tsx +0 -97
- package/src/components/table/data-table-view-options.tsx +0 -57
- package/src/components/table/datatable-view-options.tsx +0 -20
- package/src/components/table/example/ExampleTable.tsx +0 -149
- package/src/components/table/header/SimpleHeader.tsx +0 -75
- package/src/components/table/header/header.tsx +0 -35
- package/src/components/table/index.ts +0 -21
- package/src/components/table/row/CommonRow.tsx-- +0 -27
- package/src/components/table/row/DraggableRow.tsx-- +0 -56
- package/src/components/table/table.z.ts +0 -56
- package/src/components/tailwind-indicator.tsx +0 -16
- package/src/components/theme-toggle.tsx +0 -42
- package/src/components/themes/ThemeProvider.tsx +0 -48
- package/src/components/themes/theme-toggle.tsx +0 -26
- package/src/components/time-picker/date-time-picker.tsx +0 -79
- package/src/components/time-picker/index.ts +0 -4
- package/src/components/time-picker/time-picker-input.tsx +0 -150
- package/src/components/time-picker/time-picker-utils.ts +0 -228
- package/src/components/time-picker/time-picker.tsx +0 -57
- package/src/components/zoomable.tsx +0 -458
- package/src/config/coreconfig.ts +0 -14
- package/src/constants.ts +0 -92
- package/src/data-table/data-table-column-header.tsx +0 -72
- package/src/data-table/data-table-faceted-filter.tsx +0 -270
- package/src/data-table/data-table-pagination.tsx +0 -115
- package/src/data-table/data-table-row-actions.tsx +0 -54
- package/src/data-table/data-table-toolbar.tsx +0 -90
- package/src/data-table/data-table-view-options.tsx +0 -58
- package/src/data-table/data-table.tsx +0 -267
- package/src/db/dbClient.ts +0 -31
- package/src/db/migrate-browser.ts +0 -17
- package/src/db/migrate.ts +0 -39
- package/src/db/migrations/0000_magical_skullbuster.sql +0 -63
- package/src/db/migrations/meta/0000_snapshot.json +0 -430
- package/src/db/migrations/meta/_journal.json +0 -13
- package/src/db/migrations/pglite_full_migrations.json +0 -1
- package/src/db/pglite.ts +0 -36
- package/src/db/pgliteClient.ts +0 -13
- package/src/db/queries/nodestate-query.ts +0 -0
- package/src/db/queries/queries.ts +0 -279
- package/src/db/queries/user-query.ts +0 -31
- package/src/db/schema/chat.ts +0 -14
- package/src/db/schema/document.ts +0 -29
- package/src/db/schema/index.ts +0 -8
- package/src/db/schema/message.ts +0 -22
- package/src/db/schema/nodestate.ts +0 -14
- package/src/db/schema/resources.ts +0 -7
- package/src/db/schema/suggestion.ts +0 -37
- package/src/db/schema/user.ts +0 -10
- package/src/db/schema/vote.ts +0 -26
- package/src/fonts.ts +0 -91
- package/src/form/EditFormToolbar.tsx +0 -143
- package/src/form/PopupFormV2.tsx +0 -182
- package/src/form/SchemaFormFieldRender.tsx +0 -79
- package/src/form/ZodForm.tsx +0 -92
- package/src/form/deleteConform.tsx +0 -101
- package/src/hooks/use-block-stream.tsx-- +0 -95
- package/src/hooks/use-can-back.ts +0 -15
- package/src/hooks/use-config.ts +0 -23
- package/src/hooks/use-copy-to-clipboard.tsx +0 -52
- package/src/hooks/use-enter-submit.tsx +0 -26
- package/src/hooks/use-local-storage.ts +0 -25
- package/src/hooks/use-lock-body.ts +0 -14
- package/src/hooks/use-media-query.ts +0 -39
- package/src/hooks/use-mobile.tsx +0 -21
- package/src/hooks/use-mounted.ts +0 -18
- package/src/hooks/use-mutation-observer.ts +0 -20
- package/src/hooks/use-router.ts +0 -120
- package/src/hooks/use-router.ts.backup +0 -69
- package/src/hooks/use-scroll-anchor.tsx +0 -85
- package/src/hooks/use-scroll-to-bottom.ts +0 -31
- package/src/hooks/use-streamable-text.ts +0 -25
- package/src/hooks/useAgentEventStream.ts +0 -60
- package/src/hooks/useHighlighter.tsx +0 -34
- package/src/hooks/useIsIntersecting.tsx +0 -24
- package/src/hooks/useLayoutPath.ts-- +0 -27
- package/src/hooks/useLeaveConfirm.ts +0 -38
- package/src/hooks/useScript.ts +0 -107
- package/src/hooks/useSnapScroll.ts +0 -63
- package/src/html/atricleExtractor.ts-- +0 -5
- package/src/html/cleanHtml.ts-- +0 -13
- package/src/html/linksExtractor.ts-- +0 -33
- package/src/http/cors.ts +0 -155
- package/src/http/fetchMiddleWithCache.ts +0 -85
- package/src/http/fetchMiddleWithUrlProxy.ts +0 -11
- package/src/http/mthttp.ts +0 -112
- package/src/http/response-cache.test.ts +0 -66
- package/src/http/rproxy.ts +0 -68
- package/src/http/url.ts +0 -65
- package/src/i18n/I18nProvider.tsx +0 -10
- package/src/i18n/i18n.tsx +0 -60
- package/src/i18n/index.ts +0 -3
- package/src/icons/Auth0.tsx +0 -14
- package/src/icons/CircleStopIcon.tsx +0 -16
- package/src/icons/Cognito.tsx +0 -44
- package/src/icons/CopliotIcon.tsx +0 -21
- package/src/icons/Cross2Icon.tsx +0 -1
- package/src/icons/Descope.tsx +0 -328
- package/src/icons/GarbageIcon.tsx +0 -26
- package/src/icons/Gitlab.tsx +0 -27
- package/src/icons/IconSpinner.tsx +0 -18
- package/src/icons/LoaderI3con.tsx +0 -74
- package/src/icons/MessageCircle.tsx-- +0 -21
- package/src/icons/Okta.tsx +0 -17
- package/src/icons/SaveIcon.tsx +0 -22
- package/src/icons/Telegram.tsx +0 -22
- package/src/icons/aichatbot.icons.tsx +0 -857
- package/src/icons/crazy-spinner.tsx +0 -11
- package/src/icons/flags.tsx +0 -266
- package/src/icons/font-default.tsx +0 -20
- package/src/icons/font-mono.tsx +0 -21
- package/src/icons/font-serif.tsx +0 -21
- package/src/icons/github.tsx +0 -15
- package/src/icons/icons-ai.tsx +0 -507
- package/src/icons/icons.tsx +0 -495
- package/src/icons/index.tsx +0 -7
- package/src/icons/langsmith.tsx +0 -26
- package/src/icons/llm.tsx +0 -10
- package/src/icons/loading-circle.tsx +0 -22
- package/src/icons/magic.tsx +0 -30
- package/src/icons/magic_pencil.tsx +0 -35
- package/src/icons/messageBubble.tsx-- +0 -21
- package/src/icons/microphone.tsx-- +0 -23
- package/src/icons/minimize.tsx-- +0 -24
- package/src/icons/pencil.tsx-- +0 -22
- package/src/icons/squarePen.tsx +0 -21
- package/src/index.ts +0 -2
- package/src/layouts/dash/DashLayout.tsx +0 -74
- package/src/layouts/dash/MainHeader.tsx +0 -103
- package/src/layouts/dash/nav.tsx +0 -46
- package/src/layouts/dash5/DashBreadcrumb.tsx +0 -75
- package/src/layouts/dash5/DetailViewExample.tsx +0 -9
- package/src/layouts/dash5/ListViewExample.tsx +0 -9
- package/src/layouts/dash5/MainHeader.tsx +0 -130
- package/src/layouts/dash5/SiderNavItem.tsx +0 -103
- package/src/layouts/dash5/SiderToggleButton.tsx +0 -52
- package/src/layouts/dash5/dash5.store.tsx +0 -137
- package/src/layouts/dash5/main-nav.tsx-- +0 -51
- package/src/layouts/dash5/nav.tsx-- +0 -137
- package/src/layouts/index.ts +0 -1
- package/src/layouts/types.tsx +0 -25
- package/src/layouts/web/WebLayout.tsx +0 -12
- package/src/layouts/web/WebLayoutHeader.tsx +0 -57
- package/src/layouts/web/index.ts +0 -1
- package/src/layouts//345/270/203/345/261/200/350/256/276/350/256/241/345/217/202/350/200/203.md +0 -3
- package/src/lib/artifact_content_types.ts +0 -34
- package/src/lib/clientlib.ts +0 -57
- package/src/lib/componentHelper.ts +0 -79
- package/src/lib/convert_messages.ts +0 -133
- package/src/lib/debounce.ts +0 -21
- package/src/lib/domutils.ts +0 -29
- package/src/lib/errors.ts +0 -9
- package/src/lib/exec.ts +0 -53
- package/src/lib/get_language_template.ts +0 -46
- package/src/lib/github-file.ts +0 -25
- package/src/lib/hash.ts +0 -22
- package/src/lib/highlight-code.ts +0 -35
- package/src/lib/htmlparse/components/ItemActionButton.tsx +0 -103
- package/src/lib/htmlparse/htmlParse.tsx +0 -112
- package/src/lib/lib-old/ai/aiConfig.ts +0 -16
- package/src/lib/lib-old/fonts.ts +0 -15
- package/src/lib/lib-old/html-rewrite/htmlRewriterExample.ts +0 -37
- package/src/lib/lib-old/middleware.ts +0 -43
- package/src/lib/lib-old/mtqueueClient.ts +0 -9
- package/src/lib/lib-old/openaiHelper.ts +0 -9
- package/src/lib/lib-old/queue/mtqueue.ts-- +0 -31
- package/src/lib/lib-old/types.ts +0 -32
- package/src/lib/lib-old/utils.ts +0 -67
- package/src/lib/logger/mt-logger.ts +0 -102
- package/src/lib/logger/mtlogger.ts +0 -59
- package/src/lib/logger/pushToLoki.ts +0 -36
- package/src/lib/logger.ts +0 -120
- package/src/lib/markdownUtil.ts +0 -16
- package/src/lib/mtos.ts +0 -133
- package/src/lib/pathRegxp.ts +0 -11
- package/src/lib/rdb/listQueue.ts-- +0 -34
- package/src/lib/rdb/rdb.ts-- +0 -13
- package/src/lib/react-query/ReactQueryProvider.tsx +0 -81
- package/src/lib/react.ts +0 -11
- package/src/lib/render.tsx +0 -52
- package/src/lib/s-utils.ts +0 -145
- package/src/lib/service-worker/ServiceWorkerMain.tsx +0 -57
- package/src/lib/service-worker/sw.ts +0 -49
- package/src/lib/service-worker.js-- +0 -36
- package/src/lib/shim.ts +0 -56
- package/src/lib/sse/runableSseStream.ts +0 -30
- package/src/lib/sse/sse.ts +0 -61
- package/src/lib/sse/vercelAiSdkUtil.ts +0 -5
- package/src/lib/sslib.ts +0 -27
- package/src/lib/url.ts +0 -103
- package/src/lib/utils.ts +0 -579
- package/src/lib/zustand.ts +0 -45
- package/src/llm/embedding.ts +0 -77
- package/src/llm/llm.ts +0 -214
- package/src/motion/mtmotion-variants.tsx +0 -21
- package/src/mt/Boundary.tsx +0 -37
- package/src/mt/Dialog.tsx +0 -157
- package/src/mt/DropdownMenuItemLink.tsx +0 -21
- package/src/mt/ErrorMessage.tsx +0 -12
- package/src/mt/GoBackButton.tsx +0 -44
- package/src/mt/IconButton.tsx +0 -100
- package/src/mt/LoadingDots.tsx +0 -30
- package/src/mt/MtDialog.tsx +0 -35
- package/src/mt/MtScrollArea copy.tsx +0 -130
- package/src/mt/MtScrollArea.tsx +0 -142
- package/src/mt/MtSlider.tsx +0 -88
- package/src/mt/NavTag.tsx +0 -87
- package/src/mt/ScreenPanel.tsx +0 -65
- package/src/mt/SimpleTag.tsx +0 -17
- package/src/mt/Slider.tsx +0 -92
- package/src/mt/TighterText.tsx +0 -13
- package/src/mt/Tree.tsx-- +0 -279
- package/src/mt/WithLinkIf.tsx-- +0 -17
- package/src/mt/chart.tsx +0 -366
- package/src/mt/code-editor.tsx +0 -221
- package/src/mt/code-highlighter.tsx +0 -96
- package/src/mt/confirm-dialog.tsx +0 -57
- package/src/mt/copy-to-clipboard.tsx +0 -53
- package/src/mt/easings.ts +0 -4
- package/src/mt/envvar.tsx +0 -148
- package/src/mt/form-inputs/collapsible-section.tsx +0 -49
- package/src/mt/form-inputs/dynamic-size-input-template.tsx +0 -108
- package/src/mt/headline.tsx +0 -19
- package/src/mt/inline-context-tooltip.tsx +0 -32
- package/src/mt/input-field/InputField.tsx-- +0 -84
- package/src/mt/input-field/SingleUploadForm.tsx +0 -151
- package/src/mt/input-field/TextFileInput.tsx +0 -89
- package/src/mt/input-field/select/InputSelect.tsx +0 -114
- package/src/mt/inputs/SearchInput.tsx +0 -28
- package/src/mt/inputs/TagsInput.tsx +0 -80
- package/src/mt/inputs/TaskStatusInput.tsx-- +0 -62
- package/src/mt/inputs/UrlsInput.tsx +0 -21
- package/src/mt/inputs/index.ts +0 -1
- package/src/mt/inputs/input.tsx +0 -3
- package/src/mt/inputs/mui-chips-input.tsx +0 -64
- package/src/mt/json-form.tsx +0 -165
- package/src/mt/logs.tsx +0 -212
- package/src/mt/mt-tree-view/mt-tree-view-api.tsx-- +0 -398
- package/src/mt/mt-tree-view/mt-treeview.tsx-- +0 -135
- package/src/mt/mtlink.tsx +0 -61
- package/src/mt/mtloading.tsx +0 -16
- package/src/mt/multi-select.tsx +0 -361
- package/src/mt/pagination.tsx +0 -96
- package/src/mt/relative-date.tsx +0 -90
- package/src/mt/secret-copier.tsx +0 -196
- package/src/mt/skeleton/NewLoading.tsx +0 -35
- package/src/mt/skeleton/SkeletonInput.tsx +0 -14
- package/src/mt/skeleton/SkeletonLayout.tsx +0 -42
- package/src/mt/skeleton/SkeletonLoading.tsx +0 -12
- package/src/mt/skeleton/skeleton-card.tsx +0 -13
- package/src/mt/skeleton/skeleton2.tsx +0 -10
- package/src/mt/skeleton/skeletons.tsx +0 -73
- package/src/mt/skeleton.tsx +0 -26
- package/src/mt/spinner/Spinner1.tsx +0 -32
- package/src/mt/steps.tsx +0 -45
- package/src/mt/submit-button.tsx +0 -46
- package/src/mt/tabs.tsx +0 -67
- package/src/mt/types.tsx-- +0 -4
- package/src/prompts/react-chat.md +0 -38
- package/src/routes/agent/blogGraph.ts-- +0 -15
- package/src/routes/agent/demo/react.ts-- +0 -114
- package/src/routes/agent/index.ts +0 -134
- package/src/routes/agent/mtmai.ts +0 -29
- package/src/routes/agent/testagent.ts +0 -32
- package/src/routes/auth/auth.ts +0 -4
- package/src/routes/authorsApp/author.ts +0 -5
- package/src/routes/booksApp/bookApp.ts +0 -6
- package/src/routes/edgeApi.ts +0 -21
- package/src/routes/workflows/workflows.ts +0 -79
- package/src/routes/ws/wsApp.ts +0 -26
- package/src/routes/ws/wsContextHandler.ts +0 -37
- package/src/styles/CalSans-SemiBold.otf +0 -0
- package/src/styles/globals.css +0 -144
- package/src/tailwind.ts +0 -76
- package/src/tools/getWeather.ts +0 -19
- package/src/tools/webSearch.ts +0 -17
- package/src/tree/tree.test.ts +0 -44
- package/src/tree/tree.ts +0 -32
- package/src/tree/tree.z.ts +0 -21
- package/src/types/common.ts +0 -13
- package/src/types/index.ts +0 -396
- package/src/types/opencanvasTypes.ts +0 -280
- package/src/ui/accordion.tsx +0 -60
- package/src/ui/alert-dialog.tsx +0 -132
- package/src/ui/alert.tsx +0 -60
- package/src/ui/aspect-ratio.tsx +0 -7
- package/src/ui/avatar.tsx +0 -50
- package/src/ui/badge.tsx +0 -43
- package/src/ui/breadcrumb.tsx +0 -115
- package/src/ui/button.tsx +0 -61
- package/src/ui/calendar.tsx +0 -71
- package/src/ui/card.tsx +0 -78
- package/src/ui/checkbox.tsx +0 -31
- package/src/ui/codeblock.tsx +0 -147
- package/src/ui/collapsible.tsx +0 -11
- package/src/ui/command.tsx +0 -153
- package/src/ui/context-menu.tsx +0 -193
- package/src/ui/dialog.tsx +0 -97
- package/src/ui/drawer.tsx +0 -139
- package/src/ui/dropdown-menu.tsx +0 -194
- package/src/ui/form.tsx +0 -178
- package/src/ui/hover-card.tsx +0 -29
- package/src/ui/input.tsx +0 -25
- package/src/ui/label.tsx +0 -26
- package/src/ui/menubar.tsx +0 -240
- package/src/ui/navigation-menu.tsx +0 -122
- package/src/ui/pagination.tsx +0 -122
- package/src/ui/popover.tsx +0 -31
- package/src/ui/progress.tsx +0 -28
- package/src/ui/radio-group.tsx +0 -44
- package/src/ui/resizable.tsx +0 -43
- package/src/ui/scroll-area.tsx +0 -90
- package/src/ui/select.tsx +0 -151
- package/src/ui/separator.tsx +0 -31
- package/src/ui/sheet.tsx +0 -140
- package/src/ui/sidebar.tsx +0 -774
- package/src/ui/skeleton.tsx +0 -16
- package/src/ui/slider.tsx +0 -28
- package/src/ui/sonner.tsx +0 -46
- package/src/ui/switch.tsx +0 -29
- package/src/ui/table.tsx +0 -117
- package/src/ui/tabs.tsx +0 -55
- package/src/ui/textarea.tsx +0 -25
- package/src/ui/toast.tsx +0 -132
- package/src/ui/toaster.tsx +0 -41
- package/src/ui/toggle.tsx +0 -45
- package/src/ui/tooltip.tsx +0 -49
- package/src/ui/use-toast-2.ts +0 -193
- package/src/ui/use-toast.ts +0 -192
- package/src/video-player/video-player2/modal-video-player.tsx-- +0 -128
- package/src/workflows/WorkflowDemo.ts +0 -71
- package/src/workflows/hello-assisant.ts +0 -36
- package/src/workflows/hello-mtmaiapi.ts-- +0 -30
- package/src/workflows/hello-tooluse.ts +0 -48
- package/src/workflows/hello-workflow.ts +0 -98
- package/src/workflows/mtmaiclient.ts +0 -37
- package/src/workflows/params.ts +0 -5
- package/src/workflows/steps/step-gen-article.ts-- +0 -127
- package/src/workflows/steps/steps.ts-- +0 -50
- package/src/workflows/tool-steps/toolStepWebSearch.ts +0 -52
- package/src/zod/common.z.ts +0 -66
- package/src/zod/listView.z.ts-- +0 -207
- package/src/zod/meta.ts +0 -29
- package/src/zod/msg.z.ts-- +0 -10
- package/src/zod/taskStatus.z.ts-- +0 -34
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mtxuilib",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.6",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"files": ["dist"
|
|
9
|
+
"files": ["dist"],
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"main": "./dist/index.js",
|
|
12
12
|
"repository": {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { CodeHeaderProps } from "@assistant-ui/react-markdown";
|
|
4
|
-
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
5
|
-
|
|
6
|
-
import { FC } from "react";
|
|
7
|
-
import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard";
|
|
8
|
-
import { TooltipIconButton } from "./tooltip-icon-button";
|
|
9
|
-
|
|
10
|
-
export const CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {
|
|
11
|
-
const { isCopied, copyToClipboard } = useCopyToClipboard();
|
|
12
|
-
const onCopy = () => {
|
|
13
|
-
if (!code || isCopied) return;
|
|
14
|
-
copyToClipboard(code);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className="flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white">
|
|
19
|
-
<span className="lowercase [&>span]:text-xs">{language}</span>
|
|
20
|
-
<TooltipIconButton tooltip="Copy" onClick={onCopy}>
|
|
21
|
-
{!isCopied && <CopyIcon />}
|
|
22
|
-
{isCopied && <CheckIcon />}
|
|
23
|
-
</TooltipIconButton>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { BotIcon, ChevronDownIcon } from "lucide-react";
|
|
4
|
-
|
|
5
|
-
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
|
6
|
-
import dynamic from "next/dynamic";
|
|
7
|
-
import { forwardRef, useState } from "react";
|
|
8
|
-
import { cn } from "../lib/utils";
|
|
9
|
-
import { Button } from "../ui/button";
|
|
10
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
|
11
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
|
12
|
-
import { Thread } from "./thread";
|
|
13
|
-
|
|
14
|
-
const LzThread = dynamic(() => import("./thread").then((mod) => mod.Thread), {
|
|
15
|
-
ssr: false,
|
|
16
|
-
});
|
|
17
|
-
export const AssistantModal = () => {
|
|
18
|
-
const [open, setOpen] = useState(false);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Popover open={open} onOpenChange={setOpen}>
|
|
22
|
-
<PopoverTrigger asChild>
|
|
23
|
-
<FloatingAssistantButton />
|
|
24
|
-
</PopoverTrigger>
|
|
25
|
-
<PopoverContent
|
|
26
|
-
side="top"
|
|
27
|
-
align="end"
|
|
28
|
-
className="h-[500px] w-[400px] rounded p-0"
|
|
29
|
-
>
|
|
30
|
-
<Thread />
|
|
31
|
-
</PopoverContent>
|
|
32
|
-
</Popover>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
type FloatingAssistantButton = { "data-state"?: "open" | "closed" };
|
|
37
|
-
|
|
38
|
-
const FloatingAssistantButton = forwardRef<
|
|
39
|
-
HTMLButtonElement,
|
|
40
|
-
FloatingAssistantButton
|
|
41
|
-
>(({ "data-state": state, ...rest }, forwardedRef) => {
|
|
42
|
-
const tooltip = state === "open" ? "Close Assistant" : "Open Assistant";
|
|
43
|
-
return (
|
|
44
|
-
<TooltipProvider>
|
|
45
|
-
<Tooltip>
|
|
46
|
-
<TooltipTrigger asChild>
|
|
47
|
-
<Button
|
|
48
|
-
variant="default"
|
|
49
|
-
size="icon"
|
|
50
|
-
className="fixed right-4 bottom-4 size-12 rounded-full shadow hover:scale-70"
|
|
51
|
-
{...rest}
|
|
52
|
-
ref={forwardedRef}
|
|
53
|
-
>
|
|
54
|
-
<BotIcon
|
|
55
|
-
className={cn(
|
|
56
|
-
"absolute size-6 transition-all",
|
|
57
|
-
state === "open" && "rotate-90 scale-0",
|
|
58
|
-
state === "closed" && "rotate-0 scale-100",
|
|
59
|
-
)}
|
|
60
|
-
/>
|
|
61
|
-
|
|
62
|
-
<ChevronDownIcon
|
|
63
|
-
className={cn(
|
|
64
|
-
"absolute size-6 transition-all",
|
|
65
|
-
state === "open" && "rotate-0 scale-100",
|
|
66
|
-
state === "closed" && "-rotate-90 scale-0",
|
|
67
|
-
)}
|
|
68
|
-
/>
|
|
69
|
-
<span className="sr-only">{tooltip}</span>
|
|
70
|
-
</Button>
|
|
71
|
-
</TooltipTrigger>
|
|
72
|
-
<TooltipContent side="left">{tooltip}</TooltipContent>
|
|
73
|
-
</Tooltip>
|
|
74
|
-
</TooltipProvider>
|
|
75
|
-
);
|
|
76
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export * from "./assistant-modal";
|
|
2
|
-
// export * from "./markdown-text";
|
|
3
|
-
// export * from "./markdown-text-lz";
|
|
4
|
-
// export * from "./tooltip-icon-button";
|
|
5
|
-
|
|
6
|
-
// export * from "./syntax-highlighter";
|
|
7
|
-
// export * from "./thread";
|
|
8
|
-
|
|
9
|
-
// export const AssistantModal = dynamic(
|
|
10
|
-
// () => import("./assistant-modal").then((mod) => mod.AssistantModal),
|
|
11
|
-
// {
|
|
12
|
-
// ssr: false,
|
|
13
|
-
// },
|
|
14
|
-
// );
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
MarkdownTextPrimitive,
|
|
5
|
-
useIsMarkdownCodeBlock,
|
|
6
|
-
} from "@assistant-ui/react-markdown";
|
|
7
|
-
// 警告: 不要这样直接导入,后果是 构建出来的 (tailwinddcss css 文件体积非常大,里面包含了内联的katex字体)
|
|
8
|
-
// import "katex/dist/katex.min.css";
|
|
9
|
-
import { memo } from "react";
|
|
10
|
-
import rehypeKatex from "rehype-katex";
|
|
11
|
-
import remarkGfm from "remark-gfm";
|
|
12
|
-
import remarkMath from "remark-math";
|
|
13
|
-
import { cn } from "../lib/utils";
|
|
14
|
-
// import { TooltipIconButton } from "./tooltip-icon-button";
|
|
15
|
-
import { CodeHeader } from "./CodeHeader";
|
|
16
|
-
import { SyntaxHighlighter } from "./syntax-highlighter";
|
|
17
|
-
const MarkdownTextImpl = () => {
|
|
18
|
-
return (
|
|
19
|
-
<MarkdownTextPrimitive
|
|
20
|
-
remarkPlugins={[remarkGfm, remarkMath]}
|
|
21
|
-
rehypePlugins={[rehypeKatex]}
|
|
22
|
-
components={{
|
|
23
|
-
h1: ({ node: _node, className, ...props }) => (
|
|
24
|
-
//@ts-ignore
|
|
25
|
-
<h1
|
|
26
|
-
className={cn(
|
|
27
|
-
"mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",
|
|
28
|
-
className,
|
|
29
|
-
)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
),
|
|
33
|
-
h2: ({ node: _node, className, ...props }) => (
|
|
34
|
-
//@ts-ignore
|
|
35
|
-
<h2
|
|
36
|
-
className={cn(
|
|
37
|
-
"mb-4 mt-8 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",
|
|
38
|
-
className,
|
|
39
|
-
)}
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
),
|
|
43
|
-
h3: ({ node: _node, className, ...props }) => (
|
|
44
|
-
//@ts-ignore
|
|
45
|
-
<h3
|
|
46
|
-
className={cn(
|
|
47
|
-
"mb-4 mt-6 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",
|
|
48
|
-
className,
|
|
49
|
-
)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
),
|
|
53
|
-
h4: ({ node: _node, className, ...props }) => (
|
|
54
|
-
//@ts-ignore
|
|
55
|
-
<h4
|
|
56
|
-
className={cn(
|
|
57
|
-
"mb-4 mt-6 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",
|
|
58
|
-
className,
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
/>
|
|
62
|
-
),
|
|
63
|
-
h5: ({ node: _node, className, ...props }) => (
|
|
64
|
-
//@ts-ignore
|
|
65
|
-
<h5
|
|
66
|
-
className={cn(
|
|
67
|
-
"my-4 text-lg font-semibold first:mt-0 last:mb-0",
|
|
68
|
-
className,
|
|
69
|
-
)}
|
|
70
|
-
{...props}
|
|
71
|
-
/>
|
|
72
|
-
),
|
|
73
|
-
h6: ({ node: _node, className, ...props }) => (
|
|
74
|
-
//@ts-ignore
|
|
75
|
-
<h6
|
|
76
|
-
className={cn("my-4 font-semibold first:mt-0 last:mb-0", className)}
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
),
|
|
80
|
-
p: ({ node: _node, className, ...props }) => (
|
|
81
|
-
//@ts-ignore
|
|
82
|
-
<p
|
|
83
|
-
className={cn(
|
|
84
|
-
"mb-5 mt-5 leading-7 first:mt-0 last:mb-0",
|
|
85
|
-
className,
|
|
86
|
-
)}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
),
|
|
90
|
-
a: ({ node: _node, className, ...props }) => (
|
|
91
|
-
//@ts-ignore
|
|
92
|
-
<a
|
|
93
|
-
target="_blank"
|
|
94
|
-
className={cn(
|
|
95
|
-
"text-primary font-medium underline underline-offset-4",
|
|
96
|
-
className,
|
|
97
|
-
)}
|
|
98
|
-
{...props}
|
|
99
|
-
/>
|
|
100
|
-
),
|
|
101
|
-
blockquote: ({ node: _node, className, ...props }) => (
|
|
102
|
-
//@ts-ignore
|
|
103
|
-
<blockquote
|
|
104
|
-
className={cn("border-l-2 pl-6 italic", className)}
|
|
105
|
-
{...props}
|
|
106
|
-
/>
|
|
107
|
-
),
|
|
108
|
-
ul: ({ node: _node, className, ...props }) => (
|
|
109
|
-
//@ts-ignore
|
|
110
|
-
<ul
|
|
111
|
-
className={cn("my-5 ml-6 list-disc [&>li]:mt-2", className)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
),
|
|
115
|
-
ol: ({ node: _node, className, ...props }) => (
|
|
116
|
-
//@ts-ignore
|
|
117
|
-
<ol
|
|
118
|
-
className={cn("my-5 ml-6 list-decimal [&>li]:mt-2", className)}
|
|
119
|
-
{...props}
|
|
120
|
-
/>
|
|
121
|
-
),
|
|
122
|
-
hr: ({ node: _node, className, ...props }) => (
|
|
123
|
-
//@ts-ignore
|
|
124
|
-
<hr className={cn("my-5 border-b", className)} {...props} />
|
|
125
|
-
),
|
|
126
|
-
table: ({ node: _node, className, ...props }) => (
|
|
127
|
-
//@ts-ignore
|
|
128
|
-
//@ts-ignore
|
|
129
|
-
<table
|
|
130
|
-
className={cn(
|
|
131
|
-
"my-5 w-full border-separate border-spacing-0 overflow-y-auto",
|
|
132
|
-
className,
|
|
133
|
-
)}
|
|
134
|
-
{...props}
|
|
135
|
-
/>
|
|
136
|
-
),
|
|
137
|
-
th: ({ node: _node, className, ...props }) => (
|
|
138
|
-
//@ts-ignore
|
|
139
|
-
<th
|
|
140
|
-
className={cn(
|
|
141
|
-
"bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right",
|
|
142
|
-
className,
|
|
143
|
-
)}
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
),
|
|
147
|
-
td: ({ node: _node, className, ...props }) => (
|
|
148
|
-
//@ts-ignore
|
|
149
|
-
<td
|
|
150
|
-
className={cn(
|
|
151
|
-
"border-b border-l px-4 py-2 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right",
|
|
152
|
-
className,
|
|
153
|
-
)}
|
|
154
|
-
{...props}
|
|
155
|
-
/>
|
|
156
|
-
),
|
|
157
|
-
tr: ({ node: _node, className, ...props }) => (
|
|
158
|
-
//@ts-ignore
|
|
159
|
-
<tr
|
|
160
|
-
className={cn(
|
|
161
|
-
"m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",
|
|
162
|
-
className,
|
|
163
|
-
)}
|
|
164
|
-
{...props}
|
|
165
|
-
/>
|
|
166
|
-
),
|
|
167
|
-
sup: ({ node: _node, className, ...props }) => (
|
|
168
|
-
//@ts-ignore
|
|
169
|
-
<sup
|
|
170
|
-
className={cn("[&>a]:text-xs [&>a]:no-underline", className)}
|
|
171
|
-
{...props}
|
|
172
|
-
/>
|
|
173
|
-
),
|
|
174
|
-
pre: ({ node: _node, className, ...props }) => (
|
|
175
|
-
//@ts-ignore
|
|
176
|
-
<pre
|
|
177
|
-
className={cn(
|
|
178
|
-
"overflow-x-auto rounded-b-lg bg-black p-4 text-white",
|
|
179
|
-
className,
|
|
180
|
-
)}
|
|
181
|
-
{...props}
|
|
182
|
-
/>
|
|
183
|
-
),
|
|
184
|
-
code: function Code({ node: _node, className, ...props }) {
|
|
185
|
-
const isCodeBlock = useIsMarkdownCodeBlock();
|
|
186
|
-
return (
|
|
187
|
-
//@ts-ignore
|
|
188
|
-
<code
|
|
189
|
-
className={cn(
|
|
190
|
-
!isCodeBlock && "bg-aui-muted rounded border font-semibold",
|
|
191
|
-
className,
|
|
192
|
-
)}
|
|
193
|
-
{...props}
|
|
194
|
-
/>
|
|
195
|
-
);
|
|
196
|
-
},
|
|
197
|
-
CodeHeader,
|
|
198
|
-
SyntaxHighlighter,
|
|
199
|
-
}}
|
|
200
|
-
/>
|
|
201
|
-
);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export const MarkdownText = memo(MarkdownTextImpl);
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { makePrismAsyncLightSyntaxHighlighter } from "@assistant-ui/react-syntax-highlighter";
|
|
3
|
-
import { PrismAsyncLight } from "react-syntax-highlighter";
|
|
4
|
-
|
|
5
|
-
import python from "react-syntax-highlighter/dist/esm/languages/prism/python";
|
|
6
|
-
import tsx from "react-syntax-highlighter/dist/esm/languages/prism/tsx";
|
|
7
|
-
|
|
8
|
-
import { coldarkDark } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
|
9
|
-
|
|
10
|
-
// register languages you want to support
|
|
11
|
-
PrismAsyncLight.registerLanguage("js", tsx);
|
|
12
|
-
PrismAsyncLight.registerLanguage("jsx", tsx);
|
|
13
|
-
PrismAsyncLight.registerLanguage("ts", tsx);
|
|
14
|
-
PrismAsyncLight.registerLanguage("tsx", tsx);
|
|
15
|
-
PrismAsyncLight.registerLanguage("python", python);
|
|
16
|
-
|
|
17
|
-
export const SyntaxHighlighter = makePrismAsyncLightSyntaxHighlighter({
|
|
18
|
-
style: coldarkDark,
|
|
19
|
-
customStyle: {
|
|
20
|
-
margin: 0,
|
|
21
|
-
width: "100%",
|
|
22
|
-
background: "transparent",
|
|
23
|
-
padding: "1.5rem 1rem",
|
|
24
|
-
},
|
|
25
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ComposerPrimitive,
|
|
5
|
-
MessagePrimitive,
|
|
6
|
-
ThreadPrimitive,
|
|
7
|
-
} from "@assistant-ui/react";
|
|
8
|
-
import type { FC } from "react";
|
|
9
|
-
|
|
10
|
-
import { SendHorizonalIcon } from "lucide-react";
|
|
11
|
-
import { Avatar, AvatarFallback } from "../ui/avatar";
|
|
12
|
-
|
|
13
|
-
export const Thread: FC = () => {
|
|
14
|
-
return (
|
|
15
|
-
<ThreadPrimitive.Root className="flex h-full flex-col items-center pb-3">
|
|
16
|
-
<ThreadPrimitive.Viewport className="flex w-full flex-grow flex-col items-center overflow-y-scroll scroll-smooth px-4 pt-12">
|
|
17
|
-
<ThreadPrimitive.Empty>
|
|
18
|
-
<ThreadEmpty />
|
|
19
|
-
</ThreadPrimitive.Empty>
|
|
20
|
-
|
|
21
|
-
<ThreadPrimitive.Messages
|
|
22
|
-
components={{
|
|
23
|
-
UserMessage,
|
|
24
|
-
AssistantMessage,
|
|
25
|
-
}}
|
|
26
|
-
/>
|
|
27
|
-
</ThreadPrimitive.Viewport>
|
|
28
|
-
|
|
29
|
-
<Composer />
|
|
30
|
-
</ThreadPrimitive.Root>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const ThreadEmpty: FC = () => {
|
|
35
|
-
return (
|
|
36
|
-
<div className="flex flex-grow flex-col items-center justify-center">
|
|
37
|
-
<Avatar>
|
|
38
|
-
<AvatarFallback>C</AvatarFallback>
|
|
39
|
-
</Avatar>
|
|
40
|
-
<p className="mt-4 text-xl">How can I help you today?</p>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const Composer: FC = () => {
|
|
46
|
-
return (
|
|
47
|
-
<ComposerPrimitive.Root className="flex w-[calc(100%-32px)] max-w-[40rem] items-end rounded-lg border p-0.5 transition-shadow focus-within:shadow-sm">
|
|
48
|
-
<ComposerPrimitive.Input
|
|
49
|
-
placeholder="Write a message..."
|
|
50
|
-
className="h-12 max-h-40 flex-grow resize-none bg-transparent p-3.5 text-sm outline-none placeholder:text-foreground/50"
|
|
51
|
-
/>
|
|
52
|
-
<ComposerPrimitive.Send className="m-2 flex h-8 w-8 items-center justify-center rounded-md bg-foreground font-bold text-2xl shadow transition-opacity disabled:opacity-10">
|
|
53
|
-
<SendHorizonalIcon className="size-4 text-background" />
|
|
54
|
-
</ComposerPrimitive.Send>
|
|
55
|
-
</ComposerPrimitive.Root>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const UserMessage: FC = () => {
|
|
60
|
-
return (
|
|
61
|
-
<MessagePrimitive.Root className="relative flex w-full max-w-2xl gap-3 pb-12">
|
|
62
|
-
<Avatar>
|
|
63
|
-
<AvatarFallback>Y</AvatarFallback>
|
|
64
|
-
</Avatar>
|
|
65
|
-
|
|
66
|
-
<div className="flex-grow">
|
|
67
|
-
<p className="font-semibold">You</p>
|
|
68
|
-
|
|
69
|
-
<p className="whitespace-pre-line text-foreground">
|
|
70
|
-
<MessagePrimitive.Content />
|
|
71
|
-
</p>
|
|
72
|
-
</div>
|
|
73
|
-
</MessagePrimitive.Root>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const AssistantMessage: FC = () => {
|
|
78
|
-
return (
|
|
79
|
-
<MessagePrimitive.Root className="relative flex w-full max-w-2xl gap-3 pb-12">
|
|
80
|
-
<Avatar>
|
|
81
|
-
<AvatarFallback>A</AvatarFallback>
|
|
82
|
-
</Avatar>
|
|
83
|
-
|
|
84
|
-
<div className="flex-grow">
|
|
85
|
-
<p className="font-semibold">Assistant</p>
|
|
86
|
-
|
|
87
|
-
<p className="whitespace-pre-line text-foreground">
|
|
88
|
-
<MessagePrimitive.Content />
|
|
89
|
-
</p>
|
|
90
|
-
</div>
|
|
91
|
-
</MessagePrimitive.Root>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
|
|
5
|
-
import { cn } from "../lib/utils";
|
|
6
|
-
import { Button, type ButtonProps } from "../ui/button";
|
|
7
|
-
import {
|
|
8
|
-
Tooltip,
|
|
9
|
-
TooltipContent,
|
|
10
|
-
TooltipProvider,
|
|
11
|
-
TooltipTrigger,
|
|
12
|
-
} from "../ui/tooltip";
|
|
13
|
-
|
|
14
|
-
export type TooltipIconButtonProps = ButtonProps & {
|
|
15
|
-
tooltip: string | React.ReactNode;
|
|
16
|
-
side?: "top" | "bottom" | "left" | "right";
|
|
17
|
-
/**
|
|
18
|
-
* @default 700
|
|
19
|
-
*/
|
|
20
|
-
delayDuration?: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const TooltipIconButton = forwardRef<
|
|
24
|
-
HTMLButtonElement,
|
|
25
|
-
TooltipIconButtonProps
|
|
26
|
-
>(
|
|
27
|
-
(
|
|
28
|
-
{ children, tooltip, side = "bottom", className, delayDuration, ...rest },
|
|
29
|
-
ref,
|
|
30
|
-
) => {
|
|
31
|
-
return (
|
|
32
|
-
<TooltipProvider>
|
|
33
|
-
<Tooltip delayDuration={delayDuration ?? 700}>
|
|
34
|
-
<TooltipTrigger asChild>
|
|
35
|
-
<Button
|
|
36
|
-
variant="ghost"
|
|
37
|
-
size="icon"
|
|
38
|
-
{...rest}
|
|
39
|
-
className={cn("size-6 p-1", className)}
|
|
40
|
-
ref={ref}
|
|
41
|
-
>
|
|
42
|
-
{children}
|
|
43
|
-
<span className="sr-only">{tooltip}</span>
|
|
44
|
-
</Button>
|
|
45
|
-
</TooltipTrigger>
|
|
46
|
-
<TooltipContent side={side}>{tooltip}</TooltipContent>
|
|
47
|
-
</Tooltip>
|
|
48
|
-
</TooltipProvider>
|
|
49
|
-
);
|
|
50
|
-
},
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
TooltipIconButton.displayName = "TooltipIconButton";
|
package/src/cli/build_tsc.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {} from "node:child_process";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { exec } from "../lib/exec";
|
|
5
|
-
|
|
6
|
-
export const buildWithTsc = async () => {
|
|
7
|
-
try {
|
|
8
|
-
// Run TypeScript compiler programmatically
|
|
9
|
-
const tsconfig = path.resolve("./tsconfig.json");
|
|
10
|
-
console.log("tsconfig path:", tsconfig);
|
|
11
|
-
const commandLine = `tsc --outDir dist --jsx react-jsx --incremental false --declaration true --noEmit false --removeComments true --project ${tsconfig}`;
|
|
12
|
-
console.log("(mtxuilib)build tsc", commandLine);
|
|
13
|
-
await exec(commandLine);
|
|
14
|
-
|
|
15
|
-
// Copy styles directory recursively using Node.js fs
|
|
16
|
-
const copyDir = (src: string, dest: string) => {
|
|
17
|
-
if (!fs.existsSync(dest)) {
|
|
18
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
22
|
-
|
|
23
|
-
for (const entry of entries) {
|
|
24
|
-
const srcPath = path.join(src, entry.name);
|
|
25
|
-
const destPath = path.join(dest, entry.name);
|
|
26
|
-
|
|
27
|
-
if (entry.isDirectory()) {
|
|
28
|
-
copyDir(srcPath, destPath);
|
|
29
|
-
} else {
|
|
30
|
-
fs.copyFileSync(srcPath, destPath);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
copyDir("src/styles", "dist/styles");
|
|
36
|
-
} catch (e) {
|
|
37
|
-
console.error("执行 buildWithTsc 失败", e);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
};
|
package/src/cli/build_vite.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {} from "node:child_process";
|
|
2
|
-
import { exec } from "../lib/exec";
|
|
3
|
-
|
|
4
|
-
export async function buildWithViteBuild() {
|
|
5
|
-
try {
|
|
6
|
-
await exec("vite build --logLevel warn --emptyOutDir=false");
|
|
7
|
-
} catch (e) {
|
|
8
|
-
console.error("执行 vite build 失败", e);
|
|
9
|
-
throw e;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { readMigrationFiles } from "drizzle-orm/migrator";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { cwd } from "node:process";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 编译migrations.json 为 在浏览器端 实现 drizzle + pglite 的 migrate 功能
|
|
7
|
-
* 参考: https://github.com/drizzle-team/drizzle-orm/discussions/2532
|
|
8
|
-
*/
|
|
9
|
-
export async function compileMigrations() {
|
|
10
|
-
const drizzleMigrationsFolder = join(cwd(), "./src/db/migrations");
|
|
11
|
-
// console.log("drizzleMigrationsFolder", drizzleMigrationsFolder);
|
|
12
|
-
const migrations = readMigrationFiles({
|
|
13
|
-
migrationsFolder: drizzleMigrationsFolder,
|
|
14
|
-
});
|
|
15
|
-
const outputPath = join(
|
|
16
|
-
drizzleMigrationsFolder,
|
|
17
|
-
"pglite_full_migrations.json",
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
await Bun.write(outputPath, JSON.stringify(migrations));
|
|
21
|
-
|
|
22
|
-
console.log("pglite_full_migrations compiled:\n", outputPath);
|
|
23
|
-
}
|
package/src/cli/main.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { program } from "commander";
|
|
3
|
-
import dotenv from "dotenv";
|
|
4
|
-
import fs from "node:fs";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { exec } from "../lib/exec";
|
|
8
|
-
import { buildWithTsc } from "./build_tsc";
|
|
9
|
-
import { buildWithViteBuild } from "./build_vite";
|
|
10
|
-
import { compileMigrations } from "./compile-migrations";
|
|
11
|
-
|
|
12
|
-
const envFiles = ["../../env/dev.env", "./env/dev.env", ".env"];
|
|
13
|
-
function loadEnv() {
|
|
14
|
-
// biome-ignore lint/complexity/noForEach: <explanation>
|
|
15
|
-
envFiles.forEach((envFile) => {
|
|
16
|
-
if (fs.existsSync(envFile)) {
|
|
17
|
-
const envPath = path.resolve(envFile);
|
|
18
|
-
const dotenvConfig = dotenv.config({
|
|
19
|
-
path: envPath,
|
|
20
|
-
});
|
|
21
|
-
if (dotenvConfig.error) {
|
|
22
|
-
throw new Error("parse env error", dotenvConfig.error);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
(async () => {
|
|
28
|
-
await loadEnv();
|
|
29
|
-
program.command("build").action(async () => {
|
|
30
|
-
console.log("(mtxuilib)build vite");
|
|
31
|
-
await buildWithViteBuild();
|
|
32
|
-
console.log("(mtxuilib)build tsc");
|
|
33
|
-
await buildWithTsc();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
program.command("gen").action(async () => {
|
|
37
|
-
try {
|
|
38
|
-
await exec("drizzle-kit generate");
|
|
39
|
-
await compileMigrations();
|
|
40
|
-
} catch (e) {
|
|
41
|
-
console.error("执行 compile-migrations 失败", e);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
program.command("dp_workflow").action(async () => {
|
|
46
|
-
try {
|
|
47
|
-
const codeRoot = path.resolve(
|
|
48
|
-
path.dirname(fileURLToPath(import.meta.url)),
|
|
49
|
-
"../",
|
|
50
|
-
);
|
|
51
|
-
const cmd = `cd ${codeRoot} && bun run dp_workflow`;
|
|
52
|
-
console.log("执行命令:", cmd);
|
|
53
|
-
await exec(cmd);
|
|
54
|
-
} catch (e) {
|
|
55
|
-
console.error("执行 dp_workflow 失败", e);
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
program.parse();
|
|
60
|
-
})();
|
|
61
|
-
|
|
62
|
-
// 构建tailwindcss 样式
|
|
63
|
-
// console.log("build tailwindcss 样式");
|
|
64
|
-
// await exec(
|
|
65
|
-
// "bun run tailwindcss -i ./src/styles/globals.css -o ./dist/globals.css",
|
|
66
|
-
// );
|