@lobehub/ui 1.2.0 → 1.3.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.
Files changed (179) hide show
  1. package/es/ActionIcon/index.d.ts +10 -5
  2. package/es/ActionIcon/index.js +15 -7
  3. package/es/ActionIcon/style.d.ts +4 -1
  4. package/es/ActionIcon/style.js +5 -3
  5. package/es/CopyButton/index.d.ts +34 -0
  6. package/es/CopyButton/index.js +49 -0
  7. package/es/DraggablePanel/index.d.ts +4 -4
  8. package/es/DraggablePanel/index.js +4 -4
  9. package/es/DraggablePanel/style.js +2 -2
  10. package/es/DraggablePanel/utils.d.ts +1 -1
  11. package/es/EditableText/ControlInput.d.ts +9 -0
  12. package/es/EditableText/ControlInput.js +88 -0
  13. package/es/EditableText/index.d.ts +5 -0
  14. package/es/EditableText/index.js +35 -0
  15. package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  16. package/es/Highlighter/SyntaxHighlighter/Prism.js +40 -0
  17. package/es/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  18. package/es/Highlighter/SyntaxHighlighter/index.js +58 -0
  19. package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  20. package/es/Highlighter/SyntaxHighlighter/style.js +15 -0
  21. package/es/Highlighter/index.d.ts +36 -0
  22. package/es/Highlighter/index.js +42 -0
  23. package/es/Highlighter/style.d.ts +5 -0
  24. package/es/Highlighter/style.js +18 -0
  25. package/es/Icon/index.d.ts +2 -3
  26. package/es/Icon/index.js +2 -2
  27. package/es/Logo/Divider.d.ts +3 -3
  28. package/es/Logo/Divider.js +6 -4
  29. package/es/Logo/Logo3D.d.ts +3 -3
  30. package/es/Logo/Logo3D.js +6 -4
  31. package/es/Logo/LogoFlat.d.ts +3 -3
  32. package/es/Logo/LogoFlat.js +6 -4
  33. package/es/Logo/LogoHighContrast.d.ts +3 -3
  34. package/es/Logo/LogoHighContrast.js +6 -4
  35. package/es/Logo/LogoText.d.ts +3 -3
  36. package/es/Logo/LogoText.js +6 -4
  37. package/es/Logo/index.d.ts +3 -3
  38. package/es/Logo/index.js +5 -5
  39. package/es/Logo/style.js +1 -1
  40. package/es/Markdown/Code.d.ts +3 -0
  41. package/es/Markdown/Code.js +12 -0
  42. package/es/Markdown/CodeBlock.d.ts +3 -0
  43. package/es/Markdown/CodeBlock.js +27 -0
  44. package/es/Markdown/index.d.ts +13 -0
  45. package/es/Markdown/index.js +28 -0
  46. package/es/Markdown/style.d.ts +4 -0
  47. package/es/Markdown/style.js +12 -0
  48. package/es/MessageInput/index.d.ts +35 -0
  49. package/es/MessageInput/index.js +63 -0
  50. package/es/SearchBar/index.d.ts +5 -0
  51. package/es/SearchBar/index.js +27 -0
  52. package/es/SideNav/index.d.ts +6 -6
  53. package/es/SideNav/index.js +17 -20
  54. package/es/SideNav/style.d.ts +1 -0
  55. package/es/SideNav/style.js +8 -0
  56. package/es/Snippet/index.d.ts +29 -0
  57. package/es/Snippet/index.js +39 -0
  58. package/es/Snippet/style.d.ts +1 -0
  59. package/es/Snippet/style.js +9 -0
  60. package/es/StroyBook/index.d.ts +3 -4
  61. package/es/StroyBook/index.js +14 -7
  62. package/es/StroyBook/style.d.ts +4 -1
  63. package/es/StroyBook/style.js +7 -5
  64. package/es/Swatches/index.d.ts +8 -0
  65. package/es/Swatches/index.js +44 -0
  66. package/es/TabsNav/index.d.ts +3 -3
  67. package/es/TabsNav/index.js +4 -4
  68. package/es/ThemeProvider/GlobalStyle.js +1 -1
  69. package/es/ThemeProvider/index.d.ts +15 -0
  70. package/es/ThemeSwitch/index.d.ts +5 -5
  71. package/es/ThemeSwitch/index.js +5 -9
  72. package/es/Tooltip/index.d.ts +5 -0
  73. package/es/Tooltip/index.js +20 -0
  74. package/es/Tooltip/style.d.ts +3 -0
  75. package/es/Tooltip/style.js +10 -0
  76. package/es/hooks/useCopied.d.ts +4 -0
  77. package/es/hooks/useCopied.js +26 -0
  78. package/es/hooks/useHighlight.d.ts +36 -0
  79. package/es/hooks/useHighlight.js +63 -0
  80. package/es/index.d.ts +9 -0
  81. package/es/index.js +10 -1
  82. package/es/styles/theme/base.d.ts +2 -0
  83. package/es/styles/theme/base.js +15 -0
  84. package/es/styles/theme/dark.js +6 -14
  85. package/es/styles/theme/light.js +11 -12
  86. package/es/types/index.d.ts +14 -5
  87. package/lib/ActionIcon/index.d.ts +10 -5
  88. package/lib/ActionIcon/index.js +39 -50
  89. package/lib/ActionIcon/style.d.ts +4 -1
  90. package/lib/ActionIcon/style.js +29 -22
  91. package/lib/CopyButton/index.d.ts +34 -0
  92. package/lib/CopyButton/index.js +70 -0
  93. package/lib/DraggablePanel/index.d.ts +4 -4
  94. package/lib/DraggablePanel/index.js +160 -158
  95. package/lib/DraggablePanel/style.js +1 -2
  96. package/lib/DraggablePanel/utils.d.ts +1 -1
  97. package/lib/EditableText/ControlInput.d.ts +9 -0
  98. package/lib/EditableText/ControlInput.js +101 -0
  99. package/lib/EditableText/index.d.ts +5 -0
  100. package/lib/EditableText/index.js +52 -0
  101. package/lib/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
  102. package/lib/Highlighter/SyntaxHighlighter/Prism.js +41 -0
  103. package/lib/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
  104. package/lib/Highlighter/SyntaxHighlighter/index.js +55 -0
  105. package/lib/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
  106. package/lib/Highlighter/SyntaxHighlighter/style.js +58 -0
  107. package/lib/Highlighter/index.d.ts +36 -0
  108. package/lib/Highlighter/index.js +62 -0
  109. package/lib/Highlighter/style.d.ts +5 -0
  110. package/lib/Highlighter/style.js +107 -0
  111. package/lib/Icon/index.d.ts +2 -3
  112. package/lib/Icon/index.js +3 -13
  113. package/lib/Logo/Divider.d.ts +3 -3
  114. package/lib/Logo/Divider.js +5 -15
  115. package/lib/Logo/Logo3D.d.ts +3 -3
  116. package/lib/Logo/Logo3D.js +4 -14
  117. package/lib/Logo/LogoFlat.d.ts +3 -3
  118. package/lib/Logo/LogoFlat.js +18 -28
  119. package/lib/Logo/LogoHighContrast.d.ts +3 -3
  120. package/lib/Logo/LogoHighContrast.js +4 -14
  121. package/lib/Logo/LogoText.d.ts +3 -3
  122. package/lib/Logo/LogoText.js +5 -15
  123. package/lib/Logo/index.d.ts +3 -3
  124. package/lib/Logo/index.js +11 -18
  125. package/lib/Logo/style.js +1 -1
  126. package/lib/Markdown/Code.d.ts +3 -0
  127. package/lib/Markdown/Code.js +33 -0
  128. package/lib/Markdown/CodeBlock.d.ts +3 -0
  129. package/lib/Markdown/CodeBlock.js +64 -0
  130. package/lib/Markdown/index.d.ts +13 -0
  131. package/lib/Markdown/index.js +48 -0
  132. package/lib/Markdown/style.d.ts +4 -0
  133. package/lib/Markdown/style.js +64 -0
  134. package/lib/MessageInput/index.d.ts +35 -0
  135. package/lib/MessageInput/index.js +58 -0
  136. package/lib/SearchBar/index.d.ts +5 -0
  137. package/lib/SearchBar/index.js +42 -0
  138. package/lib/SideNav/index.d.ts +6 -6
  139. package/lib/SideNav/index.js +7 -31
  140. package/lib/SideNav/style.d.ts +1 -0
  141. package/lib/SideNav/style.js +46 -0
  142. package/lib/Snippet/index.d.ts +29 -0
  143. package/lib/Snippet/index.js +47 -0
  144. package/lib/Snippet/style.d.ts +1 -0
  145. package/lib/Snippet/style.js +71 -0
  146. package/lib/StroyBook/index.d.ts +3 -4
  147. package/lib/StroyBook/index.js +20 -13
  148. package/lib/StroyBook/style.d.ts +4 -1
  149. package/lib/StroyBook/style.js +49 -43
  150. package/lib/Swatches/index.d.ts +8 -0
  151. package/lib/Swatches/index.js +68 -0
  152. package/lib/TabsNav/index.d.ts +3 -3
  153. package/lib/TabsNav/index.js +5 -15
  154. package/lib/ThemeProvider/GlobalStyle.js +7 -5
  155. package/lib/ThemeProvider/index.d.ts +15 -0
  156. package/lib/ThemeSwitch/index.d.ts +5 -5
  157. package/lib/ThemeSwitch/index.js +15 -32
  158. package/lib/Tooltip/index.d.ts +5 -0
  159. package/lib/Tooltip/index.js +34 -0
  160. package/lib/Tooltip/style.d.ts +3 -0
  161. package/lib/Tooltip/style.js +51 -0
  162. package/lib/hooks/useCopied.d.ts +4 -0
  163. package/lib/hooks/useCopied.js +44 -0
  164. package/lib/hooks/useHighlight.d.ts +36 -0
  165. package/lib/hooks/useHighlight.js +76 -0
  166. package/lib/index.d.ts +9 -0
  167. package/lib/index.js +29 -0
  168. package/lib/styles/theme/base.d.ts +2 -0
  169. package/lib/styles/theme/base.js +43 -0
  170. package/lib/styles/theme/dark.js +5 -12
  171. package/lib/styles/theme/light.js +10 -10
  172. package/lib/types/index.d.ts +14 -5
  173. package/package.json +12 -4
  174. package/es/ThemeProvider/token.d.ts +0 -3
  175. package/es/ThemeProvider/token.js +0 -45
  176. package/es/types/index.js +0 -1
  177. package/lib/ThemeProvider/token.d.ts +0 -3
  178. package/lib/ThemeProvider/token.js +0 -73
  179. package/lib/types/index.js +0 -17
@@ -0,0 +1,58 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/MessageInput/index.tsx
20
+ var MessageInput_exports = {};
21
+ __export(MessageInput_exports, {
22
+ default: () => MessageInput_default
23
+ });
24
+ module.exports = __toCommonJS(MessageInput_exports);
25
+ var import_antd = require("antd");
26
+ var import_antd_style = require("antd-style");
27
+ var import_react = require("react");
28
+ var import_react_layout_kit = require("react-layout-kit");
29
+ var MessageInput = (0, import_react.memo)(
30
+ ({ onCancel, defaultValue, onConfirm, renderButtons, height, className }) => {
31
+ const [tempSystemRole, setRole] = (0, import_react.useState)(defaultValue || "");
32
+ return /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { gap: 8 }, /* @__PURE__ */ React.createElement(
33
+ import_antd.Input.TextArea,
34
+ {
35
+ value: tempSystemRole,
36
+ allowClear: true,
37
+ placeholder: "例如:你是一名擅长翻译的翻译官,请将用户所输入的英文都翻译为中文。",
38
+ style: { height: height ?? 200 },
39
+ onChange: (e) => {
40
+ setRole(e.target.value);
41
+ },
42
+ className: (0, import_antd_style.cx)("nowheel", className)
43
+ }
44
+ ), /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { direction: "horizontal-reverse", gap: 8 }, renderButtons ? renderButtons(tempSystemRole).map((buttonProps, index) => /* @__PURE__ */ React.createElement(import_antd.Button, { key: index, ...buttonProps })) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
45
+ import_antd.Button,
46
+ {
47
+ type: "primary",
48
+ onClick: () => {
49
+ onConfirm == null ? void 0 : onConfirm(tempSystemRole);
50
+ }
51
+ },
52
+ "设定"
53
+ ), /* @__PURE__ */ React.createElement(import_antd.Button, { type: "text", onClick: onCancel }, "取消"))));
54
+ }
55
+ );
56
+ var MessageInput_default = MessageInput;
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {});
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { InputProps } from 'antd';
3
+ export declare type SearchBarProps = InputProps;
4
+ declare const SearchBar: import("react").MemoExoticComponent<({ value, onChange, style, placeholder, ...props }: SearchBarProps) => import("react/jsx-runtime").JSX.Element>;
5
+ export default SearchBar;
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/SearchBar/index.tsx
20
+ var SearchBar_exports = {};
21
+ __export(SearchBar_exports, {
22
+ default: () => SearchBar_default
23
+ });
24
+ module.exports = __toCommonJS(SearchBar_exports);
25
+ var import_icons = require("@ant-design/icons");
26
+ var import_antd = require("antd");
27
+ var import_react = require("react");
28
+ var SearchBar = (0, import_react.memo)(({ value, onChange, style, placeholder, ...props }) => /* @__PURE__ */ React.createElement(
29
+ import_antd.Input,
30
+ {
31
+ prefix: /* @__PURE__ */ React.createElement(import_icons.SearchOutlined, null),
32
+ allowClear: true,
33
+ value,
34
+ placeholder: placeholder ?? "Search",
35
+ style: { ...style, borderColor: "transparent" },
36
+ onChange,
37
+ ...props
38
+ }
39
+ ));
40
+ var SearchBar_default = SearchBar;
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {});
@@ -1,18 +1,18 @@
1
1
  import { DivProps } from "../types";
2
- import React from 'react';
2
+ import { ReactNode } from 'react';
3
3
  export interface SideNavProps extends DivProps {
4
4
  /**
5
5
  * @description Avatar to be displayed at the top of the sidenav
6
6
  */
7
- avatar?: React.ReactNode;
7
+ avatar?: ReactNode;
8
8
  /**
9
9
  * @description Actions to be displayed below the avatar
10
10
  */
11
- topActions?: React.ReactNode;
11
+ topActions?: ReactNode;
12
12
  /**
13
13
  * @description Actions to be displayed at the bottom of the sidenav
14
14
  */
15
- bottomActions: React.ReactNode;
15
+ bottomActions: ReactNode;
16
16
  }
17
- declare const _default: React.NamedExoticComponent<SideNavProps>;
18
- export default _default;
17
+ declare const SideNav: import("react").NamedExoticComponent<SideNavProps>;
18
+ export default SideNav;
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // src/SideNav/index.tsx
@@ -33,26 +23,12 @@ __export(SideNav_exports, {
33
23
  });
34
24
  module.exports = __toCommonJS(SideNav_exports);
35
25
  var import_antd = require("antd");
36
- var import_react = __toESM(require("react"));
37
- var import_styled_components = __toESM(require("styled-components"));
38
- var Layout = import_styled_components.default.div`
39
- display: flex;
40
- flex: none;
41
- flex-direction: column;
42
- align-items: center;
43
- justify-content: space-between;
44
-
45
- width: 64px;
46
- height: 100%;
47
- min-height: 640px;
48
- padding: 16px 0;
49
-
50
- background: ${({ theme }) => theme.colorBgContainer};
51
- border-right: 1px solid ${({ theme }) => theme.colorBorder};
52
- `;
53
- var SideNav = ({ avatar, topActions, bottomActions, ...props }) => {
54
- return /* @__PURE__ */ import_react.default.createElement(Layout, { ...props }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { size: 16, direction: "vertical", align: "center" }, avatar, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { size: 8, direction: "vertical", align: "center" }, topActions)), /* @__PURE__ */ import_react.default.createElement(import_antd.Space, { size: 4, direction: "vertical", align: "center" }, bottomActions));
55
- };
56
- var SideNav_default = import_react.default.memo(SideNav);
26
+ var import_react = require("react");
27
+ var import_style = require("./style");
28
+ var SideNav = (0, import_react.memo)(({ className, avatar, topActions, bottomActions, ...props }) => {
29
+ const { styles, cx } = (0, import_style.useStyles)();
30
+ return /* @__PURE__ */ React.createElement("div", { className: cx(styles, className), ...props }, /* @__PURE__ */ React.createElement(import_antd.Space, { size: 16, direction: "vertical", align: "center" }, avatar, /* @__PURE__ */ React.createElement(import_antd.Space, { size: 8, direction: "vertical", align: "center" }, topActions)), /* @__PURE__ */ React.createElement(import_antd.Space, { size: 4, direction: "vertical", align: "center" }, bottomActions));
31
+ });
32
+ var SideNav_default = SideNav;
57
33
  // Annotate the CommonJS export names for ESM import in node:
58
34
  0 && (module.exports = {});
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<import("antd-style").SerializedStyles>;
@@ -0,0 +1,46 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/SideNav/style.ts
20
+ var style_exports = {};
21
+ __export(style_exports, {
22
+ useStyles: () => useStyles
23
+ });
24
+ module.exports = __toCommonJS(style_exports);
25
+ var import_antd_style = require("antd-style");
26
+ var useStyles = (0, import_antd_style.createStyles)(
27
+ ({ css, token }) => css`
28
+ display: flex;
29
+ flex: none;
30
+ flex-direction: column;
31
+ align-items: center;
32
+ justify-content: space-between;
33
+
34
+ width: 64px;
35
+ height: 100%;
36
+ min-height: 640px;
37
+ padding: 16px 0;
38
+
39
+ background: ${token.colorBgContainer};
40
+ border-right: 1px solid ${token.colorBorder};
41
+ `
42
+ );
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ useStyles
46
+ });
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { DivProps } from "../types";
3
+ export interface SnippetProps extends DivProps {
4
+ /**
5
+ * @description The content to be displayed inside the Snippet component
6
+ */
7
+ children: string;
8
+ /**
9
+ * @description The symbol to be displayed before the content inside the Snippet component
10
+ */
11
+ symbol?: string;
12
+ /**
13
+ * @description The language of the content inside the Snippet component
14
+ * @default 'tsx'
15
+ */
16
+ language?: string;
17
+ /**
18
+ * @description Whether the Snippet component is copyable or not
19
+ * @default true
20
+ */
21
+ copyable?: boolean;
22
+ /**
23
+ * @description The type of the Snippet component
24
+ * @default 'ghost'
25
+ */
26
+ type?: 'ghost' | 'block';
27
+ }
28
+ declare const Snippet: import("react").NamedExoticComponent<SnippetProps>;
29
+ export default Snippet;
@@ -0,0 +1,47 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/Snippet/index.tsx
30
+ var Snippet_exports = {};
31
+ __export(Snippet_exports, {
32
+ default: () => Snippet_default
33
+ });
34
+ module.exports = __toCommonJS(Snippet_exports);
35
+ var import_react = require("react");
36
+ var import_CopyButton = __toESM(require("../CopyButton"));
37
+ var import_Highlighter = require("../Highlighter");
38
+ var import_style = require("./style");
39
+ var Snippet = (0, import_react.memo)(
40
+ ({ symbol, language = "tsx", children, copyable = true, type = "ghost", ...props }) => {
41
+ const { styles } = (0, import_style.useStyles)(type);
42
+ return /* @__PURE__ */ React.createElement("div", { className: styles, ...props }, /* @__PURE__ */ React.createElement(import_Highlighter.SyntaxHighlighter, { language }, [symbol, children].filter(Boolean).join(" ")), copyable && /* @__PURE__ */ React.createElement(import_CopyButton.default, { size: { fontSize: 14, blockSize: 24 }, content: children }));
43
+ }
44
+ );
45
+ var Snippet_default = Snippet;
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {});
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: "block" | "ghost" | undefined) => import("antd-style").ReturnStyles<import("antd-style").SerializedStyles>;
@@ -0,0 +1,71 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/Snippet/style.ts
20
+ var style_exports = {};
21
+ __export(style_exports, {
22
+ useStyles: () => useStyles
23
+ });
24
+ module.exports = __toCommonJS(style_exports);
25
+ var import_antd_style = require("antd-style");
26
+ var import_polished = require("polished");
27
+ var useStyles = (0, import_antd_style.createStyles)(
28
+ ({ css, token }, type) => css`
29
+ display: flex;
30
+ max-width: 100%;
31
+ position: relative;
32
+ align-items: center;
33
+ border-radius: ${token.borderRadius}px;
34
+ gap: 8px;
35
+ padding: 0 8px;
36
+ height: 36px;
37
+ transition: background-color 100ms ${token.motionEaseOut};
38
+
39
+ ${type === "block" ? css`
40
+ background-color: ${(0, import_polished.rgba)(token.colorBgElevated, 0.6)};
41
+ ` : css`
42
+ border: 1px solid ${token.colorBorder};
43
+ `}
44
+
45
+ &:hover {
46
+ background-color: ${token.colorFillTertiary};
47
+ }
48
+
49
+ .ant-highlighter-shiki {
50
+ overflow: auto;
51
+ flex: 1;
52
+ }
53
+ .prism-code {
54
+ background: none !important;
55
+ }
56
+
57
+ pre {
58
+ background: none !important;
59
+ padding-top: 6px; !important;
60
+ margin: 0 !important;
61
+ line-height: 1;
62
+ }
63
+ code[class*='language-'] {
64
+ background: none !important;
65
+ }
66
+ `
67
+ );
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ useStyles
71
+ });
@@ -1,6 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { DivProps } from "../types";
2
3
  import { useControls, useCreateStore } from 'leva';
3
- import React from 'react';
4
4
  export { useCreateStore, useControls };
5
5
  export interface StroyBookProps extends DivProps {
6
6
  /**
@@ -13,6 +13,5 @@ export interface StroyBookProps extends DivProps {
13
13
  */
14
14
  noPadding?: boolean;
15
15
  }
16
- export declare const StroyBook: React.FC<StroyBookProps>;
17
- declare const _default: React.NamedExoticComponent<StroyBookProps>;
18
- export default _default;
16
+ export declare const StroyBook: import("react").NamedExoticComponent<StroyBookProps>;
17
+ export default StroyBook;
@@ -35,21 +35,28 @@ __export(StroyBook_exports, {
35
35
  useCreateStore: () => import_leva.useCreateStore
36
36
  });
37
37
  module.exports = __toCommonJS(StroyBook_exports);
38
- var import__ = require("../index");
38
+ var import_antd_style = require("antd-style");
39
39
  var import_leva = require("leva");
40
- var import_react = __toESM(require("react"));
40
+ var import_react = require("react");
41
+ var import_DraggablePanel = __toESM(require("../DraggablePanel"));
41
42
  var import_style = require("./style");
42
- var StroyBook = ({
43
- levaStore,
44
- noPadding,
45
- className,
46
- children,
47
- ...props
48
- }) => {
49
- const { styles, cx } = (0, import_style.useStyles)(noPadding);
50
- return /* @__PURE__ */ import_react.default.createElement("div", { className: cx(styles.editor, className), ...props }, /* @__PURE__ */ import_react.default.createElement("div", { className: styles.left }, children), /* @__PURE__ */ import_react.default.createElement(import__.DraggablePanel, { className: styles.right, placement: "right" }, /* @__PURE__ */ import_react.default.createElement(import_leva.LevaPanel, { fill: true, store: levaStore, titleBar: false, flat: true }), " "));
51
- };
52
- var StroyBook_default = import_react.default.memo(StroyBook);
43
+ var StroyBook = (0, import_react.memo)(
44
+ ({ levaStore, noPadding, className, children, ...props }) => {
45
+ const { mobile } = (0, import_antd_style.useResponsive)();
46
+ const { styles, cx } = (0, import_style.useStyles)({ noPadding: Boolean(noPadding), mobile: Boolean(mobile) });
47
+ return /* @__PURE__ */ React.createElement("div", { className: cx(styles.editor, className), ...props }, /* @__PURE__ */ React.createElement("div", { className: styles.left }, children), /* @__PURE__ */ React.createElement(
48
+ import_DraggablePanel.default,
49
+ {
50
+ className: styles.right,
51
+ placement: mobile ? "bottom" : "right",
52
+ minWidth: 280
53
+ },
54
+ /* @__PURE__ */ React.createElement(import_leva.LevaPanel, { fill: true, store: levaStore, titleBar: false, flat: true }),
55
+ " "
56
+ ));
57
+ }
58
+ );
59
+ var StroyBook_default = StroyBook;
53
60
  // Annotate the CommonJS export names for ESM import in node:
54
61
  0 && (module.exports = {
55
62
  StroyBook,
@@ -1,4 +1,7 @@
1
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
1
+ export declare const useStyles: (props?: {
2
+ noPadding: boolean;
3
+ mobile: boolean;
4
+ } | undefined) => import("antd-style").ReturnStyles<{
2
5
  editor: import("antd-style").SerializedStyles;
3
6
  left: import("antd-style").SerializedStyles;
4
7
  right: import("antd-style").SerializedStyles;
@@ -23,52 +23,58 @@ __export(style_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(style_exports);
25
25
  var import_antd_style = require("antd-style");
26
- var useStyles = (0, import_antd_style.createStyles)(({ css, token }, noPadding) => {
27
- return {
28
- editor: css`
29
- display: flex;
30
- align-items: stretch;
31
- justify-content: stretch;
32
- width: inherit;
33
- min-height: inherit;
34
- `,
35
- left: css`
36
- flex: 1;
37
- display: flex;
38
- align-items: center;
39
- justify-content: center;
40
- ${!noPadding && css`
41
- padding: 40px 24px;
42
- `}
43
- `,
44
- right: css`
45
- --leva-sizes-controlWidth: 66%;
46
- --leva-colors-elevation1: ${token.colorFillSecondary};
47
- --leva-colors-elevation2: transparent;
48
- --leva-colors-elevation3: ${token.colorFillSecondary};
49
- --leva-colors-accent1: ${token.colorPrimary};
50
- --leva-colors-accent2: ${token.colorPrimaryHover};
51
- --leva-colors-accent3: ${token.colorPrimaryActive};
52
- --leva-colors-highlight1: ${token.colorTextTertiary};
53
- --leva-colors-highlight2: ${token.colorTextSecondary};
54
- --leva-colors-highlight3: ${token.colorText};
55
- --leva-colors-vivid1: ${token.colorWarning};
56
- --leva-shadows-level1: unset;
57
- --leva-shadows-level2: unset;
58
- padding: 6px 0;
59
- background: ${token.colorBgLayout};
60
- > div {
61
- background: transparent;
26
+ var useStyles = (0, import_antd_style.createStyles)(
27
+ ({ css, token }, { noPadding, mobile }) => {
28
+ return {
29
+ editor: css`
30
+ display: flex;
31
+ align-items: stretch;
32
+ justify-content: stretch;
33
+ width: inherit;
34
+ min-height: inherit;
35
+ ${mobile && css`
36
+ flex-direction: column;
37
+ `}
38
+ `,
39
+ left: css`
40
+ flex: 1;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ overflow: auto;
45
+ ${!noPadding && css`
46
+ padding: 40px 24px;
47
+ `}
48
+ `,
49
+ right: css`
50
+ --leva-sizes-controlWidth: 66%;
51
+ --leva-colors-elevation1: ${token.colorFillSecondary};
52
+ --leva-colors-elevation2: transparent;
53
+ --leva-colors-elevation3: ${token.colorFillSecondary};
54
+ --leva-colors-accent1: ${token.colorPrimary};
55
+ --leva-colors-accent2: ${token.colorPrimaryHover};
56
+ --leva-colors-accent3: ${token.colorPrimaryActive};
57
+ --leva-colors-highlight1: ${token.colorTextTertiary};
58
+ --leva-colors-highlight2: ${token.colorTextSecondary};
59
+ --leva-colors-highlight3: ${token.colorText};
60
+ --leva-colors-vivid1: ${token.colorWarning};
61
+ --leva-shadows-level1: unset;
62
+ --leva-shadows-level2: unset;
63
+ padding: 6px 0;
64
+ background: ${token.colorBgLayout};
62
65
  > div {
63
66
  background: transparent;
67
+ > div {
68
+ background: transparent;
69
+ }
64
70
  }
65
- }
66
- input:checked + label > svg {
67
- stroke: ${token.colorBorder};
68
- }
69
- `
70
- };
71
- });
71
+ input:checked + label > svg {
72
+ stroke: ${token.colorBorder};
73
+ }
74
+ `
75
+ };
76
+ }
77
+ );
72
78
  // Annotate the CommonJS export names for ESM import in node:
73
79
  0 && (module.exports = {
74
80
  useStyles
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export interface SwatchesProps {
3
+ colors: string[];
4
+ activeColor?: string;
5
+ onSelect?: (c: string | null) => void;
6
+ }
7
+ declare const Swatches: import("react").NamedExoticComponent<SwatchesProps>;
8
+ export default Swatches;
@@ -0,0 +1,68 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/Swatches/index.tsx
20
+ var Swatches_exports = {};
21
+ __export(Swatches_exports, {
22
+ default: () => Swatches_default
23
+ });
24
+ module.exports = __toCommonJS(Swatches_exports);
25
+ var import_antd_style = require("antd-style");
26
+ var import_react = require("react");
27
+ var import_react_layout_kit = require("react-layout-kit");
28
+ var Swatches = (0, import_react.memo)(({ colors, activeColor, onSelect }) => {
29
+ const theme = (0, import_antd_style.useTheme)();
30
+ return /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, gap: 8 }, /* @__PURE__ */ React.createElement(
31
+ import_react_layout_kit.Flexbox,
32
+ {
33
+ style: {
34
+ width: 24,
35
+ height: 24,
36
+ background: theme.colorBgContainer,
37
+ boxShadow: `inset 0 0 0px 2px ${!activeColor ? theme.colorPrimary : "rgba(0,0,0,0.1)"}`,
38
+ borderRadius: "50%",
39
+ cursor: "pointer"
40
+ },
41
+ onClick: () => {
42
+ onSelect == null ? void 0 : onSelect(null);
43
+ }
44
+ }
45
+ ), colors.map((c) => {
46
+ const borderColor = c === activeColor ? theme.colorPrimary : "rgba(0,0,0,0.1)";
47
+ return /* @__PURE__ */ React.createElement(
48
+ import_react_layout_kit.Flexbox,
49
+ {
50
+ key: c,
51
+ style: {
52
+ width: 24,
53
+ height: 24,
54
+ background: c,
55
+ boxShadow: `inset 0 0 0px 2px ${borderColor}`,
56
+ borderRadius: "50%",
57
+ cursor: "pointer"
58
+ },
59
+ onClick: () => {
60
+ onSelect == null ? void 0 : onSelect(c);
61
+ }
62
+ }
63
+ );
64
+ }));
65
+ });
66
+ var Swatches_default = Swatches;
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {});