diff --git a/.dumirc.ts b/.dumirc.ts index 2cd43114..6254cc76 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -73,11 +73,11 @@ const themeConfig = { sidebarGroupModePath: ['/components'], nav: [ { link: '/components/chat-input-area', title: 'Components' }, + { link: '/changelog', title: 'Changelog' }, + { link: 'https://ui.lobehub.com/', title: 'LobeHub UI' }, { link: 'https://ant.design/components/overview', title: 'Antd Components' }, - // { link: '/colors', title: 'Colors' }, { link: 'https://lucide.dev/icons', title: 'Lucide Icons' }, { link: 'https://ant-design.github.io/antd-style', title: 'CSSinJS' }, - { link: '/changelog', title: 'Changelog' }, ], socialLinks: { // discord: 'https://discord.gg/AYFPHvv2jT', @@ -113,7 +113,6 @@ export default defineConfig({ }`, ], themeConfig, - title: 'Yunti UI', exportStatic: { // 忽略预渲染失败的错误 ignorePreRenderError: true, diff --git a/.gitignore b/.gitignore index 46f0fcd1..0f5e67bc 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ test-output .umi-production .umi-test .dumi/tmp* +server # husky .husky/prepare-commit-msg diff --git a/package.json b/package.json index 74a65b41..4a324126 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "dev:father": "father dev", "docs:build": "dumi build", "docs:build-analyze": "ANALYZE=1 dumi build", + "docs:build-nc": "COMPRESS=none dumi build", "docs:dev": "dumi dev", "docs:preview": "dumi preview --port 9000", "doctor": "father doctor", @@ -85,8 +86,9 @@ "@lexical/selection": "^0.16.1", "@lexical/text": "^0.16.1", "@lexical/utils": "^0.16.1", - "@lobehub/ui": "^1.146.4", + "@lobehub/ui": "^1.147.0", "@melloware/react-logviewer": "^5.1.1", + "@monaco-editor/loader": "^1.4.0", "@shikijs/transformers": "^1.10.3", "leva": "^0", "lexical": "^0.16.1", @@ -108,8 +110,8 @@ "@types/react-dom": "^18", "@vitest/coverage-v8": "latest", "@yuntijs/lint": "^1.7.0", - "antd": "^5.19.0", - "antd-style": "^3.6.1", + "antd": "^5.19.3", + "antd-style": "^3.6.2", "babel-plugin-antd-style": "latest", "commitlint": "^18", "dayjs": "^1.11.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 54a6080b..d67aedc6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,11 +30,14 @@ importers: specifier: ^0.16.1 version: 0.16.1 '@lobehub/ui': - specifier: ^1.146.4 - version: 1.146.4(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + specifier: ^1.147.0 + version: 1.147.0(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@melloware/react-logviewer': specifier: ^5.1.1 version: 5.1.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + '@monaco-editor/loader': + specifier: ^1.4.0 + version: 1.4.0(monaco-editor@0.45.0) '@shikijs/transformers': specifier: ^1.10.3 version: 1.10.3 @@ -94,11 +97,11 @@ importers: specifier: ^1.7.0 version: 1.7.0(@octokit/core@5.0.2)(encoding@0.1.13)(eslint@8.56.0)(jest@27.5.1)(postcss@8.4.32)(prettier@3.1.1)(semantic-release@21.1.2(typescript@5.3.3))(stylelint@15.11.0(typescript@5.3.3))(typescript@5.3.3) antd: - specifier: ^5.19.0 - version: 5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + specifier: ^5.19.3 + version: 5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0) antd-style: - specifier: ^3.6.1 - version: 3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + specifier: ^3.6.2 + version: 3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) babel-plugin-antd-style: specifier: latest version: 1.0.4 @@ -110,10 +113,10 @@ importers: version: 1.11.10 dumi: specifier: ^2.4.6 - version: 2.4.6(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0) + version: 2.4.7(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0) dumi-theme-yunti: specifier: ^1.1.1 - version: 1.1.1(@giscus/react@3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@lobehub/ui@1.146.4(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(dumi@2.4.6(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0))(immer@10.1.1)(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react-layout-kit@1.7.4(react@18.2.0))(react@18.2.0) + version: 1.1.3(@giscus/react@3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@lobehub/ui@1.147.0(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(dumi@2.4.7(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0))(immer@10.1.1)(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react-layout-kit@1.7.4(react@18.2.0))(react@18.2.0) eslint: specifier: ^8.56.0 version: 8.56.0 @@ -185,14 +188,8 @@ packages: '@ant-design/colors@7.0.0': resolution: {integrity: sha512-iVm/9PfGCbC0dSMBrz7oiEXZaaGH7ceU40OJEfKmyuzR9R5CRimJYPlRiFtMQGQcbNMea/ePcoIebi4ASGYXtg==} - '@ant-design/colors@7.0.2': - resolution: {integrity: sha512-7KJkhTiPiLHSu+LmMJnehfJ6242OCxSlR3xHVBecYxnMW8MS/878NXct1GqYARyL59fyeFdKRxXTfvR9SnDgJg==} - - '@ant-design/cssinjs@1.18.2': - resolution: {integrity: sha512-514V9rjLaFYb3v4s55/8bg2E6fb81b99s3crDZf4nSwtiDLLXs8axnIph+q2TVkY2hbJPZOn/cVsVcnLkzFy7w==} - peerDependencies: - react: '>=16.0.0' - react-dom: '>=16.0.0' + '@ant-design/colors@7.1.0': + resolution: {integrity: sha512-MMoDGWn1y9LdQJQSHiCC20x3uZ3CwQnv9QMz6pCmJOrqdgM9YxsoVVY0wtrdXbmfSgnV0KNk6zi09NAhMR2jvg==} '@ant-design/cssinjs@1.21.0': resolution: {integrity: sha512-gIilraPl+9EoKdYxnupxjHB/Q6IHNRjEXszKbDxZdsgv4sAZ9pjkCq8yanDWNvyfjp4leir2OVAJm0vxwKK8YA==} @@ -444,6 +441,10 @@ packages: resolution: {integrity: sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==} engines: {node: '>=6.9.0'} + '@babel/runtime@7.25.0': + resolution: {integrity: sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==} + engines: {node: '>=6.9.0'} + '@babel/template@7.22.15': resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} engines: {node: '>=6.9.0'} @@ -706,8 +707,8 @@ packages: '@emotion/memoize@0.9.0': resolution: {integrity: sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ==} - '@emotion/react@11.11.3': - resolution: {integrity: sha512-Cnn0kuq4DoONOMcnoVsTOR8E+AdnKFf//6kUWc4LCdnxj31pZWn7rIULd6Y7/Js1PiPHzn7SKCM9vB/jBni8eA==} + '@emotion/react@11.13.0': + resolution: {integrity: sha512-WkL+bw1REC2VNV1goQyfxjx1GYJkcc23CRQkXX+vZNLINyfI7o+uUn/rTGPt/xJ3bJHd5GcljgnxHf4wRw5VWQ==} peerDependencies: '@types/react': '*' react: '>=16.8.0' @@ -744,8 +745,8 @@ packages: '@emotion/unitless@0.9.0': resolution: {integrity: sha512-TP6GgNZtmtFaFcsOgExdnfxLLpRDla4Q66tnenA9CktvVSdNKDvMVuUah4QvWPIpNjrWsGg3qeGo9a43QooGZQ==} - '@emotion/use-insertion-effect-with-fallbacks@1.0.1': - resolution: {integrity: sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==} + '@emotion/use-insertion-effect-with-fallbacks@1.1.0': + resolution: {integrity: sha512-+wBOcIV5snwGgI2ya3u99D7/FJquOIniQT1IKyDsBmEgwvpxMNeS65Oib7OnE2d2aY+3BU4OiH+0Wchf8yk3Hw==} peerDependencies: react: '>=16.8.0' @@ -1621,8 +1622,8 @@ packages: '@lobehub/emojilib@1.0.0': resolution: {integrity: sha512-s9KnjaPjsEefaNv150G3aifvB+J3P4eEKG+epY9zDPS2BeB6+V2jELWqAZll+nkogMaVovjEE813z3V751QwGw==} - '@lobehub/ui@1.146.4': - resolution: {integrity: sha512-jDrbGeUXNf42ZGjrQaGQ28FZWNOuwQ8NP8zKeObFeO2YM6qOMC4QMZzxOhveXZf1bPsunS8i+N+gi6B4IfozJQ==} + '@lobehub/ui@1.147.0': + resolution: {integrity: sha512-bjZbvtUAAX4e91tJLrCbnx5JVMWxSucPr9VUWQBFMfrmNSPZgESx4tmkY2rMWPf4z3jbjH5Q1SONDNmEtKpeyQ==} peerDependencies: ahooks: '>=3' antd: '>=5.13.0' @@ -1661,6 +1662,11 @@ packages: peerDependencies: monaco-editor: '>= 0.21.0 < 1' + '@monaco-editor/loader@1.4.0': + resolution: {integrity: sha512-00ioBig0x642hytVspPl7DbQyaSWRaolYie/UFNjoTdvoKPzo6xrXLhTk9ixgIKcLH5b5vDOjVNiGyY+uDCUlg==} + peerDependencies: + monaco-editor: '>= 0.21.0 < 1' + '@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1': resolution: {integrity: sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==} @@ -3266,14 +3272,14 @@ packages: ansicolors@0.3.2: resolution: {integrity: sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==} - antd-style@3.6.1: - resolution: {integrity: sha512-KpKXiAIV3CAe6TfSh/m6ET2vGuhAof7qfqeaouh5WZ0JDl5jDXXSFPeEfqvZuHAckTl+A0NzArvIHKgKt/NZ9g==} + antd-style@3.6.2: + resolution: {integrity: sha512-p6tRV63+U9yp3T3DB4ope1Xs3VdkhNsPD+yiZMJnR57dclPQPtrNnrGBmdGwjWYP1HlzB1XS4JHqFAyMjvObHA==} peerDependencies: antd: '>=5.8.1' react: '>=18' - antd@5.19.0: - resolution: {integrity: sha512-+w+3zJUKqwU1GSXUxnKhzSGuWUqwwpHQm/voJr2X0JBdYxr9gkLhKR0HBhQjVSSJzSb86rB48fUbByHKrN05Xg==} + antd@5.19.3: + resolution: {integrity: sha512-rhGI6yyZ4dA2MWl9bfO0MZjtNwWdzITpp3u7pKLiQpTjJYFlpF5wDFgGaG1or3sqyBihvqcO/OF1hSggmWczbQ==} peerDependencies: react: '>=16.9.0' react-dom: '>=16.9.0' @@ -4474,8 +4480,8 @@ packages: dumi-assets-types@2.3.0: resolution: {integrity: sha512-mM6UoGTgTNoo8lA4dwaIwoeSGT+4PeQeiFylr2+kCB5z3/7NEf7lIM4tqrAsEyzecE/HX0+w7Z78hnFZQ9k5vQ==} - dumi-theme-yunti@1.1.1: - resolution: {integrity: sha512-txDOSKNc3sMHVzAcf2icACOCCT5qcyqnv5x48AF6oosvOWI3GCFYeap+jI3YmO0tAU2F97o+OCykHmnhwqQGpQ==} + dumi-theme-yunti@1.1.3: + resolution: {integrity: sha512-gY3pIgU24fOwCy/5rcnTKfjU3iUD6sF+xfFUFfnQsgUPFHoW6umLG/SWZCYvESt95EFKnIh9KtEUUsB6sfYLww==} peerDependencies: '@giscus/react': '>=3' '@lobehub/ui': '>=1' @@ -4486,8 +4492,8 @@ packages: react-dom: '>=18' react-layout-kit: '>=1' - dumi@2.4.6: - resolution: {integrity: sha512-ly8Z8CwKoNvqqqzCXLtXPv7MECU3HgtGuc4r80FQ2O2/1IVmzI7gREfGGebohSnvuZTpGQx00XYFD2qbBuaziA==} + dumi@2.4.7: + resolution: {integrity: sha512-JkBq0/YxVjQkI4CA0dV8LucZ5xeTryXB+yjuMAFyK5jGEqbA7OFYkBXLfvaX5Fv960xkmB2xqp1K8YATGejxcQ==} hasBin: true peerDependencies: react: '>=16.8' @@ -8487,8 +8493,8 @@ packages: react: '>=16.9.0' react-dom: '>=16.9.0' - rc-picker@4.6.6: - resolution: {integrity: sha512-sEWARCNlodubP7/IM6nXHDDIuKZ3gYd5CpS2cYcNORa2telX3nAfllqnGSGjGEFvdtyW+IqGAVatLOmFT0lKYg==} + rc-picker@4.6.9: + resolution: {integrity: sha512-kwQq5xDNJ1VcX7pauLlVBiuQorpZGUwA/YczVJTO1e33YsTyDuVjaQkYAiAupXbEPUBCU3doGZo0J25HGq2ZOQ==} engines: {node: '>=8.x'} peerDependencies: date-fns: '>= 2.x' @@ -8532,8 +8538,8 @@ packages: react: '>=16.0.0' react-dom: '>=16.0.0' - rc-select@14.15.0: - resolution: {integrity: sha512-BDqnDLhhm/8VyyyDlX7ju06S75k6ObJvbsN86zqZ4SY1Fu2ANQxeSWPo7pnwx5nwA5JgG+HcQevtddAgsdeBVQ==} + rc-select@14.15.1: + resolution: {integrity: sha512-mGvuwW1RMm1NCSI8ZUoRoLRK51R2Nb+QJnmiAvbDRcjh2//ulCkxeV6ZRFTECPpE1t2DPfyqZMPw90SVJzQ7wQ==} engines: {node: '>=8.x'} peerDependencies: react: '*' @@ -8605,8 +8611,8 @@ packages: react: '*' react-dom: '*' - rc-upload@4.5.2: - resolution: {integrity: sha512-QO3ne77DwnAPKFn0bA5qJM81QBjQi0e0NHdkvpFyY73Bea2NfITiotqJqVjHgeYPOJu5lLVR32TNGP084aSoXA==} + rc-upload@4.6.0: + resolution: {integrity: sha512-Zr0DT1NHw/ApxrP7UAoxOtGaVYuzarrrCVr0ld7RiEFsKX07uFhE1EpCBxwL11ruFn89GMcshOKWp+s6FLyAlA==} peerDependencies: react: '>=16.9.0' react-dom: '>=16.9.0' @@ -9875,9 +9881,6 @@ packages: stylis@4.2.0: resolution: {integrity: sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==} - stylis@4.3.0: - resolution: {integrity: sha512-E87pIogpwUsUwXw7dNyU4QDjdgVMy52m+XEOPEKUn161cCzWjjhPSQhByfd1CcNvrOLnXQ6OnnZDwnJrz/Z4YQ==} - stylis@4.3.2: resolution: {integrity: sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==} @@ -10042,8 +10045,8 @@ packages: throat@6.0.2: resolution: {integrity: sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ==} - throttle-debounce@5.0.0: - resolution: {integrity: sha512-2iQTSgkkc1Zyk0MeVrt/3BvuOXYPl/R8Z0U2xxo9rjwNciaHDG3R+Lm6dh4EeUci49DanvBnuqI6jshoQQRGEg==} + throttle-debounce@5.0.2: + resolution: {integrity: sha512-B71/4oyj61iNH0KeCamLuE2rmKuTO5byTOSVwECM5FA7TiAiAW+UqTKZ9ERueC4qvgSttUhdmq1mXC3kJqGX7A==} engines: {node: '>=12.22'} through2@0.4.2: @@ -11057,22 +11060,10 @@ snapshots: dependencies: '@ctrl/tinycolor': 3.6.1 - '@ant-design/colors@7.0.2': + '@ant-design/colors@7.1.0': dependencies: '@ctrl/tinycolor': 3.6.1 - '@ant-design/cssinjs@1.18.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': - dependencies: - '@babel/runtime': 7.23.6 - '@emotion/hash': 0.8.0 - '@emotion/unitless': 0.7.5 - classnames: 2.3.3 - csstype: 3.1.3 - rc-util: 5.38.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - stylis: 4.3.0 - '@ant-design/cssinjs@1.21.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: '@babel/runtime': 7.24.7 @@ -11101,9 +11092,9 @@ snapshots: '@ant-design/icons@5.3.7(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@ant-design/colors': 7.0.2 + '@ant-design/colors': 7.1.0 '@ant-design/icons-svg': 4.4.2 - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -11111,12 +11102,12 @@ snapshots: '@ant-design/react-slick@1.1.2(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 json2mq: 0.2.0 react: 18.2.0 resize-observer-polyfill: 1.5.1 - throttle-debounce: 5.0.0 + throttle-debounce: 5.0.2 '@antfu/install-pkg@0.1.1': dependencies: @@ -11396,6 +11387,10 @@ snapshots: dependencies: regenerator-runtime: 0.14.1 + '@babel/runtime@7.25.0': + dependencies: + regenerator-runtime: 0.14.1 + '@babel/template@7.22.15': dependencies: '@babel/code-frame': 7.23.5 @@ -11731,7 +11726,7 @@ snapshots: '@emotion/babel-plugin@11.11.0': dependencies: '@babel/helper-module-imports': 7.22.15 - '@babel/runtime': 7.23.6 + '@babel/runtime': 7.25.0 '@emotion/hash': 0.9.1 '@emotion/memoize': 0.8.1 '@emotion/serialize': 1.1.3 @@ -11798,15 +11793,15 @@ snapshots: '@emotion/memoize@0.9.0': {} - '@emotion/react@11.11.3(@types/react@18.2.40)(react@18.2.0)': + '@emotion/react@11.13.0(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.23.6 - '@emotion/babel-plugin': 11.11.0 - '@emotion/cache': 11.11.0 - '@emotion/serialize': 1.1.3 - '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@18.2.0) - '@emotion/utils': 1.2.1 - '@emotion/weak-memoize': 0.3.1 + '@babel/runtime': 7.24.7 + '@emotion/babel-plugin': 11.12.0 + '@emotion/cache': 11.13.1 + '@emotion/serialize': 1.3.0 + '@emotion/use-insertion-effect-with-fallbacks': 1.1.0(react@18.2.0) + '@emotion/utils': 1.4.0 + '@emotion/weak-memoize': 0.4.0 hoist-non-react-statics: 3.3.2 react: 18.2.0 optionalDependencies: @@ -11828,15 +11823,6 @@ snapshots: '@emotion/utils': 1.4.0 csstype: 3.1.3 - '@emotion/server@11.11.0(@emotion/css@11.11.2)': - dependencies: - '@emotion/utils': 1.2.1 - html-tokenize: 2.0.1 - multipipe: 1.0.2 - through: 2.3.8 - optionalDependencies: - '@emotion/css': 11.11.2 - '@emotion/server@11.11.0(@emotion/css@11.13.0)': dependencies: '@emotion/utils': 1.2.1 @@ -11856,7 +11842,7 @@ snapshots: '@emotion/unitless@0.9.0': {} - '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@18.2.0)': + '@emotion/use-insertion-effect-with-fallbacks@1.1.0(react@18.2.0)': dependencies: react: 18.2.0 @@ -11871,7 +11857,7 @@ snapshots: '@esbuild-kit/cjs-loader@2.4.4': dependencies: '@esbuild-kit/core-utils': 3.3.2 - get-tsconfig: 4.7.2 + get-tsconfig: 4.7.5 '@esbuild-kit/core-utils@3.3.2': dependencies: @@ -11881,7 +11867,7 @@ snapshots: '@esbuild-kit/esm-loader@2.6.5': dependencies: '@esbuild-kit/core-utils': 3.3.2 - get-tsconfig: 4.7.2 + get-tsconfig: 4.7.5 '@esbuild/aix-ppc64@0.19.10': optional: true @@ -12702,21 +12688,21 @@ snapshots: '@loadable/component@5.15.2(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 hoist-non-react-statics: 3.3.2 react: 18.2.0 react-is: 16.13.1 '@loadable/component@5.15.2(react@18.3.1)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 hoist-non-react-statics: 3.3.2 react: 18.3.1 react-is: 16.13.1 '@lobehub/emojilib@1.0.0': {} - '@lobehub/ui@1.146.4(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': + '@lobehub/ui@1.147.0(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: '@babel/runtime': 7.24.7 '@dnd-kit/core': 6.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -12732,8 +12718,8 @@ snapshots: '@shikijs/transformers': 1.10.3 '@splinetool/runtime': 0.9.526 ahooks: 3.8.0(react@18.2.0) - antd: 5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - antd-style: 3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + antd: 5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + antd-style: 3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) chroma-js: 2.4.2 dayjs: 1.11.11 emoji-mart: 5.6.0 @@ -12828,6 +12814,11 @@ snapshots: monaco-editor: 0.45.0 state-local: 1.0.7 + '@monaco-editor/loader@1.4.0(monaco-editor@0.45.0)': + dependencies: + monaco-editor: 0.45.0 + state-local: 1.0.7 + '@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1': dependencies: eslint-scope: 5.1.1 @@ -13048,11 +13039,11 @@ snapshots: '@radix-ui/primitive@1.0.1': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-arrow@1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -13062,21 +13053,21 @@ snapshots: '@radix-ui/react-compose-refs@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 react: 18.2.0 optionalDependencies: '@types/react': 18.2.40 '@radix-ui/react-context@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 react: 18.2.0 optionalDependencies: '@types/react': 18.2.40 '@radix-ui/react-dismissable-layer@1.0.5(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/primitive': 1.0.1 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.40)(react@18.2.0) '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -13090,7 +13081,7 @@ snapshots: '@radix-ui/react-id@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.2.40)(react@18.2.0) react: 18.2.0 optionalDependencies: @@ -13098,7 +13089,7 @@ snapshots: '@radix-ui/react-popper@1.1.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@floating-ui/react-dom': 2.1.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@radix-ui/react-arrow': 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.40)(react@18.2.0) @@ -13127,7 +13118,7 @@ snapshots: '@radix-ui/react-presence@1.0.1(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.40)(react@18.2.0) '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.2.40)(react@18.2.0) react: 18.2.0 @@ -13138,7 +13129,7 @@ snapshots: '@radix-ui/react-primitive@1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-slot': 1.0.2(@types/react@18.2.40)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -13148,7 +13139,7 @@ snapshots: '@radix-ui/react-slot@1.0.2(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.40)(react@18.2.0) react: 18.2.0 optionalDependencies: @@ -13177,14 +13168,14 @@ snapshots: '@radix-ui/react-use-callback-ref@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 react: 18.2.0 optionalDependencies: '@types/react': 18.2.40 '@radix-ui/react-use-controllable-state@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.2.40)(react@18.2.0) react: 18.2.0 optionalDependencies: @@ -13192,7 +13183,7 @@ snapshots: '@radix-ui/react-use-escape-keydown@1.0.3(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.2.40)(react@18.2.0) react: 18.2.0 optionalDependencies: @@ -13200,14 +13191,14 @@ snapshots: '@radix-ui/react-use-layout-effect@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 react: 18.2.0 optionalDependencies: '@types/react': 18.2.40 '@radix-ui/react-use-rect@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/rect': 1.0.1 react: 18.2.0 optionalDependencies: @@ -13215,7 +13206,7 @@ snapshots: '@radix-ui/react-use-size@1.0.1(@types/react@18.2.40)(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-use-layout-effect': 1.0.1(@types/react@18.2.40)(react@18.2.0) react: 18.2.0 optionalDependencies: @@ -13223,7 +13214,7 @@ snapshots: '@radix-ui/react-visually-hidden@1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.18)(@types/react@18.2.40)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -13233,15 +13224,15 @@ snapshots: '@radix-ui/rect@1.0.1': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/async-validator@5.0.4': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/color-picker@1.5.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@ctrl/tinycolor': 3.6.1 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -13250,18 +13241,18 @@ snapshots: '@rc-component/context@1.4.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) '@rc-component/mini-decimal@1.1.0': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/mutate-observer@1.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -13277,7 +13268,7 @@ snapshots: '@rc-component/qrcode@1.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -13285,7 +13276,7 @@ snapshots: '@rc-component/tour@1.15.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/portal': 1.1.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@rc-component/trigger': 2.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 @@ -13295,7 +13286,7 @@ snapshots: '@rc-component/trigger@1.18.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/portal': 1.1.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -14363,7 +14354,7 @@ snapshots: '@umijs/history@5.3.1': dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 query-string: 6.14.1 '@umijs/lint@4.0.90(eslint@8.56.0)(jest@27.5.1)(postcss-less@6.0.0(postcss@8.4.32))(stylelint@15.11.0(typescript@5.3.3))(typescript@5.3.3)': @@ -14908,7 +14899,7 @@ snapshots: ahooks@3.8.0(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 dayjs: 1.11.11 intersection-observer: 0.12.2 js-cookie: 2.2.1 @@ -14981,30 +14972,30 @@ snapshots: ansicolors@0.3.2: {} - antd-style@3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0): + antd-style@3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@ant-design/cssinjs': 1.18.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - '@babel/runtime': 7.23.6 - '@emotion/cache': 11.11.0 - '@emotion/css': 11.11.2 - '@emotion/react': 11.11.3(@types/react@18.2.40)(react@18.2.0) - '@emotion/serialize': 1.1.3 - '@emotion/server': 11.11.0(@emotion/css@11.11.2) - '@emotion/utils': 1.2.1 - antd: 5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + '@ant-design/cssinjs': 1.21.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + '@babel/runtime': 7.24.7 + '@emotion/cache': 11.13.1 + '@emotion/css': 11.13.0 + '@emotion/react': 11.13.0(@types/react@18.2.40)(react@18.2.0) + '@emotion/serialize': 1.3.0 + '@emotion/server': 11.11.0(@emotion/css@11.13.0) + '@emotion/utils': 1.4.0 + antd: 5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 use-merge-value: 1.2.0(react@18.2.0) transitivePeerDependencies: - '@types/react' - react-dom - antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): + antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@ant-design/colors': 7.0.2 + '@ant-design/colors': 7.1.0 '@ant-design/cssinjs': 1.21.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@ant-design/icons': 5.3.7(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@ant-design/react-slick': 1.1.2(react@18.2.0) - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@ctrl/tinycolor': 3.6.1 '@rc-component/color-picker': 1.5.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@rc-component/mutate-observer': 1.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -15029,12 +15020,12 @@ snapshots: rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-notification: 5.6.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-pagination: 4.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - rc-picker: 4.6.6(dayjs@1.11.11)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + rc-picker: 4.6.9(dayjs@1.11.11)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-progress: 4.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-rate: 2.13.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-resize-observer: 1.4.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-segmented: 2.3.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - rc-select: 14.15.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + rc-select: 14.15.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-slider: 10.6.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-steps: 6.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-switch: 4.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -15044,12 +15035,12 @@ snapshots: rc-tooltip: 6.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-tree: 5.8.8(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-tree-select: 5.22.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - rc-upload: 4.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + rc-upload: 4.6.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) scroll-into-view-if-needed: 3.1.0 - throttle-debounce: 5.0.0 + throttle-debounce: 5.0.2 transitivePeerDependencies: - date-fns - luxon @@ -15287,7 +15278,7 @@ snapshots: babel-plugin-macros@3.1.0: dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 cosmiconfig: 7.1.0 resolve: 1.22.8 @@ -16450,18 +16441,18 @@ snapshots: dumi-assets-types@2.3.0: {} - dumi-theme-yunti@1.1.1(@giscus/react@3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@lobehub/ui@1.146.4(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(dumi@2.4.6(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0))(immer@10.1.1)(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react-layout-kit@1.7.4(react@18.2.0))(react@18.2.0): + dumi-theme-yunti@1.1.3(@giscus/react@3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@lobehub/ui@1.147.0(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(dumi@2.4.7(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0))(immer@10.1.1)(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react-layout-kit@1.7.4(react@18.2.0))(react@18.2.0): dependencies: '@ant-design/cssinjs': 1.21.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@emotion/css': 11.13.0 '@emotion/server': 11.11.0(@emotion/css@11.13.0) '@floating-ui/react': 0.26.19(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@giscus/react': 3.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - '@lobehub/ui': 1.146.4(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.1(@types/react@18.2.40)(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + '@lobehub/ui': 1.147.0(@types/react-dom@18.2.18)(@types/react@18.2.40)(ahooks@3.8.0(react@18.2.0))(antd-style@3.6.2(@types/react@18.2.40)(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(antd@5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(lucide-react@0.400.0(react@18.2.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) ahooks: 3.8.0(react@18.2.0) - antd: 5.19.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + antd: 5.19.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0) chalk: 4.1.2 - dumi: 2.4.6(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0) + dumi: 2.4.7(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0) fast-deep-equal: 3.1.3 history: 5.3.0 lodash-es: 4.17.21 @@ -16477,7 +16468,7 @@ snapshots: - '@types/react' - immer - dumi@2.4.6(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0): + dumi@2.4.7(@babel/core@7.23.6)(@swc/helpers@0.5.1)(@types/node@18.19.3)(@types/react@18.2.40)(eslint@8.56.0)(jest@27.5.1)(lightningcss@1.22.1)(prettier@3.1.1)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(rollup@3.29.4)(stylelint@15.11.0(typescript@5.3.3))(terser@5.26.0)(type-fest@4.8.3)(typescript@5.3.3)(webpack@5.89.0): dependencies: '@ant-design/icons-svg': 4.4.2 '@makotot/ghostui': 2.0.0(react@18.2.0) @@ -18092,7 +18083,7 @@ snapshots: history@5.3.0: dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 hmac-drbg@1.0.1: dependencies: @@ -21117,7 +21108,7 @@ snapshots: polished@4.3.1: dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 postcss-attribute-case-insensitive@5.0.2(postcss@8.4.32): dependencies: @@ -21797,10 +21788,10 @@ snapshots: rc-cascader@3.27.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 array-tree-filter: 2.1.0 classnames: 2.5.1 - rc-select: 14.15.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + rc-select: 14.15.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-tree: 5.8.8(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -21808,7 +21799,7 @@ snapshots: rc-checkbox@3.3.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -21816,7 +21807,7 @@ snapshots: rc-collapse@3.7.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21825,7 +21816,7 @@ snapshots: rc-dialog@9.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/portal': 1.1.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21835,7 +21826,7 @@ snapshots: rc-drawer@7.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/portal': 1.1.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21845,7 +21836,7 @@ snapshots: rc-dropdown@4.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/trigger': 1.18.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21854,7 +21845,7 @@ snapshots: rc-dropdown@4.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/trigger': 2.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21863,7 +21854,7 @@ snapshots: rc-field-form@2.2.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/async-validator': 5.0.4 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -21871,14 +21862,14 @@ snapshots: rc-footer@0.6.8(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) rc-image@7.9.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/portal': 1.1.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-dialog: 9.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21889,7 +21880,7 @@ snapshots: rc-input-number@9.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/mini-decimal': 1.1.0 classnames: 2.5.1 rc-input: 1.5.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21899,7 +21890,7 @@ snapshots: rc-input@1.5.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -21907,7 +21898,7 @@ snapshots: rc-mentions@2.14.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/trigger': 2.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-input: 1.5.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21919,7 +21910,7 @@ snapshots: rc-menu@9.12.4(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/trigger': 1.18.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21930,7 +21921,7 @@ snapshots: rc-menu@9.14.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/trigger': 2.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21949,7 +21940,7 @@ snapshots: rc-notification@5.6.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21967,15 +21958,15 @@ snapshots: rc-pagination@4.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - rc-picker@4.6.6(dayjs@1.11.11)(react-dom@18.2.0(react@18.2.0))(react@18.2.0): + rc-picker@4.6.9(dayjs@1.11.11)(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/trigger': 2.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-overflow: 1.3.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -21988,7 +21979,7 @@ snapshots: rc-progress@4.0.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -21996,7 +21987,7 @@ snapshots: rc-rate@2.13.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -22013,28 +22004,28 @@ snapshots: rc-segmented@2.3.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - rc-select@14.15.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): + rc-select@14.15.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/trigger': 2.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-motion: 2.9.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-overflow: 1.3.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - rc-virtual-list: 3.11.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + rc-virtual-list: 3.14.5(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) rc-slider@10.6.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -22042,7 +22033,7 @@ snapshots: rc-steps@6.0.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -22050,7 +22041,7 @@ snapshots: rc-switch@4.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -22058,7 +22049,7 @@ snapshots: rc-table@7.45.7(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 '@rc-component/context': 1.4.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) classnames: 2.5.1 rc-resize-observer: 1.4.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -22069,7 +22060,7 @@ snapshots: rc-tabs@12.15.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-dropdown: 4.1.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-menu: 9.12.4(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -22081,7 +22072,7 @@ snapshots: rc-tabs@15.1.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-dropdown: 4.2.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-menu: 9.14.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -22093,7 +22084,7 @@ snapshots: rc-textarea@1.7.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-input: 1.5.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-resize-observer: 1.4.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -22111,9 +22102,9 @@ snapshots: rc-tree-select@5.22.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 - rc-select: 14.15.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + rc-select: 14.15.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-tree: 5.8.8(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -22129,9 +22120,9 @@ snapshots: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - rc-upload@4.5.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0): + rc-upload@4.6.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0 @@ -22146,7 +22137,7 @@ snapshots: rc-util@5.39.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-is: 18.2.0 @@ -22169,7 +22160,7 @@ snapshots: rc-virtual-list@3.14.5(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 classnames: 2.5.1 rc-resize-observer: 1.4.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) rc-util: 5.43.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -22246,7 +22237,7 @@ snapshots: react-helmet-async@1.3.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 invariant: 2.2.4 prop-types: 15.8.1 react: 18.2.0 @@ -22256,7 +22247,7 @@ snapshots: react-helmet-async@1.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@babel/runtime': 7.24.7 + '@babel/runtime': 7.25.0 invariant: 2.2.4 prop-types: 15.8.1 react: 18.3.1 @@ -22295,7 +22286,7 @@ snapshots: react-layout-kit@1.9.0(react@18.2.0): dependencies: '@babel/runtime': 7.24.7 - '@emotion/css': 11.11.2 + '@emotion/css': 11.13.0 react: 18.2.0 react-loading-skeleton@3.4.0(react@18.2.0): @@ -24151,8 +24142,6 @@ snapshots: stylis@4.2.0: {} - stylis@4.3.0: {} - stylis@4.3.2: {} sucrase@3.35.0: @@ -24339,7 +24328,7 @@ snapshots: throat@6.0.2: {} - throttle-debounce@5.0.0: {} + throttle-debounce@5.0.2: {} through2@0.4.2: dependencies: diff --git a/src/MonacoEditor/base/controller.ts b/src/MonacoEditor/base/controller.ts new file mode 100644 index 00000000..0d3fe72b --- /dev/null +++ b/src/MonacoEditor/base/controller.ts @@ -0,0 +1,41 @@ +import { isBrowser } from '@/utils/tools'; + +export interface EditorMeta { + singleton: boolean; + [key: string]: any; +} + +export class Controller { + private methodMap: Record void>; + private meta: EditorMeta; + + constructor() { + this.methodMap = {}; + this.meta = { singleton: false }; + } + + registerMethod(name: string, fn: (...args: any[]) => void) { + this.methodMap[name] = fn; + } + + call(name: string, ...args: any[]) { + return this.methodMap[name]?.(...args); + } + + updateMeta(obj: Partial) { + Object.assign(this.meta, obj); + } + + getMeta() { + return Object.freeze({ ...this.meta }); + } +} + +const CONFIGURE_KEY = '__base_monaco_editor_controller__'; +const fakeWindow: any = isBrowser && window; + +if (fakeWindow && !fakeWindow[CONFIGURE_KEY]) { + fakeWindow[CONFIGURE_KEY] = new Controller(); +} + +export const controller: Controller = fakeWindow[CONFIGURE_KEY]; diff --git a/src/MonacoEditor/base/helper.ts b/src/MonacoEditor/base/helper.ts new file mode 100644 index 00000000..7d49aab6 --- /dev/null +++ b/src/MonacoEditor/base/helper.ts @@ -0,0 +1,421 @@ +/* eslint-disable no-empty */ +import { Monaco } from '@monaco-editor/loader'; +import type { editor as IEditor } from 'monaco-editor'; +import React, { CSSProperties, useEffect, useRef, useState } from 'react'; + +import { isBrowser } from '@/utils/tools'; + +import { getMonaco } from './monaco'; + +// @todo fill type def for monaco editor without refering monaco editor +/** + * @see https://microsoft.github.io/monaco-editor/api/index.html + */ +export type IEditorInstance = IEditor.IStandaloneCodeEditor | IEditor.IStandaloneDiffEditor; + +export type EditorEnhancer = (monaco: Monaco, editorIns: IEditorInstance) => any; + +export interface IGeneralManacoEditorProps { + /** [Monaco editor options](https://microsoft.github.io/monaco-editor/) */ + options?: Record; + /** callback after monaco's loaded and after editor's loaded */ + editorDidMount?: (monaco: Monaco, editor: IEditorInstance) => void; + /** callback after monaco's loaded and before editor's loaded */ + editorWillMount?: (monaco: Monaco) => void; + /** path of the current model, useful when creating a multi-model editor */ + path?: string; + /** whether to save the models' view states between model changes or not */ + saveViewState?: boolean; + /** language of the editor @see https://microsoft.github.io/monaco-editor/ for available languages */ + language?: string; + /** theme of the editor, "light" | "vs-dark" */ + theme?: string; + /** [config passing to require](https://github.com/suren-atoyan/monaco-react#loader-config), can be used to upgrade monaco-editor */ + requireConfig?: Record; + /** value, controlled */ + value?: string; + /** defaultValue for creating model, uncontrolled */ + defaultValue?: string; + /** className of wrapper */ + className?: string; + /** width of wrapper */ + width?: number | string; + /** height of wrapper */ + height?: number | string; + /** whether to enable outline of wrapper or not */ + enableOutline?: boolean; + /** style of wrapper */ + style?: CSSProperties; + enhancers?: EditorEnhancer[]; +} + +export interface ISingleMonacoEditorProps extends IGeneralManacoEditorProps { + onChange?: (input: string, event: IEditor.IModelContentChangedEvent) => void; + supportFullScreen?: boolean; +} + +export interface IDiffMonacoEditorProps extends IGeneralManacoEditorProps { + onChange?: (input: string, event: IEditor.IModelContentChangedEvent) => void; + supportFullScreen?: boolean; + original?: string; +} + +const CURRENT_LANGUAGE = isBrowser + ? ((window as any).locale || window.localStorage.getItem('vdev-locale') || '').replace( + /_/, + '-' + ) || 'zh-CN' + : 'zh-CN'; +export const WORD_EDITOR_INITIALIZING = + CURRENT_LANGUAGE === 'en-US' ? 'Initializing Editor' : '编辑器初始化中'; + +export const INITIAL_OPTIONS: IEditor.IStandaloneEditorConstructionOptions = { + fontSize: 12, + tabSize: 2, + fontFamily: 'Menlo, Monaco, Courier New, monospace', + folding: true, + minimap: { + enabled: false, + }, + autoIndent: 'advanced', + contextmenu: true, + useTabStops: true, + // wordBasedSuggestions: true, + formatOnPaste: true, + automaticLayout: true, + lineNumbers: 'on', + wordWrap: 'off', + scrollBeyondLastLine: false, + fixedOverflowWidgets: false, + snippetSuggestions: 'top', + scrollbar: { + vertical: 'auto', + horizontal: 'auto', + verticalScrollbarSize: 10, + horizontalScrollbarSize: 10, + }, +}; + +const DIFF_EDITOR_INITIAL_OPTIONS: IEditor.IStandaloneDiffEditorConstructionOptions = { + fontSize: 12, + fontFamily: 'Menlo, Monaco, Courier New, monospace', + folding: true, + minimap: { + enabled: false, + }, + autoIndent: 'advanced', + contextmenu: true, + useTabStops: true, + formatOnPaste: true, + automaticLayout: true, + lineNumbers: 'on', + wordWrap: 'off', + scrollBeyondLastLine: false, + fixedOverflowWidgets: false, + snippetSuggestions: 'top', + scrollbar: { + vertical: 'auto', + horizontal: 'auto', + verticalScrollbarSize: 10, + horizontalScrollbarSize: 10, + }, +}; + +function usePrevious(value: T) { + const ref = useRef(); + useEffect(() => { + ref.current = value; + }, [value]); + return ref.current; +} + +function getOrCreateModel(monaco: Monaco, value?: string, language?: string, path?: string) { + if (path) { + const prevModel = monaco.editor.getModel(monaco.Uri.parse(path)); + if (prevModel) { + return prevModel; + } + } + + return monaco.editor.createModel(value!, language, path ? monaco.Uri.parse(path) : undefined); +} + +export const useEditor = ( + type: 'single' | 'diff', + props: IGeneralManacoEditorProps +) => { + const { + editorDidMount, + editorWillMount, + theme, + value, + path, + language, + saveViewState, + defaultValue, + enhancers, + } = props; + + const [isEditorReady, setIsEditorReady] = useState(false); + const [focused, setFocused] = useState(false); + const [loading, setLoading] = useState(false); + const defaultValueRef = useRef(defaultValue); + const valueRef = useRef(value); + const languageRef = useRef(language || 'text'); + const pathRef = useRef(path); + const previousPath = usePrevious(path); + const requireConfigRef = useRef(props.requireConfig); + const optionRef = useRef(props.options); + const monacoRef = useRef(); + const editorRef = useRef(); + const containerRef = useRef(); + const typeRef = useRef(type); + const editorDidMountRef = useRef(); + const editorWillMountRef = useRef(); + + const decomposeRef = useRef(false); + const viewStatusRef = useRef>(new Map()); + + const enhancersRef = useRef({}); + + useEffect(() => { + enhancersRef.current.enhancers = enhancers; + }, [enhancers]); + + useEffect(() => { + editorDidMountRef.current = editorDidMount; + }, [editorDidMount]); + + useEffect(() => { + editorWillMountRef.current = editorWillMount; + }, [editorWillMount]); + + useEffect(() => { + valueRef.current = value; + }, [value]); + + useEffect(() => { + languageRef.current = language!; + }, [language]); + + useEffect(() => { + defaultValueRef.current = defaultValue; + }, [defaultValue]); + + // make sure loader / editor only init once + useEffect(() => { + setLoading(true); + getMonaco(requireConfigRef.current) + .then((monaco: Monaco) => { + // 兼容旧版本 monaco-editor 写死 MonacoEnvironment 的问题 + (window as any).MonacoEnvironment = undefined; + if (typeof (window as any).define === 'function' && (window as any).define.amd) { + // make monaco-editor's loader work with webpack's umd loader + // @see https://github.com/microsoft/monaco-editor/issues/2283 + delete (window as any).define.amd; + } + + monacoRef.current = monaco; + try { + editorWillMountRef.current?.(monaco); + } catch {} + + if (!containerRef.current) { + return; + } + let editor: IEditor.IStandaloneCodeEditor | IEditor.IStandaloneDiffEditor; + if (typeRef.current === 'single') { + const model = getOrCreateModel( + monaco, + valueRef.current ?? defaultValueRef.current ?? '', + languageRef.current, + pathRef.current + ); + editor = monaco.editor.create(containerRef.current, { + automaticLayout: true, + ...INITIAL_OPTIONS, + ...optionRef.current, + }); + editor.setModel(model); + } else { + const originalModel = monaco.editor.createModel(valueRef.current!, languageRef.current); + + const modifiedModel = monaco.editor.createModel(valueRef.current!, languageRef.current); + + editor = monaco.editor.createDiffEditor(containerRef.current, { + automaticLayout: true, + ...DIFF_EDITOR_INITIAL_OPTIONS, + ...optionRef.current, + }); + + editor.setModel({ original: originalModel, modified: modifiedModel }); + } + editorRef.current = editor; + enhancersRef.current.enhancers?.forEach((en: any) => en(monaco, editor as any)); + try { + editorDidMountRef.current?.(monaco, editor); + } catch {} + if (!decomposeRef.current) { + setIsEditorReady(true); + } + }) + .catch(error => { + // eslint-disable-next-line no-console + console.error('Monaco Editor Load Error!', error); + }) + .then(() => { + if (!decomposeRef.current) { + setLoading(false); + } + }); + }, []); + + useEffect(() => { + if (!isEditorReady) { + return; + } + + monacoRef.current?.editor.setTheme(theme!); + }, [isEditorReady, theme]); + + // focus status + useEffect(() => { + if (!isEditorReady) { + return; + } + + const editor = + type === 'diff' + ? (editorRef.current as IEditor.IStandaloneDiffEditor).getModifiedEditor() + : (editorRef.current as IEditor.IStandaloneCodeEditor); + editor?.onDidFocusEditorText(() => { + if (!decomposeRef.current) { + setFocused(true); + } + }); + editor?.onDidBlurEditorText(() => { + if (!decomposeRef.current) { + setFocused(false); + } + }); + }, [isEditorReady, type]); + + // decomposing status + useEffect(() => { + return () => { + decomposeRef.current = true; + }; + }, []); + + // controlled value -- diff mode / without path only + useEffect(() => { + if (!isEditorReady) { + return; + } + + if (type !== 'diff' && !!path) { + return; + } + + const editor = + type === 'diff' + ? (editorRef.current as IEditor.IStandaloneDiffEditor).getModifiedEditor() + : (editorRef.current as IEditor.IStandaloneCodeEditor); + + const nextValue = value ?? defaultValueRef.current ?? ''; + const readOnly = monacoRef.current?.editor.EditorOption.readOnly; + if (readOnly && editor?.getOption?.(readOnly)) { + editor?.setValue(nextValue); + } else if (value !== editor?.getValue()) { + editor?.executeEdits('', [ + { + range: editor?.getModel()!.getFullModelRange(), + text: nextValue, + forceMoveMarkers: true, + }, + ]); + + editor?.pushUndoStop(); + } + }, [isEditorReady, path, type, value]); + + // multi-model && controlled value (shouldn't be diff mode) + useEffect(() => { + if (!isEditorReady) { + return; + } + + if (type === 'diff') { + return; + } + + if (path === previousPath) { + return; + } + + const model = getOrCreateModel( + monacoRef.current!, + valueRef.current ?? defaultValueRef.current, + languageRef.current, + path + ); + + const editor = editorRef.current as IEditor.IStandaloneCodeEditor; + if ( + valueRef.current !== null && + valueRef.current !== undefined && + model.getValue() !== valueRef.current + ) { + model.setValue(valueRef.current); + } + if (model !== editorRef.current?.getModel()) { + if (saveViewState) { + viewStatusRef.current.set(previousPath, editor.saveViewState()!); + } + editor.setModel(model); + if (saveViewState) { + editor.restoreViewState(viewStatusRef.current.get(path)!); + } + } + }, [isEditorReady, value, path, previousPath, type, saveViewState]); + + let retEditorRef: React.MutableRefObject = editorRef as any; + return { + isEditorReady, + focused, + loading, + containerRef, + monacoRef, + editorRef: retEditorRef, + valueRef, + } as const; +}; + +export const useFullScreen = (editor?: IEditor.IStandaloneCodeEditor) => { + const [isFullScreen, setIsFullScreen] = useState(false); + + const fullScreen = () => { + if (isFullScreen) { + setIsFullScreen(false); + editor?.updateOptions({ + ...editor?.getOptions(), + minimap: { + enabled: false, + }, + }); + editor?.layout(); + return; + } + setIsFullScreen(true); + // 更新小地图配置 + editor?.updateOptions({ + ...editor?.getOptions(), + minimap: { + enabled: true, + }, + }); + editor?.layout(); + }; + + return { isFullScreen, fullScreen }; +}; diff --git a/src/MonacoEditor/base/index.tsx b/src/MonacoEditor/base/index.tsx new file mode 100644 index 00000000..8e7eea44 --- /dev/null +++ b/src/MonacoEditor/base/index.tsx @@ -0,0 +1,217 @@ +import { Icon } from '@lobehub/ui'; +import { Button } from 'antd'; +import { Maximize2, Minimize2 } from 'lucide-react'; +import type { IDisposable, editor } from 'monaco-editor'; +import React, { LegacyRef, useEffect, useMemo, useRef } from 'react'; + +import { + IDiffMonacoEditorProps, + INITIAL_OPTIONS, + ISingleMonacoEditorProps, + WORD_EDITOR_INITIALIZING, + useEditor, + useFullScreen, +} from './helper'; +import { useStyles } from './style'; + +export * from './controller'; +export * from './monaco'; + +function noop() {} + +const SingleMonacoEditor: React.FC = props => { + const { onChange, enableOutline, width, height, language, supportFullScreen } = props; + const onChangeRef = useRef(onChange); + + const { isEditorReady, focused, loading, containerRef, monacoRef, editorRef, valueRef } = + useEditor('single', props); + const subscriptionRef = useRef(); + + const { isFullScreen, fullScreen } = useFullScreen(editorRef?.current); + const { cx, styles } = useStyles({ + isFullScreen, + minimapEnabled: props.options?.minimap?.enabled, + }); + + const className = cx(styles.base, props.className, { + 've-focused': focused, + 've-outline': enableOutline, + }); + + const style = useMemo(() => ({ width, height }), [width, height]); + + useEffect(() => { + onChangeRef.current = onChange; + }, [onChange]); + + useEffect(() => { + if (isEditorReady) { + const editorInstance = editorRef.current; + subscriptionRef.current?.dispose(); + subscriptionRef.current = editorInstance?.onDidChangeModelContent(event => { + const editorValue = editorInstance?.getModel()?.getValue(); + + if (valueRef.current !== editorValue) { + onChangeRef.current?.(editorValue!, event); + } + }); + } + }, [editorRef, isEditorReady, subscriptionRef, valueRef]); + + useEffect(() => { + return () => { + const editorInstance = editorRef.current; + subscriptionRef.current?.dispose(); + editorInstance?.getModel()?.dispose(); + // eslint-disable-next-line react-hooks/exhaustive-deps + editorRef.current?.dispose(); + }; + }, [editorRef]); + + useEffect(() => { + if (!isEditorReady) { + return; + } + + const model = editorRef.current?.getModel(); + if (model) { + monacoRef.current?.editor.setModelLanguage(model, language!); + } + }, [editorRef, isEditorReady, language, monacoRef]); + + return ( +
+ {loading && {WORD_EDITOR_INITIALIZING}} +
} + style={style} + > + {supportFullScreen && ( +
+
+ ); +}; + +const DiffMonacoEditor: React.FC = props => { + const { enableOutline, width, height, language, onChange, original, supportFullScreen } = props; + const onChangeRef = useRef(onChange); + + const { isEditorReady, focused, loading, containerRef, monacoRef, editorRef, valueRef } = + useEditor('diff', props); + + const { isFullScreen, fullScreen } = useFullScreen(); + + const { cx, styles } = useStyles({ + isFullScreen, + diff: true, + }); + + const className = cx(styles.base, props.className, { + 've-focused': focused, + 've-outline': enableOutline, + }); + const style = useMemo(() => ({ width, height }), [width, height]); + + useEffect(() => { + onChangeRef.current = onChange; + }, [onChange]); + + useEffect(() => { + if (!isEditorReady) { + return; + } + editorRef.current.getModel()?.original.setValue(original ?? ''); + + const { modified } = editorRef.current.getModel() || {}; + modified?.onDidChangeContent(event => { + const editorValue = modified.getValue(); + if (valueRef.current !== editorValue) { + onChangeRef.current?.(editorValue, event); + } + }); + }, [editorRef, isEditorReady, original, valueRef]); + + useEffect(() => { + return () => { + editorRef.current?.getModel()?.original?.dispose(); + editorRef.current?.getModel()?.modified?.dispose(); + // eslint-disable-next-line react-hooks/exhaustive-deps + editorRef.current?.dispose(); + }; + }, [editorRef]); + + useEffect(() => { + if (!isEditorReady) { + return; + } + + const { original: originalModel, modified: modifiedModel } = + editorRef.current?.getModel() || {}; + + monacoRef.current?.editor.setModelLanguage(originalModel!, language!); + monacoRef.current?.editor.setModelLanguage(modifiedModel!, language!); + }, [editorRef, isEditorReady, language, monacoRef]); + + return ( +
+ {loading && {WORD_EDITOR_INITIALIZING}} +
} + style={style} + > + {supportFullScreen && ( +
+
+ ); +}; + +const DiffMonacoEditorComponent = Object.assign(DiffMonacoEditor, { + displayName: 'DiffMonacoEditor', + defaultProps: { + width: '100%', + height: 150, + defaultValue: '', + language: 'javascript', + options: INITIAL_OPTIONS, + editorDidMount: noop, + editorWillMount: noop, + onChange: noop, + requireConfig: {}, + }, +}); + +export const SingleMonacoEditorComponent = Object.assign(SingleMonacoEditor, { + displayName: 'SingleMonacoEditor', + defaultProps: { + width: '100%', + height: 150, + defaultValue: '', + language: 'javascript', + options: INITIAL_OPTIONS, + editorDidMount: noop, + editorWillMount: noop, + onChange: noop, + requireConfig: {}, + }, + MonacoDiffEditor: DiffMonacoEditorComponent, +}); + +export default SingleMonacoEditorComponent; diff --git a/src/MonacoEditor/base/monaco.ts b/src/MonacoEditor/base/monaco.ts new file mode 100644 index 00000000..186babbc --- /dev/null +++ b/src/MonacoEditor/base/monaco.ts @@ -0,0 +1,53 @@ +import loader, { Monaco } from '@monaco-editor/loader'; +import { isEqual } from 'lodash-es'; + +import { EditorMeta, controller } from './controller'; + +export const getSingletonMonaco = (() => { + let monaco: Monaco; + let prevOptions: any; + return async (options?: any) => { + if (!monaco || !isEqual(prevOptions, options)) { + const hasConfig = Object.keys(options || {}).length > 0; + loader.config( + hasConfig + ? options + : { + paths: { + vs: 'https://g.alicdn.com/code/lib/monaco-editor/0.33.0/min/vs', + }, + } + ); + // eslint-disable-next-line require-atomic-updates + monaco = await loader.init(); + // eslint-disable-next-line require-atomic-updates + prevOptions = options; + } + return monaco; + }; +})(); + +export const getCommonMonaco = (config: any): Promise => { + if (config) { + loader.config(config); + } else { + loader.config({ + paths: { + vs: 'https://g.alicdn.com/code/lib/monaco-editor/0.31.1/min/vs', + }, + }); + } + return loader.init(); +}; + +export function getMonaco(config?: any) { + const hasConfig = Object.keys(config || {}).length > 0; + const monacoConfig = hasConfig ? config : undefined; + return controller.getMeta().singleton + ? getSingletonMonaco(monacoConfig) + : getCommonMonaco(monacoConfig); +} + +export function configure(config: EditorMeta) { + controller.updateMeta(config); +} diff --git a/src/MonacoEditor/base/style.ts b/src/MonacoEditor/base/style.ts new file mode 100644 index 00000000..2fac9e73 --- /dev/null +++ b/src/MonacoEditor/base/style.ts @@ -0,0 +1,162 @@ +import { createStyles, keyframes } from 'antd-style'; + +/** + * styles from https://github.com/alibaba/lowcode-plugins/blob/main/packages/base-monaco-editor/src/index.scss + */ +export const useStyles = createStyles( + ( + { css, token, prefixCls }, + { + minimapEnabled = false, + isFullScreen = false, + diff = false, + }: { minimapEnabled?: boolean; isFullScreen?: boolean; diff?: boolean } + ) => { + const dots = keyframes` + 0% { content: '.'; } + 20% { content: '..'; } + 40% { content: '...'; } + 60% { content: '....'; } + 80% { content: '.....'; } + `; + + return { + base: css` + position: relative; + + box-sizing: content-box; + min-height: 100px; + + border: 1px solid transparent; + border-radius: 3px; + &:hover { + border-color: var(--color-field-border-hover, rgba(31, 56, 88, 0.1)); + } + + &.ve-focused { + border-color: var(--color-field-border-active, rgba(31, 56, 88, 0.15)); + } + + &.ve-outline { + border: 1px solid var(--color-field-border, rgba(31, 56, 88, 0.05)) !important; + } + + & > .react-monaco-editor-container { + width: 100%; + height: 100%; + min-height: 100px; + background: transparent; + + ${isFullScreen && + css` + position: fixed; + z-index: 9998; + inset: 0; + + width: auto !important; + height: auto !important; + `} + + & > .monaco-editor { + border-radius: ${token.borderRadius}px; + .overflow-guard, + .margin { + border-top-left-radius: ${token.borderRadius}px; + border-bottom-left-radius: ${token.borderRadius}px; + } + .monaco-scrollable-element { + border-top-right-radius: ${token.borderRadius}px; + border-bottom-right-radius: ${token.borderRadius}px; + } + } + .monaco-diff-editor { + border-radius: ${token.borderRadius}px; + & > .original > .monaco-editor { + border-top-left-radius: ${token.borderRadius}px; + border-bottom-left-radius: ${token.borderRadius}px; + .overflow-guard, + .margin { + border-top-left-radius: ${token.borderRadius}px; + border-bottom-left-radius: ${token.borderRadius}px; + } + } + .diffViewport { + border-top-right-radius: ${token.borderRadius - 1}px; + border-bottom-right-radius: ${token.borderRadius - 1}px; + } + } + } + + ..syntaxTips { + position: absolute; + bottom: 0; + left: 0; + + box-sizing: border-box; + width: 100%; + max-height: 0; + margin: 0; + padding: 10px 30px; + + color: red; + + background: rgba(255, 234, 234, 0.8); + + transition: 0.2s ease max-height; + } + + .syntaxTips:hover { + overflow: auto; + max-height: 50%; + } + + .syntaxTips .infoIcon { + position: absolute; + top: 2px; + right: 5px; + transform: rotateY(180deg); + + width: 20px; + height: 16px; + } + `, + fullScreenBtn: css` + &.${prefixCls}-btn { + position: absolute; + color: ${token.colorTextSecondary}; + top: 20px; + transition: none; + ${isFullScreen + ? css` + z-index: 9999; + right: ${diff ? 64 : 138}px; + ` + : css` + right: ${minimapEnabled || diff ? 64 : 20}px; + `} + } + `, + loading: css` + position: absolute; + inset: 0; + + display: flex; + align-items: center; + justify-content: center; + + font-size: ${token.fontSizeSM}px; + color: ${token.colorTextTertiary}; + + background-color: transparent; + + &::after { + content: ''; + /* width: 20px; */ + display: inline; + animation: ${dots} steps(3) 1s infinite; + } + `, + }; + }, + { hashPriority: 'low' } +); diff --git a/src/MonacoEditor/demos/DiffEditor.tsx b/src/MonacoEditor/demos/DiffEditor.tsx index 633decd4..3fcdd623 100644 --- a/src/MonacoEditor/demos/DiffEditor.tsx +++ b/src/MonacoEditor/demos/DiffEditor.tsx @@ -12,6 +12,7 @@ export default () => { console.log(input); }} original={original} + supportFullScreen value={value} width="740px" /> diff --git a/src/MonacoEditor/index.tsx b/src/MonacoEditor/index.tsx index 8e0e744c..c2e86e06 100644 --- a/src/MonacoEditor/index.tsx +++ b/src/MonacoEditor/index.tsx @@ -1,22 +1,18 @@ -import { SingleMonacoEditorComponent } from '@alilc/lowcode-plugin-base-monaco-editor'; +import type { Monaco } from '@monaco-editor/loader'; +import { useThemeMode } from 'antd-style'; +import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; + +import { useCdnFn } from '../ConfigProvider'; +import { SingleMonacoEditorComponent } from './base'; import type { IDiffMonacoEditorProps, IEditorInstance, IGeneralManacoEditorProps, ISingleMonacoEditorProps, -} from '@alilc/lowcode-plugin-base-monaco-editor/lib/helper'; -import { useThemeMode } from 'antd-style'; -import type { editor as IEditor } from 'monaco-editor'; -import React, { useMemo, useState } from 'react'; - -import { useCdnFn } from '../ConfigProvider'; -import { useStyles } from './style'; +} from './base/helper'; // @Todo: Controller SSR error: https://github.com/alibaba/lowcode-plugins/blob/main/packages/base-monaco-editor/src/controller.ts#L33 -export { - type EditorMeta, - Controller as MonacoController, -} from '@alilc/lowcode-plugin-base-monaco-editor/es/controller'; +export { type EditorMeta, Controller as MonacoController } from './base/controller'; export interface BaseMonacoEditorProps extends IGeneralManacoEditorProps { /** Should the editor be read only. See also domReadOnly. Defaults to false. */ @@ -41,8 +37,6 @@ export const BaseMonacoEditor: React.FC< type?: 'single' | 'diff'; /** Is show fullscreen button */ supportFullScreen?: boolean; - /** className of diff editor wrapper */ - diffEditorWrapperClassName?: boolean; } > = props => { const { @@ -57,15 +51,16 @@ export const BaseMonacoEditor: React.FC< version = '0.45.0', requireConfig: requireConfigFromProps = {}, options, - onChange, className, - diffEditorWrapperClassName, supportFullScreen, - width, - height, ...otherProps } = props; + const editorDidMountRef = useRef(editorDidMount); + useEffect(() => { + editorDidMountRef.current = editorDidMount; + }, [editorDidMount]); + const { isDarkMode } = useThemeMode(); const theme = useMemo(() => { if (themeFromProps) { @@ -75,17 +70,10 @@ export const BaseMonacoEditor: React.FC< }, [isDarkMode, themeFromProps]); const [editorInstance, setEditorInstance] = useState(); - const handleEditorDidMount: BaseMonacoEditorProps['editorDidMount'] = (monaco, editor) => { + const handleEditorDidMount = useCallback((monaco: Monaco, editor: IEditorInstance) => { setEditorInstance(editor); - editorDidMount?.(monaco, editor); - // add onChange event for diff editor - if (type === 'diff') { - const { modified } = editor.getModel() as IEditor.IDiffEditorModel; - modified.onDidChangeContent(event => { - onChange?.(modified.getValue(), event); - }); - } - }; + editorDidMountRef.current?.(monaco, editor); + }, []); const editorOptions = useMemo(() => { const newOps = Object.assign({}, options, { @@ -119,50 +107,30 @@ export const BaseMonacoEditor: React.FC< }); }, [genCdnUrl, requireConfigFromProps, version]); - const [isFullScreen, setIsFullScreen] = useState(false); - const { styles, cx } = useStyles({ minimapEnabled, isFullScreen }); - if (type !== 'diff') { return ( ); } - const fullScreen = () => { - setIsFullScreen(!isFullScreen); - editorInstance?.layout(); - }; - const fullScreenClassName = cx({ - 'base-monaco-full-screen-icon': !isFullScreen, - 'base-monaco-full-screen-icon-cancel': isFullScreen, - }); return ( -
- - {editorInstance && supportFullScreen && ( -
- )} -
+ ); }; diff --git a/src/ProCard/index.md b/src/ProCard/index.md index 6b2066d9..a699f7f5 100644 --- a/src/ProCard/index.md +++ b/src/ProCard/index.md @@ -60,4 +60,4 @@ export default ProCardDemo; 待补充 - + diff --git a/src/utils/tools.ts b/src/utils/tools.ts new file mode 100644 index 00000000..aad96e76 --- /dev/null +++ b/src/utils/tools.ts @@ -0,0 +1 @@ +export const isBrowser = typeof window !== 'undefined';