@yuntijs/ui 1.2.0-beta.6 → 1.2.0-beta.8

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.
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { ActionIcon, CopyButton } from '@lobehub/ui';
8
8
  import { Select } from 'antd';
9
9
  import { ChevronDown, ChevronRight } from 'lucide-react';
10
- import { memo, useState } from 'react';
10
+ import { memo, useEffect, useState } from 'react';
11
11
  import { Flexbox } from 'react-layout-kit';
12
12
  import { languageMap } from "../hooks/useHighlight";
13
13
  import { SyntaxHighlighter } from "./SyntaxHighlighter";
@@ -42,11 +42,17 @@ export var FullFeaturedHighlighter = /*#__PURE__*/memo(function (_ref) {
42
42
  _useState4 = _slicedToArray(_useState3, 2),
43
43
  lang = _useState4[0],
44
44
  setLang = _useState4[1];
45
- var _useStyles = useStyles('block'),
45
+ var _useStyles = useStyles({
46
+ type: 'block',
47
+ expand: expand
48
+ }),
46
49
  styles = _useStyles.styles,
47
50
  cx = _useStyles.cx;
48
51
  var container = cx(styles.container, className);
49
- return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
52
+ useEffect(function () {
53
+ setLang(language);
54
+ }, [language]);
55
+ return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
50
56
  className: container,
51
57
  "data-code-type": "highlighter",
52
58
  style: style
@@ -94,7 +100,9 @@ export var FullFeaturedHighlighter = /*#__PURE__*/memo(function (_ref) {
94
100
  }), /*#__PURE__*/_jsx(SyntaxHighlighter, {
95
101
  enableTransformer: enableTransformer,
96
102
  language: lang === null || lang === void 0 ? void 0 : lang.toLowerCase(),
97
- style: expand ? contentStyle : _objectSpread(_objectSpread({}, contentStyle), {}, {
103
+ style: expand ? _objectSpread(_objectSpread({}, contentStyle), {}, {
104
+ flex: 1
105
+ }) : _objectSpread(_objectSpread({}, contentStyle), {}, {
98
106
  height: 0,
99
107
  overflow: 'hidden'
100
108
  }),
@@ -11,6 +11,6 @@ export var useStyles = createStyles(function (_ref, _ref2) {
11
11
  var prefix = "".concat(prefixCls, "-highlighter");
12
12
  return {
13
13
  loading: cx(stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n inset-block-start: 0;\n inset-inline-end: 0;\n\n height: 34px;\n padding-block: 0;\n padding-inline: 8px;\n\n font-family: ", ";\n color: ", ";\n\n border-radius: ", ";\n "])), token.fontFamilyCode, token.colorTextTertiary, token.borderRadius)),
14
- shiki: cx("".concat(prefix, "-shiki"), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n margin: 0;\n padding: 0;\n\n & > pre {\n overflow: auto;\n margin: 0;\n padding: 0;\n ", "\n\n code {\n display: block;\n\n .line {\n display: inline-block;\n\n width: calc(100% + 32px);\n margin-block: 0;\n margin-inline: -16px;\n padding-block: 0;\n padding-inline: 16px;\n }\n }\n\n &.has-focused {\n .line:not(.focused) {\n opacity: 0.5;\n }\n }\n\n .highlighted {\n background: ", ";\n\n &.warning {\n background: ", ";\n }\n\n &.error {\n background: ", ";\n }\n }\n\n .highlighted-word {\n padding-block: 0.1em;\n padding-inline: 0.2em;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n .diff {\n &.remove {\n background: ", ";\n\n &::before {\n content: '-';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n\n &.add {\n background: ", ";\n\n &::before {\n content: '+';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n }\n }\n "])), !theme && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background: none !important;\n "]))), token.colorFillTertiary, token.colorWarningBg, token.colorErrorBg, token.colorFillTertiary, token.colorBorderSecondary, token.borderRadius, token.colorErrorBg, token.colorErrorText, token.colorSuccessBg, token.colorSuccessText))
14
+ shiki: cx("".concat(prefix, "-shiki"), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n height: 100%;\n margin: 0;\n padding: 0;\n\n & > pre {\n height: 100%;\n overflow: auto;\n margin: 0;\n padding: 0;\n ", "\n\n code {\n display: block;\n\n .line {\n display: inline-block;\n\n width: calc(100% + 32px);\n margin-block: 0;\n margin-inline: -16px;\n padding-block: 0;\n padding-inline: 16px;\n }\n }\n\n &.has-focused {\n .line:not(.focused) {\n opacity: 0.5;\n }\n }\n\n .highlighted {\n background: ", ";\n\n &.warning {\n background: ", ";\n }\n\n &.error {\n background: ", ";\n }\n }\n\n .highlighted-word {\n padding-block: 0.1em;\n padding-inline: 0.2em;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n .diff {\n &.remove {\n background: ", ";\n\n &::before {\n content: '-';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n\n &.add {\n background: ", ";\n\n &::before {\n content: '+';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n }\n }\n "])), !theme && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background: none !important;\n "]))), token.colorFillTertiary, token.colorWarningBg, token.colorErrorBg, token.colorFillTertiary, token.colorBorderSecondary, token.borderRadius, token.colorErrorBg, token.colorErrorText, token.colorSuccessBg, token.colorSuccessText))
15
15
  };
16
16
  });
@@ -35,7 +35,9 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
35
35
  enableTransformer = _ref.enableTransformer,
36
36
  theme = _ref.theme,
37
37
  rest = _objectWithoutProperties(_ref, _excluded);
38
- var _useStyles = useStyles(type),
38
+ var _useStyles = useStyles({
39
+ type: type
40
+ }),
39
41
  styles = _useStyles.styles,
40
42
  cx = _useStyles.cx;
41
43
  var container = cx(styles.container, wrap && styles.wrap, className);
@@ -1,4 +1,7 @@
1
- export declare const useStyles: (props?: "ghost" | "block" | "pure" | undefined) => import("antd-style").ReturnStyles<{
1
+ export declare const useStyles: (props?: {
2
+ type: 'ghost' | 'block' | 'pure';
3
+ expand?: boolean | undefined;
4
+ } | undefined) => import("antd-style").ReturnStyles<{
2
5
  button: string;
3
6
  container: string;
4
7
  header: import("antd-style").SerializedStyles;
@@ -1,19 +1,21 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
3
3
  import { createStyles } from 'antd-style';
4
- export var useStyles = createStyles(function (_ref, type) {
4
+ export var useStyles = createStyles(function (_ref, _ref2) {
5
5
  var token = _ref.token,
6
6
  css = _ref.css,
7
7
  cx = _ref.cx,
8
8
  prefixCls = _ref.prefixCls,
9
9
  stylish = _ref.stylish;
10
+ var type = _ref2.type,
11
+ expand = _ref2.expand;
10
12
  var prefix = "".concat(prefixCls, "-highlighter");
11
13
  var buttonHoverCls = "".concat(prefix, "-hover-btn");
12
14
  var langHoverCls = "".concat(prefix, "-hover-lang");
13
15
  var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border: 1px solid ", ";\n\n &:hover {\n background-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorder, type === 'block' ? token.colorFillTertiary : token.colorFillQuaternary);
14
16
  return {
15
17
  button: cx(buttonHoverCls, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-start: ", ";\n inset-inline-end: ", ";\n\n opacity: 0;\n "])), type === 'pure' ? 0 : '12px', type === 'pure' ? 0 : '12px')),
16
- container: cx(prefix, type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n margin: 0 !important;\n padding: ", " !important;\n }\n "])), token.borderRadius, token.motionEaseOut, buttonHoverCls, langHoverCls, type === 'pure' ? 0 : "16px")),
18
+ container: cx(prefix, type !== 'pure' && typeStylish, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n height: ", ";\n\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n .prism-code {\n background: none !important;\n }\n\n pre {\n height: 100%;\n margin: 0 !important;\n padding: ", " !important;\n }\n "])), expand ? '100%' : 'auto', token.borderRadius, token.motionEaseOut, buttonHoverCls, langHoverCls, type === 'pure' ? 0 : "16px")),
17
19
  header: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding-block: 4px;\n padding-inline: 8px;\n background: ", ";\n "])), token.colorFillQuaternary),
18
20
  lang: cx(langHoverCls, stylish.blur, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-end: 12px;\n inset-inline-end: 4px;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary)),
19
21
  wrap: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n pre {\n white-space: break-spaces;\n }\n "]))),
@@ -41,5 +41,6 @@ export interface MentionsProps extends MentionPickerPluginProps {
41
41
  autoSize?: AutoSize;
42
42
  code?: boolean;
43
43
  getPopContainer?: () => HTMLElement;
44
+ autoFocus?: 'rootStart' | 'rootEnd';
44
45
  }
45
46
  export declare const Mentions: React.ForwardRefExoticComponent<MentionsProps & React.RefAttributes<MentionsEditor>>;
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  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; }
3
3
  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; }
4
+ import { AutoFocusPlugin } from '@lexical/react/LexicalAutoFocusPlugin';
4
5
  import { ClearEditorPlugin } from '@lexical/react/LexicalClearEditorPlugin';
5
6
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
6
7
  import { ContentEditable } from '@lexical/react/LexicalContentEditable';
@@ -58,7 +59,8 @@ export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
58
59
  getPopContainer = _ref.getPopContainer,
59
60
  onPressEnter = _ref.onPressEnter,
60
61
  onKeyDown = _ref.onKeyDown,
61
- onTrigger = _ref.onTrigger;
62
+ onTrigger = _ref.onTrigger,
63
+ autoFocus = _ref.autoFocus;
62
64
  var _ConfigProvider$useCo = ConfigProvider.useConfig(),
63
65
  componentDisabled = _ConfigProvider$useCo.componentDisabled;
64
66
  var _useStyles = useStyles({
@@ -82,7 +84,9 @@ export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
82
84
  return new CustomTextNode(node.__text);
83
85
  }
84
86
  }, MentionNode],
85
- editorState: textToEditorState(value || defaultValue || '', triggers),
87
+ editorState: textToEditorState(value || defaultValue || '', triggers, {
88
+ punctuation: punctuation
89
+ }),
86
90
  onError: function onError(error) {
87
91
  throw error;
88
92
  }
@@ -177,6 +181,8 @@ export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
177
181
  onPressEnter: onPressEnter
178
182
  }), onKeyDown && /*#__PURE__*/_jsx(OnKeyDownPlugin, {
179
183
  onKeyDown: onKeyDown
184
+ }), autoFocus && /*#__PURE__*/_jsx(AutoFocusPlugin, {
185
+ defaultSelection: autoFocus
180
186
  })]
181
187
  })
182
188
  })
@@ -85,6 +85,9 @@ export var useHighlight = function useHighlight(text, lang, enableTransformer, t
85
85
  if (language === 'md') {
86
86
  return isDarkMode ? 'catppuccin-mocha' : 'catppuccin-latte';
87
87
  }
88
+ if (language === 'shellsession') {
89
+ return isDarkMode ? 'material-theme-darker' : 'material-theme-lighter';
90
+ }
88
91
  return isDarkMode ? 'slack-dark' : 'slack-ochin';
89
92
  }, [isDarkMode, language, matchedTheme]);
90
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuntijs/ui",
3
- "version": "1.2.0-beta.6",
3
+ "version": "1.2.0-beta.8",
4
4
  "description": "☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps",
5
5
  "keywords": [
6
6
  "yuntijs",