@lobehub/ui 2.12.0 → 2.12.1

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.
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- var _excluded = ["ref", "children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "animated", "enableLatex", "enableMermaid", "enableImageGallery", "enableCustomFootnotes", "enableGithubAlert", "enableStream", "componentProps", "allowHtml", "borderRadius", "fontSize", "headerMultiple", "marginMultiple", "variant", "reactMarkdownProps", "lineHeight", "rehypePlugins", "remarkPlugins", "remarkPluginsAhead", "components", "customRender", "citations"];
4
+ var _excluded = ["ref", "children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick", "animated", "enableLatex", "enableMermaid", "enableImageGallery", "enableCustomFootnotes", "enableGithubAlert", "enableStream", "componentProps", "allowHtml", "borderRadius", "fontSize", "headerMultiple", "marginMultiple", "variant", "reactMarkdownProps", "lineHeight", "rehypePlugins", "remarkPlugins", "remarkPluginsAhead", "components", "customRender", "showFootnotes", "citations"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -57,6 +57,8 @@ var Markdown = /*#__PURE__*/memo(function (props) {
57
57
  _props$components = props.components,
58
58
  components = _props$components === void 0 ? {} : _props$components,
59
59
  customRender = props.customRender,
60
+ _props$showFootnotes = props.showFootnotes,
61
+ showFootnotes = _props$showFootnotes === void 0 ? true : _props$showFootnotes,
60
62
  citations = props.citations,
61
63
  rest = _objectWithoutProperties(props, _excluded);
62
64
  var _useStyles = useStyles(),
@@ -134,6 +136,7 @@ var Markdown = /*#__PURE__*/memo(function (props) {
134
136
  rehypePlugins: rehypePlugins,
135
137
  remarkPlugins: remarkPlugins,
136
138
  remarkPluginsAhead: remarkPluginsAhead,
139
+ showFootnotes: showFootnotes,
137
140
  variant: variant
138
141
  },
139
142
  children: /*#__PURE__*/_jsx(Render, {
@@ -42,6 +42,7 @@ export interface SyntaxMarkdownProps {
42
42
  rehypePluginsAhead?: Pluggable[];
43
43
  remarkPlugins?: Pluggable[];
44
44
  remarkPluginsAhead?: Pluggable[];
45
+ showFootnotes?: boolean;
45
46
  variant?: 'default' | 'chat';
46
47
  }
47
48
  export interface MarkdownProps extends SyntaxMarkdownProps, Omit<TypographyProps, 'children'> {
@@ -31,7 +31,8 @@ export var useMarkdownComponents = function useMarkdownComponents() {
31
31
  citations = _useMarkdownContext.citations,
32
32
  componentProps = _useMarkdownContext.componentProps,
33
33
  enableMermaid = _useMarkdownContext.enableMermaid,
34
- fullFeaturedCodeBlock = _useMarkdownContext.fullFeaturedCodeBlock;
34
+ fullFeaturedCodeBlock = _useMarkdownContext.fullFeaturedCodeBlock,
35
+ showFootnotes = _useMarkdownContext.showFootnotes;
35
36
  var memoA = useCallback(
36
37
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
38
  function (_ref) {
@@ -60,8 +61,10 @@ export var useMarkdownComponents = function useMarkdownComponents() {
60
61
  function (_ref4) {
61
62
  var node = _ref4.node,
62
63
  props = _objectWithoutProperties(_ref4, _excluded4);
63
- return /*#__PURE__*/_jsx(Section, _objectSpread({}, props));
64
- }, []);
64
+ return /*#__PURE__*/_jsx(Section, _objectSpread({
65
+ showFootnotes: showFootnotes
66
+ }, props));
67
+ }, [showFootnotes]);
65
68
  var memoKbd = useCallback(function (_ref5) {
66
69
  var children = _ref5.children;
67
70
  return /*#__PURE__*/_jsx(Hotkey, {
@@ -2,6 +2,7 @@ import type { FC, ReactNode } from 'react';
2
2
  interface SectionProps {
3
3
  'children': ReactNode;
4
4
  'data-footnotes'?: boolean;
5
+ 'showFootnotes'?: boolean;
5
6
  }
6
7
  declare const Section: FC<SectionProps>;
7
8
  export default Section;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- var _excluded = ["children"];
4
+ var _excluded = ["children", "showFootnotes"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -13,9 +13,11 @@ import Footnotes from "../../Markdown/components/Footnotes";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  var Section = function Section(_ref) {
15
15
  var children = _ref.children,
16
+ showFootnotes = _ref.showFootnotes,
16
17
  rest = _objectWithoutProperties(_ref, _excluded);
17
18
  // 说明是脚注
18
19
  if (rest['data-footnotes']) {
20
+ if (!showFootnotes) return null;
19
21
  return /*#__PURE__*/_jsx(Footnotes, _objectSpread(_objectSpread({}, rest), {}, {
20
22
  children: children
21
23
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",