@arcblock/ux 3.1.58 → 3.1.59
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/lib/CodeBlock/index.d.ts +2 -1
- package/lib/CodeBlock/index.js +43 -42
- package/lib/package.json.js +1 -1
- package/package.json +7 -7
- package/src/CodeBlock/index.tsx +4 -2
package/lib/CodeBlock/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {
|
|
|
4
4
|
language?: string;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
dark?: true | false;
|
|
7
|
+
showDefaultText?: true | false;
|
|
7
8
|
sx?: SxProps;
|
|
8
9
|
}
|
|
9
|
-
export default function CodeBlock({ code, language, children, dark, ...rest }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default function CodeBlock({ code, language, children, dark, showDefaultText, ...rest }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
package/lib/CodeBlock/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as C } from "react";
|
|
3
|
+
import _ from "copy-to-clipboard";
|
|
4
4
|
import e from "highlight.js/lib/core";
|
|
5
5
|
import s from "highlight.js/lib/languages/javascript";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
6
|
+
import g from "highlight.js/lib/languages/typescript";
|
|
7
|
+
import z from "highlight.js/lib/languages/json";
|
|
8
|
+
import F from "highlight.js/lib/languages/elixir";
|
|
9
|
+
import M from "highlight.js/lib/languages/java";
|
|
10
|
+
import B from "highlight.js/lib/languages/swift";
|
|
11
11
|
import d from "highlight.js/lib/languages/objectivec";
|
|
12
12
|
import f from "highlight.js/lib/languages/kotlin";
|
|
13
13
|
import h from "highlight.js/lib/languages/protobuf";
|
|
@@ -16,21 +16,21 @@ import y from "highlight.js/lib/languages/yaml";
|
|
|
16
16
|
import L from "highlight.js/lib/languages/shell";
|
|
17
17
|
import b from "highlight.js/lib/languages/diff";
|
|
18
18
|
import w from "highlight.js/lib/languages/plaintext";
|
|
19
|
-
import
|
|
19
|
+
import P from "highlight.js/lib/languages/markdown";
|
|
20
20
|
import "highlight.js/styles/atom-one-dark.css";
|
|
21
|
-
import { FileCopy as
|
|
22
|
-
import
|
|
23
|
-
import { styled as
|
|
24
|
-
import
|
|
21
|
+
import { FileCopy as S, Check as T } from "@mui/icons-material";
|
|
22
|
+
import o from "../Colors/themes/default.js";
|
|
23
|
+
import { styled as A } from "../Theme/index.js";
|
|
24
|
+
import E from "./LightBox.js";
|
|
25
25
|
e.registerLanguage("javascript", s);
|
|
26
26
|
e.registerLanguage("js", s);
|
|
27
27
|
e.registerLanguage("jsx", s);
|
|
28
|
-
e.registerLanguage("typescript",
|
|
29
|
-
e.registerLanguage("ts",
|
|
30
|
-
e.registerLanguage("tsx",
|
|
31
|
-
e.registerLanguage("json",
|
|
32
|
-
e.registerLanguage("elixir",
|
|
33
|
-
e.registerLanguage("java",
|
|
28
|
+
e.registerLanguage("typescript", g);
|
|
29
|
+
e.registerLanguage("ts", g);
|
|
30
|
+
e.registerLanguage("tsx", g);
|
|
31
|
+
e.registerLanguage("json", z);
|
|
32
|
+
e.registerLanguage("elixir", F);
|
|
33
|
+
e.registerLanguage("java", M);
|
|
34
34
|
e.registerLanguage("kotlin", f);
|
|
35
35
|
e.registerLanguage("kt", f);
|
|
36
36
|
e.registerLanguage("protobuf", h);
|
|
@@ -45,43 +45,44 @@ e.registerLanguage("plaintext", w);
|
|
|
45
45
|
e.registerLanguage("text", w);
|
|
46
46
|
e.registerLanguage("patch", b);
|
|
47
47
|
e.registerLanguage("diff", b);
|
|
48
|
-
e.registerLanguage("swift",
|
|
48
|
+
e.registerLanguage("swift", B);
|
|
49
49
|
e.registerLanguage("objectivec", d);
|
|
50
50
|
e.registerLanguage("oc", d);
|
|
51
|
-
e.registerLanguage("markdown",
|
|
51
|
+
e.registerLanguage("markdown", P);
|
|
52
52
|
function le({
|
|
53
53
|
code: r = "",
|
|
54
54
|
language: a = "text",
|
|
55
55
|
children: k = null,
|
|
56
56
|
dark: j = !0,
|
|
57
|
-
|
|
57
|
+
showDefaultText: v = !0,
|
|
58
|
+
...$
|
|
58
59
|
}) {
|
|
59
|
-
const [
|
|
60
|
-
|
|
60
|
+
const [l, p] = C(!1), c = r || k, N = () => {
|
|
61
|
+
l || (_(c), p(!0), setTimeout(() => {
|
|
61
62
|
p(!1);
|
|
62
63
|
}, 1500));
|
|
63
|
-
}, m = /* @__PURE__ */ i(
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
}, m = /* @__PURE__ */ i(H, { ...$, children: [
|
|
65
|
+
/* @__PURE__ */ t("span", { className: "codeblock__inner", children: /* @__PURE__ */ t(
|
|
65
66
|
"code",
|
|
66
67
|
{
|
|
67
68
|
className: `hljs ${a}`,
|
|
68
69
|
dangerouslySetInnerHTML: { __html: e.highlightAuto(c, [a]).value }
|
|
69
70
|
}
|
|
70
71
|
) }),
|
|
71
|
-
/* @__PURE__ */ i("div", { className: "copy-button", onClick:
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ i("div", { className: "copy-button", onClick: N, children: [
|
|
73
|
+
v && /* @__PURE__ */ t("span", { className: "default-text", children: a }),
|
|
74
|
+
/* @__PURE__ */ t("span", { className: "hover-text", children: l ? /* @__PURE__ */ i(u, { children: [
|
|
75
|
+
/* @__PURE__ */ t(T, { className: "copy-icon" }),
|
|
76
|
+
/* @__PURE__ */ t("span", { className: "button-lang-text", children: "copied" })
|
|
76
77
|
] }) : /* @__PURE__ */ i(u, { children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ t(S, { className: "copy-icon" }),
|
|
79
|
+
/* @__PURE__ */ t("span", { className: "button-lang-text", children: "copy" })
|
|
79
80
|
] }) })
|
|
80
81
|
] })
|
|
81
82
|
] });
|
|
82
|
-
return j ? m : /* @__PURE__ */
|
|
83
|
+
return j ? m : /* @__PURE__ */ t(E, { children: m });
|
|
83
84
|
}
|
|
84
|
-
const n = "source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important",
|
|
85
|
+
const n = "source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important", H = A("pre", {
|
|
85
86
|
shouldForwardProp: (r) => r !== "sx"
|
|
86
87
|
})`
|
|
87
88
|
font-family: ${n};
|
|
@@ -103,7 +104,7 @@ const n = "source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !imp
|
|
|
103
104
|
display: block;
|
|
104
105
|
width: 100%;
|
|
105
106
|
max-height: 46.25rem;
|
|
106
|
-
overflow:
|
|
107
|
+
overflow: auto;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
.copy-button {
|
|
@@ -123,7 +124,7 @@ const n = "source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !imp
|
|
|
123
124
|
|
|
124
125
|
.copy-icon {
|
|
125
126
|
font-size: 16px;
|
|
126
|
-
color: ${
|
|
127
|
+
color: ${o.common.white};
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
.hover-text {
|
|
@@ -131,20 +132,20 @@ const n = "source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !imp
|
|
|
131
132
|
}
|
|
132
133
|
.default-text {
|
|
133
134
|
font-size: 12px;
|
|
134
|
-
color: ${
|
|
135
|
+
color: ${o.common.white};
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
&:hover {
|
|
139
140
|
.copy-button {
|
|
140
141
|
display: flex;
|
|
141
|
-
background: ${
|
|
142
|
+
background: ${o.primary.main};
|
|
142
143
|
|
|
143
144
|
.hover-text {
|
|
144
145
|
display: flex;
|
|
145
146
|
justify-content: center;
|
|
146
147
|
align-items: center;
|
|
147
|
-
color: ${
|
|
148
|
+
color: ${o.common.white};
|
|
148
149
|
}
|
|
149
150
|
.default-text {
|
|
150
151
|
display: none;
|
|
@@ -156,7 +157,7 @@ const n = "source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !imp
|
|
|
156
157
|
.button-lang-text {
|
|
157
158
|
margin-left: 4px;
|
|
158
159
|
font-size: 12px;
|
|
159
|
-
color: ${
|
|
160
|
+
color: ${o.common.white};
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
code {
|
|
@@ -164,7 +165,7 @@ const n = "source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !imp
|
|
|
164
165
|
counter-increment: line;
|
|
165
166
|
padding: 16px;
|
|
166
167
|
font-family: ${n};
|
|
167
|
-
color: ${
|
|
168
|
+
color: ${o.common.white};
|
|
168
169
|
* {
|
|
169
170
|
font-family: ${n};
|
|
170
171
|
}
|
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.59",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -68,16 +68,16 @@
|
|
|
68
68
|
"react": "^19.0.0",
|
|
69
69
|
"react-router-dom": "^6.22.3"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "40bce7b0f6ed43f138bdd0c0d73f365533e66c80",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@arcblock/bridge": "3.1.
|
|
73
|
+
"@arcblock/bridge": "3.1.59",
|
|
74
74
|
"@arcblock/did": "^1.27.2",
|
|
75
75
|
"@arcblock/did-motif": "^1.1.14",
|
|
76
|
-
"@arcblock/icons": "3.1.
|
|
77
|
-
"@arcblock/nft-display": "3.1.
|
|
78
|
-
"@arcblock/react-hooks": "3.1.
|
|
76
|
+
"@arcblock/icons": "3.1.59",
|
|
77
|
+
"@arcblock/nft-display": "3.1.59",
|
|
78
|
+
"@arcblock/react-hooks": "3.1.59",
|
|
79
79
|
"@blocklet/js-sdk": "1.17.0-beta-20251104-112713-e947b159",
|
|
80
|
-
"@blocklet/theme": "3.1.
|
|
80
|
+
"@blocklet/theme": "3.1.59",
|
|
81
81
|
"@fontsource/roboto": "~5.1.1",
|
|
82
82
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
|
83
83
|
"@iconify-icons/logos": "^1.2.36",
|
package/src/CodeBlock/index.tsx
CHANGED
|
@@ -60,6 +60,7 @@ export interface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {
|
|
|
60
60
|
language?: string;
|
|
61
61
|
children?: React.ReactNode;
|
|
62
62
|
dark?: true | false;
|
|
63
|
+
showDefaultText?: true | false;
|
|
63
64
|
sx?: SxProps;
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -68,6 +69,7 @@ export default function CodeBlock({
|
|
|
68
69
|
language = 'text',
|
|
69
70
|
children = null,
|
|
70
71
|
dark = true,
|
|
72
|
+
showDefaultText = true,
|
|
71
73
|
...rest
|
|
72
74
|
}: CodeBlockProps) {
|
|
73
75
|
const [copied, setCopied] = useState(false);
|
|
@@ -94,7 +96,7 @@ export default function CodeBlock({
|
|
|
94
96
|
/>
|
|
95
97
|
</span>
|
|
96
98
|
<div className="copy-button" onClick={onCopy}>
|
|
97
|
-
<span className="default-text">{language}</span>
|
|
99
|
+
{showDefaultText && <span className="default-text">{language}</span>}
|
|
98
100
|
<span className="hover-text">
|
|
99
101
|
{!copied ? (
|
|
100
102
|
<>
|
|
@@ -142,7 +144,7 @@ const Pre = styled('pre', {
|
|
|
142
144
|
display: block;
|
|
143
145
|
width: 100%;
|
|
144
146
|
max-height: 46.25rem;
|
|
145
|
-
overflow:
|
|
147
|
+
overflow: auto;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
.copy-button {
|