@lobehub/ui 1.94.7 → 1.95.0

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/README.md CHANGED
@@ -10,20 +10,24 @@
10
10
 
11
11
  Lobe UI is an open-source UI component library for building _AIGC_ web apps
12
12
 
13
- [Changelog](./CHANGELOG.md) · [Report Bug][issues-url] · [Request Feature][issues-url]
13
+ [Changelog](./CHANGELOG.md) · [Report Bug][github-issues-link] · [Request Feature][github-issues-link]
14
14
 
15
15
  <!-- SHIELD GROUP -->
16
16
 
17
- [![release][release-shield]][release-url]
18
- [![releaseDate][release-date-shield]][release-date-url]
19
- [![ciTest][ci-test-shield]][ci-test-url]
20
- [![ciRelease][ci-release-shield]][ci-release-url] <br/>
21
- [![contributors][contributors-shield]][contributors-url]
22
- [![forks][forks-shield]][forks-url]
23
- [![stargazers][stargazers-shield]][stargazers-url]
24
- [![issues][issues-shield]][issues-url]
25
-
26
- ![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png)
17
+ [![][npm-release-shield]][npm-release-link]
18
+ [![][vercel-shield]][vercel-link]
19
+ [![][discord-shield]][discord-link]
20
+ [![][npm-downloads-shield]][npm-downloads-link]
21
+ [![][github-releasedate-shield]][github-releasedate-link]
22
+ [![][github-action-test-shield]][github-action-test-link]
23
+ [![][github-action-release-shield]][github-action-release-link]<br/>
24
+ [![][github-contributors-shield]][github-contributors-link]
25
+ [![][github-forks-shield]][github-forks-link]
26
+ [![][github-stars-shield]][github-stars-link]
27
+ [![][github-issues-shield]][github-issues-link]
28
+ [![][github-license-shield]][github-license-link]
29
+
30
+ ![](https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/268452017-960ab8a1-e4b7-4648-beb1-77daf4b6034a.png)
27
31
 
28
32
  </div>
29
33
 
@@ -34,8 +38,6 @@ Lobe UI is an open-source UI component library for building _AIGC_ web apps
34
38
 
35
39
  - [📦 Installation](#-installation)
36
40
 
37
- - [🤯 Usage](#-usage)
38
-
39
41
  - [Compile with NextJS](#compile-with-nextjs)
40
42
 
41
43
  - [⌨️ Local Development](#️-local-development)
@@ -54,21 +56,16 @@ This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908
54
56
 
55
57
  To install Lobe UI, run the following command:
56
58
 
59
+ [![][bun-shield]][bun-link]
60
+
57
61
  ```bash
58
- pnpm i -S @lobehub/ui
62
+ $ bun add @lobehub/ui
59
63
  ```
60
64
 
61
- <div align="right">
62
-
63
- [![][back-to-top]](#readme-top)
64
-
65
- </div>
66
-
67
- ## 🤯 Usage
68
-
69
65
  ### Compile with NextJS
70
66
 
71
- by work correct with nextjs ssr, add `transpilePackages: ['@lobehub/ui']` to `next.config.js`. For example:
67
+ > **Note**\
68
+ > By work correct with nextjs ssr, add `transpilePackages: ['@lobehub/ui']` to `next.config.js`. For example:
72
69
 
73
70
  ```js
74
71
  // next.config.js
@@ -87,17 +84,17 @@ const nextConfig = {
87
84
 
88
85
  ## ⌨️ Local Development
89
86
 
90
- You can use Gitpod for online development:
87
+ You can use Github Codespaces for online development:
91
88
 
92
- [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)][gitpod-url]
89
+ [![][codespaces-shield]][codespaces-link]
93
90
 
94
91
  Or clone it for local development:
95
92
 
96
93
  ```bash
97
94
  $ git clone https://github.com/lobehub/lobe-ui.git
98
95
  $ cd lobe-ui
99
- $ pnpm install
100
- $ pnpm start
96
+ $ bun install
97
+ $ bun start
101
98
  ```
102
99
 
103
100
  <div align="right">
@@ -108,6 +105,10 @@ $ pnpm start
108
105
 
109
106
  ## 🤝 Contributing
110
107
 
108
+ Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub [Issues][github-issues-link] to get stuck in to show us what you’re made of.
109
+
110
+ [![][pr-welcome-shield]][pr-welcome-link]
111
+
111
112
  [![][contributors-contrib]][contributors-url]
112
113
 
113
114
  <div align="right">
@@ -131,7 +132,11 @@ $ pnpm start
131
132
 
132
133
  ---
133
134
 
134
- #### 📝 License
135
+ <details><summary><h4>📝 License</h4></summary>
136
+
137
+ [![][fossa-license-shield]][fossa-license-link]
138
+
139
+ </details>
135
140
 
136
141
  Copyright © 2023 [LobeHub][profile-url]. <br />
137
142
  This project is [MIT](./LICENSE) licensed.
@@ -139,26 +144,42 @@ This project is [MIT](./LICENSE) licensed.
139
144
  <!-- LINK GROUP -->
140
145
 
141
146
  [back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square
142
- [ci-release-shield]: https://github.com/lobehub/lobe-ui/workflows/Release%20CI/badge.svg
143
- [ci-release-url]: https://github.com/lobehub/lobe-ui/actions?query=workflow%3ARelease%20CI
144
- [ci-test-shield]: https://github.com/lobehub/lobe-ui/workflows/Test%20CI/badge.svg
145
- [ci-test-url]: https://github.com/lobehub/lobe-ui/actions?query=workflow%3ATest%20CI
147
+ [bun-link]: https://bun.sh
148
+ [bun-shield]: https://img.shields.io/badge/-speedup%20with%20bun-black?logo=bun&style=for-the-badge
149
+ [codespaces-link]: https://codespaces.new/lobehub/lobe-ui
150
+ [codespaces-shield]: https://github.com/codespaces/badge.svg
146
151
  [contributors-contrib]: https://contrib.rocks/image?repo=lobehub/lobe-ui
147
- [contributors-shield]: https://img.shields.io/github/contributors/lobehub/lobe-ui.svg?style=flat
148
152
  [contributors-url]: https://github.com/lobehub/lobe-ui/graphs/contributors
149
- [forks-shield]: https://img.shields.io/github/forks/lobehub/lobe-ui.svg?style=flat
150
- [forks-url]: https://github.com/lobehub/lobe-ui/network/members
151
- [gitpod-url]: https://gitpod.io/#https://github.com/lobehub/lobe-ui
152
- [issues-shield]: https://img.shields.io/github/issues/lobehub/lobe-ui.svg?style=flat
153
- [issues-url]: https://github.com/lobehub/lobe-ui/issues/new/choose
153
+ [discord-link]: https://discord.gg/AYFPHvv2jT
154
+ [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
155
+ [fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-ui
156
+ [fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flobehub%2Flobe-ui.svg?type=large
157
+ [github-action-release-link]: https://github.com/actions/workflows/lobehub/lobe-ui/release.yml
158
+ [github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-ui/release.yml?label=release&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
159
+ [github-action-test-link]: https://github.com/actions/workflows/lobehub/lobe-ui/test.yml
160
+ [github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/lobe-ui/test.yml?label=test&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
161
+ [github-contributors-link]: https://github.com/lobehub/lobe-ui/graphs/contributors
162
+ [github-contributors-shield]: https://img.shields.io/github/contributors/lobehub/lobe-ui?color=c4f042&labelColor=black&style=flat-square
163
+ [github-forks-link]: https://github.com/lobehub/lobe-ui/network/members
164
+ [github-forks-shield]: https://img.shields.io/github/forks/lobehub/lobe-ui?color=8ae8ff&labelColor=black&style=flat-square
165
+ [github-issues-link]: https://github.com/lobehub/lobe-ui/issues
166
+ [github-issues-shield]: https://img.shields.io/github/issues/lobehub/lobe-ui?color=ff80eb&labelColor=black&style=flat-square
167
+ [github-license-link]: https://github.com/lobehub/lobe-ui/blob/master/LICENSE
168
+ [github-license-shield]: https://img.shields.io/github/license/lobehub/lobe-ui?color=white&labelColor=black&style=flat-square
169
+ [github-releasedate-link]: https://github.com/lobehub/lobe-ui/releases
170
+ [github-releasedate-shield]: https://img.shields.io/github/release-date/lobehub/lobe-ui?labelColor=black&style=flat-square
171
+ [github-stars-link]: https://github.com/lobehub/lobe-ui/network/stargazers
172
+ [github-stars-shield]: https://img.shields.io/github/stars/lobehub/lobe-ui?color=ffcb47&labelColor=black&style=flat-square
154
173
  [lobe-chat]: https://github.com/lobehub/lobe-chat
155
174
  [lobe-commit]: https://github.com/lobehub/lobe-commit/tree/master/packages/lobe-commit
156
175
  [lobe-i18n]: https://github.com/lobehub/lobe-commit/tree/master/packages/lobe-i18n
157
176
  [lobe-theme]: https://github.com/lobehub/sd-webui-lobe-theme
177
+ [npm-downloads-link]: https://www.npmjs.com/package/@lobehub/ui
178
+ [npm-downloads-shield]: https://img.shields.io/npm/dt/@lobehub/ui?labelColor=black&style=flat-square
179
+ [npm-release-link]: https://www.npmjs.com/package/@lobehub/ui
180
+ [npm-release-shield]: https://img.shields.io/npm/v/@lobehub/ui?color=369eff&labelColor=black&logo=npm&logoColor=white&style=flat-square
181
+ [pr-welcome-link]: https://github.com/lobehub/lobe-chat/pulls
182
+ [pr-welcome-shield]: https://img.shields.io/badge/🤯_pr_welcome-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge
158
183
  [profile-url]: https://github.com/lobehub
159
- [release-date-shield]: https://img.shields.io/github/release-date/lobehub/lobe-ui?style=flat
160
- [release-date-url]: https://github.com/lobehub/lobe-ui/releases
161
- [release-shield]: https://img.shields.io/npm/v/@lobehub/ui?label=%F0%9F%A4%AF%20NPM
162
- [release-url]: https://www.npmjs.com/package/@lobehub/ui
163
- [stargazers-shield]: https://img.shields.io/github/stars/lobehub/lobe-ui.svg?style=flat
164
- [stargazers-url]: https://github.com/lobehub/lobe-ui/stargazers
184
+ [vercel-link]: https://ui.lobehub.com
185
+ [vercel-shield]: https://img.shields.io/website?down_message=offline&label=vercel&labelColor=black&logo=vercel&style=flat-square&up_message=online&url=https%3A%2F%2Fui.lobehub.com
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { CDN, CdnApi } from "../utils/genCdnUrl";
3
+ type CdnFn = ({ pkg, version, path }: CdnApi) => string;
4
+ export interface Config {
5
+ customCdnFn?: CdnFn;
6
+ proxy: CDN | 'custom';
7
+ }
8
+ declare const ConfigProvider: import("react").NamedExoticComponent<{
9
+ children: ReactNode;
10
+ config: Config;
11
+ }>;
12
+ export declare const useCdnFn: () => CdnFn;
13
+ export default ConfigProvider;
@@ -0,0 +1,40 @@
1
+ import { createContext, memo, useContext } from 'react';
2
+ import { genCdnUrl } from "../utils/genCdnUrl";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ var ConfigContext = /*#__PURE__*/createContext(null);
5
+ var ConfigProvider = /*#__PURE__*/memo(function (_ref) {
6
+ var children = _ref.children,
7
+ config = _ref.config;
8
+ return /*#__PURE__*/_jsx(ConfigContext.Provider, {
9
+ value: config,
10
+ children: children
11
+ });
12
+ });
13
+ var fallback = function fallback(_ref2) {
14
+ var pkg = _ref2.pkg,
15
+ version = _ref2.version,
16
+ path = _ref2.path;
17
+ return genCdnUrl({
18
+ path: path,
19
+ pkg: pkg,
20
+ proxy: 'aliyun',
21
+ version: version
22
+ });
23
+ };
24
+ export var useCdnFn = function useCdnFn() {
25
+ var config = useContext(ConfigContext);
26
+ if (!config) return fallback;
27
+ if (config.proxy !== 'custom') return function (_ref3) {
28
+ var pkg = _ref3.pkg,
29
+ version = _ref3.version,
30
+ path = _ref3.path;
31
+ return genCdnUrl({
32
+ path: path,
33
+ pkg: pkg,
34
+ proxy: config.proxy,
35
+ version: version
36
+ });
37
+ };
38
+ return (config === null || config === void 0 ? void 0 : config.customCdnFn) || fallback;
39
+ };
40
+ export default ConfigProvider;
@@ -4,7 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  import { kebabCase } from 'lodash-es';
6
6
  import { memo, useMemo, useState } from 'react';
7
- import { genCdnUrl } from "../utils/genCdnUrl";
7
+ import { useCdnFn } from "../ConfigProvider";
8
8
  import { getEmojiNameByCharacter } from "../utils/getEmojiByCharacter";
9
9
  import { useStyles } from "./style";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -16,6 +16,7 @@ var FluentEmoji = /*#__PURE__*/memo(function (_ref) {
16
16
  type = _ref$type === void 0 ? '3d' : _ref$type,
17
17
  _ref$size = _ref.size,
18
18
  size = _ref$size === void 0 ? 40 : _ref$size;
19
+ var genCdnUrl = useCdnFn();
19
20
  var _useState = useState(false),
20
21
  _useState2 = _slicedToArray(_useState, 2),
21
22
  loadingFail = _useState2[0],
package/es/Logo/index.js CHANGED
@@ -6,6 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
  import { useTheme } from 'antd-style';
7
7
  import { memo } from 'react';
8
8
  import { Flexbox } from 'react-layout-kit';
9
+ import { useCdnFn } from "../ConfigProvider";
9
10
  import Divider from "./Divider";
10
11
  import LogoHighContrast from "./LogoHighContrast";
11
12
  import LogoText from "./LogoText";
@@ -22,6 +23,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
22
23
  extra = _ref.extra,
23
24
  className = _ref.className,
24
25
  props = _objectWithoutProperties(_ref, _excluded);
26
+ var genCdnUrl = useCdnFn();
25
27
  var theme = useTheme();
26
28
  var _useStyles = useStyles(),
27
29
  styles = _useStyles.styles;
@@ -31,7 +33,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
31
33
  {
32
34
  logoComponent = /*#__PURE__*/_jsx("img", _objectSpread({
33
35
  alt: "lobehub",
34
- src: LOGO_3D,
36
+ src: genCdnUrl(LOGO_3D),
35
37
  style: _objectSpread({
36
38
  height: size,
37
39
  width: size
@@ -43,7 +45,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
43
45
  {
44
46
  logoComponent = /*#__PURE__*/_jsx("img", {
45
47
  alt: "lobehub",
46
- src: LOGO_FLAT,
48
+ src: genCdnUrl(LOGO_FLAT),
47
49
  style: _objectSpread({
48
50
  height: size,
49
51
  width: size
@@ -77,7 +79,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
77
79
  logoComponent = /*#__PURE__*/_jsxs(_Fragment, {
78
80
  children: [/*#__PURE__*/_jsx("img", {
79
81
  alt: "lobehub",
80
- src: LOGO_3D,
82
+ src: genCdnUrl(LOGO_3D),
81
83
  style: {
82
84
  height: size,
83
85
  width: size
@@ -1,5 +1,13 @@
1
- export declare const LOGO_3D: string;
2
- export declare const LOGO_FLAT: string;
1
+ export declare const LOGO_3D: {
2
+ path: string;
3
+ pkg: string;
4
+ version: string;
5
+ };
6
+ export declare const LOGO_FLAT: {
7
+ path: string;
8
+ pkg: string;
9
+ version: string;
10
+ };
3
11
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
4
12
  extraTitle: import("antd-style").SerializedStyles;
5
13
  }>;
package/es/Logo/style.js CHANGED
@@ -1,17 +1,16 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject;
3
3
  import { createStyles } from 'antd-style';
4
- import { genCdnUrl } from "../utils/genCdnUrl";
5
- export var LOGO_3D = genCdnUrl({
4
+ export var LOGO_3D = {
6
5
  path: 'assets/logo-3d.webp',
7
6
  pkg: '@lobehub/assets-logo',
8
7
  version: '1.1.0'
9
- });
10
- export var LOGO_FLAT = genCdnUrl({
8
+ };
9
+ export var LOGO_FLAT = {
11
10
  path: 'assets/logo-flat.svg',
12
11
  pkg: '@lobehub/assets-logo',
13
12
  version: '1.1.0'
14
- });
13
+ };
15
14
  export var useStyles = createStyles(function (_ref) {
16
15
  var css = _ref.css;
17
16
  return {
@@ -1,5 +1,5 @@
1
1
  import { memo, useCallback } from 'react';
2
- import { genCdnUrl } from "../utils/genCdnUrl";
2
+ import { useCdnFn } from "../ConfigProvider";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  import { Fragment as _Fragment } from "react/jsx-runtime";
5
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -7,6 +7,7 @@ var Meta = /*#__PURE__*/memo(function (_ref) {
7
7
  var _ref$title = _ref.title,
8
8
  title = _ref$title === void 0 ? 'LobeHub' : _ref$title,
9
9
  withManifest = _ref.withManifest;
10
+ var genCdnUrl = useCdnFn();
10
11
  var genAssets = useCallback(function (path) {
11
12
  return genCdnUrl({
12
13
  path: path,
@@ -5,9 +5,9 @@ import { App } from 'antd';
5
5
  import { ThemeProvider as AntdThemeProvider, StyleProvider, setupStyled } from 'antd-style';
6
6
  import { memo, useCallback, useEffect } from 'react';
7
7
  import { ThemeContext } from 'styled-components';
8
+ import { useCdnFn } from "../ConfigProvider";
8
9
  import FontLoader from "../FontLoader";
9
10
  import { lobeCustomStylish, lobeCustomToken, lobeTheme } from "../styles";
10
- import { genCdnUrl } from "../utils/genCdnUrl";
11
11
  import GlobalStyle from "./GlobalStyle";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -19,24 +19,25 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
19
19
  customToken = _ref.customToken,
20
20
  _ref$enableWebfonts = _ref.enableWebfonts,
21
21
  enableWebfonts = _ref$enableWebfonts === void 0 ? true : _ref$enableWebfonts,
22
- _ref$webfonts = _ref.webfonts,
23
- webfonts = _ref$webfonts === void 0 ? [genCdnUrl({
24
- path: 'css/index.css',
25
- pkg: '@lobehub/webfont-mono',
26
- version: '1.0.0'
27
- }), genCdnUrl({
28
- path: 'css/index.css',
29
- pkg: '@lobehub/webfont-harmony-sans',
30
- version: '1.0.0'
31
- }), genCdnUrl({
32
- path: 'css/index.css',
33
- pkg: '@lobehub/webfont-harmony-sans-sc',
34
- version: '1.0.0'
35
- }), genCdnUrl({
36
- path: 'dist/katex.min.css',
37
- pkg: 'katex',
38
- version: '0.16.8'
39
- })] : _ref$webfonts;
22
+ webfonts = _ref.webfonts;
23
+ var genCdnUrl = useCdnFn();
24
+ var webfontUrls = webfonts || [genCdnUrl({
25
+ path: 'css/index.css',
26
+ pkg: '@lobehub/webfont-mono',
27
+ version: '1.0.0'
28
+ }), genCdnUrl({
29
+ path: 'css/index.css',
30
+ pkg: '@lobehub/webfont-harmony-sans',
31
+ version: '1.0.0'
32
+ }), genCdnUrl({
33
+ path: 'css/index.css',
34
+ pkg: '@lobehub/webfont-harmony-sans-sc',
35
+ version: '1.0.0'
36
+ }), genCdnUrl({
37
+ path: 'dist/katex.min.css',
38
+ pkg: 'katex',
39
+ version: '0.16.8'
40
+ })];
40
41
  useEffect(function () {
41
42
  setupStyled({
42
43
  ThemeContext: ThemeContext
@@ -49,7 +50,7 @@ var ThemeProvider = /*#__PURE__*/memo(function (_ref) {
49
50
  return _objectSpread(_objectSpread({}, lobeCustomToken(theme)), customToken === null || customToken === void 0 ? void 0 : customToken(theme));
50
51
  }, [customToken]);
51
52
  return /*#__PURE__*/_jsxs(_Fragment, {
52
- children: [enableWebfonts && (webfonts === null || webfonts === void 0 ? void 0 : webfonts.length) > 0 && webfonts.map(function (webfont, index) {
53
+ children: [enableWebfonts && (webfontUrls === null || webfontUrls === void 0 ? void 0 : webfontUrls.length) > 0 && webfontUrls.map(function (webfont, index) {
53
54
  return /*#__PURE__*/_jsx(FontLoader, {
54
55
  url: webfont
55
56
  }, index);
package/es/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export type { ChatListProps, OnActionClick, OnMessageChange, RenderErrorMessage,
11
11
  export { default as ChatList } from './ChatList';
12
12
  export { default as CodeEditor, type CodeEditorProps } from './CodeEditor';
13
13
  export { default as ColorScales, type ColorScalesProps } from './ColorScales';
14
+ export { type Config, default as ConfigProvider, useCdnFn } from './ConfigProvider';
14
15
  export { default as ContextMenu, type ContextMenuProps } from './ContextMenu';
15
16
  export { default as CopyButton, type CopyButtonProps } from './CopyButton';
16
17
  export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
package/es/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as ChatItem } from "./ChatItem";
10
10
  export { default as ChatList } from "./ChatList";
11
11
  export { default as CodeEditor } from "./CodeEditor";
12
12
  export { default as ColorScales } from "./ColorScales";
13
+ export { default as ConfigProvider, useCdnFn } from "./ConfigProvider";
13
14
  export { default as ContextMenu } from "./ContextMenu";
14
15
  export { default as CopyButton } from "./CopyButton";
15
16
  export { default as DraggablePanel } from "./DraggablePanel";
@@ -1,9 +1,8 @@
1
1
  export type CDN = 'aliyun' | 'unpkg';
2
- interface CdnApi {
2
+ export interface CdnApi {
3
3
  path: string;
4
4
  pkg: string;
5
5
  proxy?: CDN;
6
6
  version: string;
7
7
  }
8
8
  export declare const genCdnUrl: ({ pkg, version, path, proxy }: CdnApi) => string;
9
- export {};
@@ -1,3 +1,4 @@
1
+ import urlJoin from 'url-join';
1
2
  var UNPKG_API = 'https://unpkg.com';
2
3
  var ALIYUN_API = 'https://registry.npmmirror.com';
3
4
  export var genCdnUrl = function genCdnUrl(_ref) {
@@ -5,6 +6,14 @@ export var genCdnUrl = function genCdnUrl(_ref) {
5
6
  version = _ref.version,
6
7
  path = _ref.path,
7
8
  proxy = _ref.proxy;
8
- var api = proxy === 'unpkg' ? UNPKG_API : ALIYUN_API;
9
- return "".concat(api.replaceAll(/^\//g, ''), "/").concat(pkg, "/").concat(version, "/files/").concat(path.replaceAll(/^\//g, ''));
9
+ switch (proxy) {
10
+ case 'unpkg':
11
+ {
12
+ return urlJoin(UNPKG_API, "".concat(pkg, "@").concat(version), path);
13
+ }
14
+ default:
15
+ {
16
+ return urlJoin(ALIYUN_API, pkg, version, 'files', path);
17
+ }
18
+ }
10
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.94.7",
3
+ "version": "1.95.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -44,7 +44,7 @@
44
44
  "pull": "git pull",
45
45
  "release": "semantic-release",
46
46
  "setup": "dumi setup",
47
- "start": "dumi dev",
47
+ "start": "npm run docs:dev",
48
48
  "test": "vitest --passWithNoTests",
49
49
  "test:coverage": "vitest run --coverage --passWithNoTests",
50
50
  "test:update": "vitest -u",
@@ -109,6 +109,7 @@
109
109
  "swr": "^2",
110
110
  "three": "^0.150",
111
111
  "ts-md5": "^1",
112
+ "url-join": "^5",
112
113
  "use-merge-value": "^1",
113
114
  "zustand": "^4.4.1",
114
115
  "zustand-utils": "^1.3.1"