xertica-ui 2.7.0 → 2.8.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/CHANGELOG.md +16 -0
- package/README.md +19 -11
- package/bin/generate-tokens.ts +25 -9
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +1 -1
- package/components/ui/button/button.test.tsx +2 -2
- package/components/ui/button/button.tsx +6 -6
- package/components/ui/card/card.tsx +14 -2
- package/components/ui/input/input.tsx +1 -1
- package/components/ui/input-otp/input-otp.tsx +1 -1
- package/components/ui/search/search.tsx +1 -1
- package/components/ui/select/select.tsx +2 -2
- package/components/ui/switch/switch.tsx +1 -1
- package/components/ui/textarea/textarea.tsx +1 -1
- package/contexts/BrandColorsContext.tsx +50 -2
- package/contexts/theme-data.ts +100 -3
- package/dist/AssistantChart-BFBJXVcm.js +3383 -0
- package/dist/AssistantChart-BTnE94FR.cjs +3551 -0
- package/dist/AssistantChart-BvccsQMx.cjs +3551 -0
- package/dist/AssistantChart-CkskcBVD.js +3383 -0
- package/dist/AssistantChart-CrPkO9ip.js +3383 -0
- package/dist/AssistantChart-DKz2O1R8.cjs +3551 -0
- package/dist/AssistantChart-DYL6UEvo.cjs +3551 -0
- package/dist/AssistantChart-keo-ogKi.js +3383 -0
- package/dist/AudioPlayer-AoU5MTiM.cjs +1282 -0
- package/dist/AudioPlayer-Bx1vrblm.js +1278 -0
- package/dist/AudioPlayer-D0-I6J3J.cjs +1282 -0
- package/dist/AudioPlayer-DIWX_Yg7.cjs +1282 -0
- package/dist/AudioPlayer-DrWJnS7c.js +1278 -0
- package/dist/AudioPlayer-_P-Z7pAK.js +1278 -0
- package/dist/BrandColorsContext-B25Bpr3b.cjs +819 -0
- package/dist/BrandColorsContext-BCieATdW.js +812 -0
- package/dist/BrandColorsContext-DP0DXAXS.js +824 -0
- package/dist/BrandColorsContext-DjpC9wR_.cjs +798 -0
- package/dist/BrandColorsContext-MpXFhte7.cjs +831 -0
- package/dist/BrandColorsContext-V3tOc-Zw.js +791 -0
- package/dist/CodeBlock-CK4rO6lM.js +221 -0
- package/dist/CodeBlock-CKXamfVd.cjs +223 -0
- package/dist/CodeBlock-CVmE7isS.cjs +223 -0
- package/dist/CodeBlock-D7i5-cMv.js +221 -0
- package/dist/CodeBlock-Dg56j2ut.cjs +223 -0
- package/dist/CodeBlock-Dt6nUQoo.js +221 -0
- package/dist/CustomTooltipContent-Bxynuq7T.js +33 -0
- package/dist/CustomTooltipContent-BzjOSA0P.cjs +54 -0
- package/dist/CustomTooltipContent-C-ZeCNsf.js +33 -0
- package/dist/CustomTooltipContent-CON_QrXm.cjs +54 -0
- package/dist/CustomTooltipContent-UR_n2QfW.js +33 -0
- package/dist/CustomTooltipContent-v1SXjoFn.cjs +54 -0
- package/dist/FeatureCard-4n_8a63v.cjs +497 -0
- package/dist/FeatureCard-BLiAWT3w.js +485 -0
- package/dist/FeatureCard-BXRW97Ef.cjs +497 -0
- package/dist/FeatureCard-CDgLlWE2.js +485 -0
- package/dist/FeatureCard-CgQ8lq-I.cjs +497 -0
- package/dist/FeatureCard-Cp8cVC6T.cjs +497 -0
- package/dist/FeatureCard-D0MwrTRP.js +485 -0
- package/dist/FeatureCard-uE5i0in_.js +485 -0
- package/dist/ImageWithFallback-BOh1FM3I.js +98 -0
- package/dist/ImageWithFallback-BQO7952C.js +98 -0
- package/dist/ImageWithFallback-BkMXHCvV.cjs +122 -0
- package/dist/ImageWithFallback-C72nwszA.cjs +122 -0
- package/dist/ImageWithFallback-CCUMDuEC.cjs +122 -0
- package/dist/ImageWithFallback-DQD5TTlY.js +98 -0
- package/dist/LanguageSelector-1XhM7R1i.cjs +48 -0
- package/dist/LanguageSelector-B3ZVNc55.js +46 -0
- package/dist/LanguageSelector-Cj6zl0CM.js +46 -0
- package/dist/LanguageSelector-DK1zD4VH.cjs +48 -0
- package/dist/LanguageSelector-DseCAa0p.cjs +48 -0
- package/dist/LanguageSelector-Du09anfM.js +46 -0
- package/dist/LanguageSelector-PZHlFfEs.cjs +48 -0
- package/dist/LanguageSelector-SB-NJSmx.js +46 -0
- package/dist/PasswordStrengthMeter-B3S6i_k4.cjs +179 -0
- package/dist/PasswordStrengthMeter-B8ky1nJI.js +173 -0
- package/dist/PasswordStrengthMeter-C5VEopH-.cjs +179 -0
- package/dist/PasswordStrengthMeter-CIm7_jNT.js +173 -0
- package/dist/PasswordStrengthMeter-DKSAbQzu.js +173 -0
- package/dist/PasswordStrengthMeter-DxLu54p-.cjs +179 -0
- package/dist/PasswordStrengthMeter-k-e9Pole.cjs +179 -0
- package/dist/PasswordStrengthMeter-pAi2viq5.js +173 -0
- package/dist/ThemeToggle-4pQbVkpK.js +215 -0
- package/dist/ThemeToggle-B6rIVLvC.cjs +219 -0
- package/dist/ThemeToggle-BUOTps5l.cjs +219 -0
- package/dist/ThemeToggle-CO5mPl6e.js +215 -0
- package/dist/ThemeToggle-DbZQ0JSV.cjs +219 -0
- package/dist/ThemeToggle-vLXEq2TS.js +215 -0
- package/dist/VerifyEmailPage-BTjI2c9n.js +2954 -0
- package/dist/VerifyEmailPage-CJGfDSOx.js +2954 -0
- package/dist/VerifyEmailPage-DOlZUNc0.cjs +2963 -0
- package/dist/VerifyEmailPage-DQPRl_RJ.js +2954 -0
- package/dist/VerifyEmailPage-DrdqMbLC.cjs +2963 -0
- package/dist/VerifyEmailPage-hyDfeCRa.cjs +2963 -0
- package/dist/VerifyEmailPage-kKSXl8vu.cjs +2963 -0
- package/dist/VerifyEmailPage-w4N-bDhU.js +2954 -0
- package/dist/XerticaOrbe-B9tegV1n.js +1925 -0
- package/dist/XerticaOrbe-BQ_NjwPS.cjs +1927 -0
- package/dist/XerticaOrbe-BdUX171Q.cjs +1927 -0
- package/dist/XerticaOrbe-BdlKXRHU.cjs +1927 -0
- package/dist/XerticaOrbe-CByPAFE5.js +1925 -0
- package/dist/XerticaOrbe-Ccu9eFMu.js +1925 -0
- package/dist/XerticaProvider-BVid1oqn.cjs +46 -0
- package/dist/XerticaProvider-Bz_YfNY4.js +44 -0
- package/dist/XerticaProvider-CtvYfRbZ.cjs +46 -0
- package/dist/XerticaProvider-DMiyExQS.js +44 -0
- package/dist/XerticaProvider-DP2lzKip.cjs +46 -0
- package/dist/XerticaProvider-De79hhgp.js +44 -0
- package/dist/XerticaProvider-Dkk1Vbsy.js +44 -0
- package/dist/XerticaProvider-EdzH9Nrw.cjs +46 -0
- package/dist/alert-dialog-9XYAn5z5.js +819 -0
- package/dist/alert-dialog-B281hud0.cjs +872 -0
- package/dist/alert-dialog-BVWbrcrw.cjs +872 -0
- package/dist/alert-dialog-B_Ko1xpu.js +819 -0
- package/dist/alert-dialog-CIxE8T-J.cjs +872 -0
- package/dist/alert-dialog-DW-_iPuf.js +819 -0
- package/dist/assistant.cjs.js +2 -2
- package/dist/assistant.es.js +2 -2
- package/dist/avatar-BJwIMbZ_.js +54 -0
- package/dist/avatar-C4Zh5fAJ.cjs +77 -0
- package/dist/avatar-CTEUKZUT.js +54 -0
- package/dist/avatar-D1bZhlhL.cjs +77 -0
- package/dist/avatar-DKIxHeKG.cjs +77 -0
- package/dist/avatar-v16eZC8p.js +54 -0
- package/dist/blocks.cjs.js +2 -2
- package/dist/blocks.es.js +2 -2
- package/dist/brand.cjs.js +4 -4
- package/dist/brand.es.js +4 -4
- package/dist/breadcrumb-B1mUiaWB.cjs +98 -0
- package/dist/breadcrumb-BIRgmem-.js +90 -0
- package/dist/breadcrumb-BSng-oUf.cjs +98 -0
- package/dist/breadcrumb-CES7furU.js +90 -0
- package/dist/breadcrumb-CP275kbF.cjs +98 -0
- package/dist/breadcrumb-D7hr1EvJ.js +90 -0
- package/dist/button-BYtQygX5.cjs +85 -0
- package/dist/button-BnAW-a_w.js +62 -0
- package/dist/button-CUPDQews.js +62 -0
- package/dist/button-DFa-rtPy.js +62 -0
- package/dist/button-DV1G6XrI.cjs +85 -0
- package/dist/button-Kd9Fj53S.cjs +85 -0
- package/dist/cli.js +94 -10
- package/dist/components/ui/card/card.d.ts +11 -1
- package/dist/contexts/theme-data.d.ts +15 -1
- package/dist/dropdown-menu-B9wTZ0uX.cjs +225 -0
- package/dist/dropdown-menu-BeBtZOrs.cjs +225 -0
- package/dist/dropdown-menu-D7mRDGis.js +190 -0
- package/dist/dropdown-menu-D8ZmqHB7.js +190 -0
- package/dist/dropdown-menu-_AWBeOts.cjs +225 -0
- package/dist/dropdown-menu-qGzLO_HO.js +190 -0
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +1 -1
- package/dist/index.cjs.js +24 -24
- package/dist/index.es.js +24 -24
- package/dist/input-B53E6K8G.js +65 -0
- package/dist/input-B7Q7vcoG.cjs +91 -0
- package/dist/input-BysqLMK1.js +65 -0
- package/dist/input-CStdFsaH.cjs +91 -0
- package/dist/input-CXYth6nW.cjs +91 -0
- package/dist/input-CX_fWE2D.cjs +91 -0
- package/dist/input-CitUVnEn.js +65 -0
- package/dist/input-wkBYTp-B.js +65 -0
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +1 -1
- package/dist/media.cjs.js +1 -1
- package/dist/media.es.js +1 -1
- package/dist/pages.cjs.js +1 -1
- package/dist/pages.es.js +1 -1
- package/dist/rich-text-editor-BHiRUzWZ.js +2894 -0
- package/dist/rich-text-editor-BWMRUMJ2.js +2894 -0
- package/dist/rich-text-editor-BoE6Ks5x.cjs +2968 -0
- package/dist/rich-text-editor-BzuEwR_X.js +2894 -0
- package/dist/rich-text-editor-CcopGbQ-.js +2894 -0
- package/dist/rich-text-editor-CmxSRJIi.cjs +2968 -0
- package/dist/rich-text-editor-DyYAu28v.cjs +2968 -0
- package/dist/rich-text-editor-JS_eMQCC.cjs +2968 -0
- package/dist/select-BNfFJwYp.js +130 -0
- package/dist/select-CN8IDjGB.js +130 -0
- package/dist/select-CwRzQHA7.cjs +161 -0
- package/dist/select-CwgD3nMD.js +130 -0
- package/dist/select-DEHUm_AC.cjs +161 -0
- package/dist/select-DJDgpVm3.cjs +161 -0
- package/dist/select-DSLWQLmo.cjs +161 -0
- package/dist/select-YFx0wCYT.js +130 -0
- package/dist/sidebar-BF7JEL7U.js +1151 -0
- package/dist/sidebar-Bjr2doX5.cjs +1154 -0
- package/dist/sidebar-CMrNCmhb.cjs +1154 -0
- package/dist/sidebar-CO9x8AVn.cjs +1154 -0
- package/dist/sidebar-Cn_KB4c6.js +1151 -0
- package/dist/sidebar-Db_C30ph.cjs +1154 -0
- package/dist/sidebar-miPHsRz4.js +1151 -0
- package/dist/sidebar-pZF8mLLu.js +1151 -0
- package/dist/skeleton-BX2XTjMO.cjs +87 -0
- package/dist/skeleton-BoLK0iV7.js +78 -0
- package/dist/skeleton-Bysq8yeB.js +79 -0
- package/dist/skeleton-C7nspYnC.cjs +87 -0
- package/dist/skeleton-DL4V5Vub.cjs +87 -0
- package/dist/skeleton-DSMhdqp1.js +78 -0
- package/dist/skeleton-DhJswvTW.cjs +88 -0
- package/dist/skeleton-DicUfozA.js +78 -0
- package/dist/slider-77T_Eqw4.js +56 -0
- package/dist/slider-B6puMLXS.cjs +78 -0
- package/dist/slider-B785N7lZ.js +56 -0
- package/dist/slider-C6yssKyZ.cjs +78 -0
- package/dist/slider-CKZO9gVh.cjs +78 -0
- package/dist/slider-Cn-ImSze.js +56 -0
- package/dist/tooltip-BiJVGob3.cjs +72 -0
- package/dist/tooltip-D2OPn-1v.cjs +72 -0
- package/dist/tooltip-DlCHQuh1.js +48 -0
- package/dist/tooltip-fQ2Va0G8.cjs +72 -0
- package/dist/tooltip-oAw00FX2.js +48 -0
- package/dist/tooltip-u147L0wD.js +48 -0
- package/dist/ui.cjs.js +13 -13
- package/dist/ui.es.js +13 -13
- package/dist/xertica-assistant-C2A0R94j.js +2173 -0
- package/dist/xertica-assistant-CSUprvTR.js +2173 -0
- package/dist/xertica-assistant-Caubm0HR.js +2173 -0
- package/dist/xertica-assistant-DEexPM2u.cjs +2180 -0
- package/dist/xertica-assistant-Dh1dmEx3.cjs +2180 -0
- package/dist/xertica-assistant-GGcyHEZG.cjs +2180 -0
- package/dist/xertica-assistant-USefPe2L.js +2173 -0
- package/dist/xertica-assistant-cwSHFwfv.cjs +2180 -0
- package/dist/xertica-ui.css +1 -1
- package/package.json +3 -2
- package/styles/xertica/base.css +38 -0
- package/styles/xertica/tokens.css +9 -0
- package/templates/src/app/App.tsx +5 -1
- package/templates/src/features/home/ui/HomeContent.tsx +12 -13
- package/templates/src/features/template/ui/TemplateContent.tsx +569 -26
- package/templates/src/locales/en/pages/templates.json +112 -4
- package/templates/src/locales/es/pages/templates.json +112 -4
- package/templates/src/locales/pt-BR/pages/templates.json +112 -4
- package/templates/src/styles/xertica/tokens.css +9 -0
- package/templates/vite.config.ts +25 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Check, Copy } from 'lucide-react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { B as Button } from './button-BnAW-a_w.js';
|
|
6
|
+
import { Prism } from 'react-syntax-highlighter';
|
|
7
|
+
|
|
8
|
+
const elegantTheme = {
|
|
9
|
+
'code[class*="language-"]': {
|
|
10
|
+
color: "var(--foreground)",
|
|
11
|
+
fontFamily: "var(--font-mono)",
|
|
12
|
+
fontSize: "0.875rem",
|
|
13
|
+
textAlign: "left",
|
|
14
|
+
whiteSpace: "pre",
|
|
15
|
+
wordSpacing: "normal",
|
|
16
|
+
wordBreak: "normal",
|
|
17
|
+
lineHeight: "1.6",
|
|
18
|
+
tabSize: 2,
|
|
19
|
+
hyphens: "none"
|
|
20
|
+
},
|
|
21
|
+
'pre[class*="language-"]': {
|
|
22
|
+
color: "var(--foreground)",
|
|
23
|
+
fontFamily: "var(--font-mono)",
|
|
24
|
+
fontSize: "0.875rem",
|
|
25
|
+
textAlign: "left",
|
|
26
|
+
whiteSpace: "pre",
|
|
27
|
+
wordSpacing: "normal",
|
|
28
|
+
wordBreak: "normal",
|
|
29
|
+
lineHeight: "1.6",
|
|
30
|
+
tabSize: 2,
|
|
31
|
+
hyphens: "none",
|
|
32
|
+
padding: "1rem",
|
|
33
|
+
margin: 0,
|
|
34
|
+
overflow: "auto",
|
|
35
|
+
background: "transparent"
|
|
36
|
+
},
|
|
37
|
+
comment: {
|
|
38
|
+
color: "var(--muted-foreground)",
|
|
39
|
+
fontStyle: "italic"
|
|
40
|
+
},
|
|
41
|
+
prolog: {
|
|
42
|
+
color: "var(--muted-foreground)"
|
|
43
|
+
},
|
|
44
|
+
doctype: {
|
|
45
|
+
color: "var(--muted-foreground)"
|
|
46
|
+
},
|
|
47
|
+
cdata: {
|
|
48
|
+
color: "var(--muted-foreground)"
|
|
49
|
+
},
|
|
50
|
+
punctuation: {
|
|
51
|
+
color: "var(--muted-foreground)"
|
|
52
|
+
},
|
|
53
|
+
property: {
|
|
54
|
+
color: "var(--chart-4)"
|
|
55
|
+
},
|
|
56
|
+
tag: {
|
|
57
|
+
color: "var(--chart-1)"
|
|
58
|
+
},
|
|
59
|
+
boolean: {
|
|
60
|
+
color: "var(--chart-5)"
|
|
61
|
+
},
|
|
62
|
+
number: {
|
|
63
|
+
color: "var(--chart-5)"
|
|
64
|
+
},
|
|
65
|
+
constant: {
|
|
66
|
+
color: "var(--chart-5)"
|
|
67
|
+
},
|
|
68
|
+
symbol: {
|
|
69
|
+
color: "var(--chart-5)"
|
|
70
|
+
},
|
|
71
|
+
deleted: {
|
|
72
|
+
color: "var(--chart-5)"
|
|
73
|
+
},
|
|
74
|
+
selector: {
|
|
75
|
+
color: "var(--chart-2)"
|
|
76
|
+
},
|
|
77
|
+
"attr-name": {
|
|
78
|
+
color: "var(--chart-4)"
|
|
79
|
+
},
|
|
80
|
+
string: {
|
|
81
|
+
color: "var(--chart-2)"
|
|
82
|
+
},
|
|
83
|
+
char: {
|
|
84
|
+
color: "var(--chart-2)"
|
|
85
|
+
},
|
|
86
|
+
builtin: {
|
|
87
|
+
color: "var(--chart-4)"
|
|
88
|
+
},
|
|
89
|
+
inserted: {
|
|
90
|
+
color: "var(--chart-2)"
|
|
91
|
+
},
|
|
92
|
+
operator: {
|
|
93
|
+
color: "var(--primary)"
|
|
94
|
+
},
|
|
95
|
+
entity: {
|
|
96
|
+
color: "var(--chart-4)"
|
|
97
|
+
},
|
|
98
|
+
url: {
|
|
99
|
+
color: "var(--chart-1)"
|
|
100
|
+
},
|
|
101
|
+
".language-css .token.string": {
|
|
102
|
+
color: "var(--chart-2)"
|
|
103
|
+
},
|
|
104
|
+
".style .token.string": {
|
|
105
|
+
color: "var(--chart-2)"
|
|
106
|
+
},
|
|
107
|
+
atrule: {
|
|
108
|
+
color: "var(--chart-3)"
|
|
109
|
+
},
|
|
110
|
+
"attr-value": {
|
|
111
|
+
color: "var(--chart-2)"
|
|
112
|
+
},
|
|
113
|
+
keyword: {
|
|
114
|
+
color: "var(--chart-3)"
|
|
115
|
+
},
|
|
116
|
+
function: {
|
|
117
|
+
color: "var(--chart-1)"
|
|
118
|
+
},
|
|
119
|
+
"class-name": {
|
|
120
|
+
color: "var(--chart-4)"
|
|
121
|
+
},
|
|
122
|
+
regex: {
|
|
123
|
+
color: "var(--chart-5)"
|
|
124
|
+
},
|
|
125
|
+
important: {
|
|
126
|
+
color: "var(--chart-5)",
|
|
127
|
+
fontWeight: "bold"
|
|
128
|
+
},
|
|
129
|
+
variable: {
|
|
130
|
+
color: "var(--chart-5)"
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const CodeBlock = ({
|
|
134
|
+
code,
|
|
135
|
+
language = "tsx",
|
|
136
|
+
filename,
|
|
137
|
+
showLineNumbers = false
|
|
138
|
+
}) => {
|
|
139
|
+
const [copied, setCopied] = useState(false);
|
|
140
|
+
const { t } = useTranslation();
|
|
141
|
+
const handleCopy = async () => {
|
|
142
|
+
try {
|
|
143
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
144
|
+
try {
|
|
145
|
+
await navigator.clipboard.writeText(code);
|
|
146
|
+
} catch (clipboardError) {
|
|
147
|
+
if (clipboardError instanceof Error && (clipboardError.name === "NotAllowedError" || clipboardError.message.includes("permissions policy"))) {
|
|
148
|
+
throw new Error("Clipboard permission denied, falling back");
|
|
149
|
+
}
|
|
150
|
+
throw clipboardError;
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
throw new Error("Clipboard API not available");
|
|
154
|
+
}
|
|
155
|
+
setCopied(true);
|
|
156
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
157
|
+
} catch {
|
|
158
|
+
try {
|
|
159
|
+
const textArea = document.createElement("textarea");
|
|
160
|
+
textArea.value = code;
|
|
161
|
+
textArea.style.position = "fixed";
|
|
162
|
+
textArea.style.left = "-999999px";
|
|
163
|
+
textArea.style.top = "-999999px";
|
|
164
|
+
document.body.appendChild(textArea);
|
|
165
|
+
textArea.focus();
|
|
166
|
+
textArea.select();
|
|
167
|
+
const successful = document.execCommand("copy");
|
|
168
|
+
document.body.removeChild(textArea);
|
|
169
|
+
if (successful) {
|
|
170
|
+
setCopied(true);
|
|
171
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
172
|
+
} else {
|
|
173
|
+
console.error("Failed to copy text: execCommand returned false");
|
|
174
|
+
}
|
|
175
|
+
} catch (fallbackErr) {
|
|
176
|
+
console.error("All copy methods failed:", fallbackErr);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const codeString = typeof code === "string" ? code : String(code || "");
|
|
181
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative group rounded-[var(--radius)] border border-border overflow-hidden bg-muted/30", children: [
|
|
182
|
+
filename && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2 bg-muted border-b border-border", children: [
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground font-mono", children: filename }),
|
|
184
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground uppercase", children: language })
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
Button,
|
|
189
|
+
{
|
|
190
|
+
variant: "ghost",
|
|
191
|
+
size: "icon",
|
|
192
|
+
className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity z-10 bg-background/80 hover:bg-background",
|
|
193
|
+
onClick: handleCopy,
|
|
194
|
+
"aria-label": copied ? t("common.copied") : t("common.copyCode"),
|
|
195
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { className: "w-4 h-4 text-[var(--toast-success-icon)]", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(Copy, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto w-full max-w-full", children: /* @__PURE__ */ jsx(
|
|
199
|
+
Prism,
|
|
200
|
+
{
|
|
201
|
+
language,
|
|
202
|
+
style: elegantTheme,
|
|
203
|
+
showLineNumbers,
|
|
204
|
+
wrapLines: true,
|
|
205
|
+
customStyle: {
|
|
206
|
+
margin: 0,
|
|
207
|
+
padding: "1rem",
|
|
208
|
+
background: "transparent",
|
|
209
|
+
fontSize: "inherit"
|
|
210
|
+
},
|
|
211
|
+
codeTagProps: {
|
|
212
|
+
className: "text-[length:inherit]"
|
|
213
|
+
},
|
|
214
|
+
children: codeString
|
|
215
|
+
}
|
|
216
|
+
) })
|
|
217
|
+
] })
|
|
218
|
+
] });
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export { CodeBlock as C };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
const React = require('react');
|
|
5
|
+
const lucideReact = require('lucide-react');
|
|
6
|
+
const reactI18next = require('react-i18next');
|
|
7
|
+
const button = require('./button-BYtQygX5.cjs');
|
|
8
|
+
const reactSyntaxHighlighter = require('react-syntax-highlighter');
|
|
9
|
+
|
|
10
|
+
const elegantTheme = {
|
|
11
|
+
'code[class*="language-"]': {
|
|
12
|
+
color: "var(--foreground)",
|
|
13
|
+
fontFamily: "var(--font-mono)",
|
|
14
|
+
fontSize: "0.875rem",
|
|
15
|
+
textAlign: "left",
|
|
16
|
+
whiteSpace: "pre",
|
|
17
|
+
wordSpacing: "normal",
|
|
18
|
+
wordBreak: "normal",
|
|
19
|
+
lineHeight: "1.6",
|
|
20
|
+
tabSize: 2,
|
|
21
|
+
hyphens: "none"
|
|
22
|
+
},
|
|
23
|
+
'pre[class*="language-"]': {
|
|
24
|
+
color: "var(--foreground)",
|
|
25
|
+
fontFamily: "var(--font-mono)",
|
|
26
|
+
fontSize: "0.875rem",
|
|
27
|
+
textAlign: "left",
|
|
28
|
+
whiteSpace: "pre",
|
|
29
|
+
wordSpacing: "normal",
|
|
30
|
+
wordBreak: "normal",
|
|
31
|
+
lineHeight: "1.6",
|
|
32
|
+
tabSize: 2,
|
|
33
|
+
hyphens: "none",
|
|
34
|
+
padding: "1rem",
|
|
35
|
+
margin: 0,
|
|
36
|
+
overflow: "auto",
|
|
37
|
+
background: "transparent"
|
|
38
|
+
},
|
|
39
|
+
comment: {
|
|
40
|
+
color: "var(--muted-foreground)",
|
|
41
|
+
fontStyle: "italic"
|
|
42
|
+
},
|
|
43
|
+
prolog: {
|
|
44
|
+
color: "var(--muted-foreground)"
|
|
45
|
+
},
|
|
46
|
+
doctype: {
|
|
47
|
+
color: "var(--muted-foreground)"
|
|
48
|
+
},
|
|
49
|
+
cdata: {
|
|
50
|
+
color: "var(--muted-foreground)"
|
|
51
|
+
},
|
|
52
|
+
punctuation: {
|
|
53
|
+
color: "var(--muted-foreground)"
|
|
54
|
+
},
|
|
55
|
+
property: {
|
|
56
|
+
color: "var(--chart-4)"
|
|
57
|
+
},
|
|
58
|
+
tag: {
|
|
59
|
+
color: "var(--chart-1)"
|
|
60
|
+
},
|
|
61
|
+
boolean: {
|
|
62
|
+
color: "var(--chart-5)"
|
|
63
|
+
},
|
|
64
|
+
number: {
|
|
65
|
+
color: "var(--chart-5)"
|
|
66
|
+
},
|
|
67
|
+
constant: {
|
|
68
|
+
color: "var(--chart-5)"
|
|
69
|
+
},
|
|
70
|
+
symbol: {
|
|
71
|
+
color: "var(--chart-5)"
|
|
72
|
+
},
|
|
73
|
+
deleted: {
|
|
74
|
+
color: "var(--chart-5)"
|
|
75
|
+
},
|
|
76
|
+
selector: {
|
|
77
|
+
color: "var(--chart-2)"
|
|
78
|
+
},
|
|
79
|
+
"attr-name": {
|
|
80
|
+
color: "var(--chart-4)"
|
|
81
|
+
},
|
|
82
|
+
string: {
|
|
83
|
+
color: "var(--chart-2)"
|
|
84
|
+
},
|
|
85
|
+
char: {
|
|
86
|
+
color: "var(--chart-2)"
|
|
87
|
+
},
|
|
88
|
+
builtin: {
|
|
89
|
+
color: "var(--chart-4)"
|
|
90
|
+
},
|
|
91
|
+
inserted: {
|
|
92
|
+
color: "var(--chart-2)"
|
|
93
|
+
},
|
|
94
|
+
operator: {
|
|
95
|
+
color: "var(--primary)"
|
|
96
|
+
},
|
|
97
|
+
entity: {
|
|
98
|
+
color: "var(--chart-4)"
|
|
99
|
+
},
|
|
100
|
+
url: {
|
|
101
|
+
color: "var(--chart-1)"
|
|
102
|
+
},
|
|
103
|
+
".language-css .token.string": {
|
|
104
|
+
color: "var(--chart-2)"
|
|
105
|
+
},
|
|
106
|
+
".style .token.string": {
|
|
107
|
+
color: "var(--chart-2)"
|
|
108
|
+
},
|
|
109
|
+
atrule: {
|
|
110
|
+
color: "var(--chart-3)"
|
|
111
|
+
},
|
|
112
|
+
"attr-value": {
|
|
113
|
+
color: "var(--chart-2)"
|
|
114
|
+
},
|
|
115
|
+
keyword: {
|
|
116
|
+
color: "var(--chart-3)"
|
|
117
|
+
},
|
|
118
|
+
function: {
|
|
119
|
+
color: "var(--chart-1)"
|
|
120
|
+
},
|
|
121
|
+
"class-name": {
|
|
122
|
+
color: "var(--chart-4)"
|
|
123
|
+
},
|
|
124
|
+
regex: {
|
|
125
|
+
color: "var(--chart-5)"
|
|
126
|
+
},
|
|
127
|
+
important: {
|
|
128
|
+
color: "var(--chart-5)",
|
|
129
|
+
fontWeight: "bold"
|
|
130
|
+
},
|
|
131
|
+
variable: {
|
|
132
|
+
color: "var(--chart-5)"
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const CodeBlock = ({
|
|
136
|
+
code,
|
|
137
|
+
language = "tsx",
|
|
138
|
+
filename,
|
|
139
|
+
showLineNumbers = false
|
|
140
|
+
}) => {
|
|
141
|
+
const [copied, setCopied] = React.useState(false);
|
|
142
|
+
const { t } = reactI18next.useTranslation();
|
|
143
|
+
const handleCopy = async () => {
|
|
144
|
+
try {
|
|
145
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
146
|
+
try {
|
|
147
|
+
await navigator.clipboard.writeText(code);
|
|
148
|
+
} catch (clipboardError) {
|
|
149
|
+
if (clipboardError instanceof Error && (clipboardError.name === "NotAllowedError" || clipboardError.message.includes("permissions policy"))) {
|
|
150
|
+
throw new Error("Clipboard permission denied, falling back");
|
|
151
|
+
}
|
|
152
|
+
throw clipboardError;
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
throw new Error("Clipboard API not available");
|
|
156
|
+
}
|
|
157
|
+
setCopied(true);
|
|
158
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
159
|
+
} catch {
|
|
160
|
+
try {
|
|
161
|
+
const textArea = document.createElement("textarea");
|
|
162
|
+
textArea.value = code;
|
|
163
|
+
textArea.style.position = "fixed";
|
|
164
|
+
textArea.style.left = "-999999px";
|
|
165
|
+
textArea.style.top = "-999999px";
|
|
166
|
+
document.body.appendChild(textArea);
|
|
167
|
+
textArea.focus();
|
|
168
|
+
textArea.select();
|
|
169
|
+
const successful = document.execCommand("copy");
|
|
170
|
+
document.body.removeChild(textArea);
|
|
171
|
+
if (successful) {
|
|
172
|
+
setCopied(true);
|
|
173
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
174
|
+
} else {
|
|
175
|
+
console.error("Failed to copy text: execCommand returned false");
|
|
176
|
+
}
|
|
177
|
+
} catch (fallbackErr) {
|
|
178
|
+
console.error("All copy methods failed:", fallbackErr);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const codeString = typeof code === "string" ? code : String(code || "");
|
|
183
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative group rounded-[var(--radius)] border border-border overflow-hidden bg-muted/30", children: [
|
|
184
|
+
filename && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2 bg-muted border-b border-border", children: [
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground font-mono", children: filename }),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground uppercase", children: language })
|
|
187
|
+
] }),
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
+
button.Button,
|
|
191
|
+
{
|
|
192
|
+
variant: "ghost",
|
|
193
|
+
size: "icon",
|
|
194
|
+
className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity z-10 bg-background/80 hover:bg-background",
|
|
195
|
+
onClick: handleCopy,
|
|
196
|
+
"aria-label": copied ? t("common.copied") : t("common.copyCode"),
|
|
197
|
+
children: copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-4 h-4 text-[var(--toast-success-icon)]", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto w-full max-w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
reactSyntaxHighlighter.Prism,
|
|
202
|
+
{
|
|
203
|
+
language,
|
|
204
|
+
style: elegantTheme,
|
|
205
|
+
showLineNumbers,
|
|
206
|
+
wrapLines: true,
|
|
207
|
+
customStyle: {
|
|
208
|
+
margin: 0,
|
|
209
|
+
padding: "1rem",
|
|
210
|
+
background: "transparent",
|
|
211
|
+
fontSize: "inherit"
|
|
212
|
+
},
|
|
213
|
+
codeTagProps: {
|
|
214
|
+
className: "text-[length:inherit]"
|
|
215
|
+
},
|
|
216
|
+
children: codeString
|
|
217
|
+
}
|
|
218
|
+
) })
|
|
219
|
+
] })
|
|
220
|
+
] });
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
exports.CodeBlock = CodeBlock;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
const React = require('react');
|
|
5
|
+
const lucideReact = require('lucide-react');
|
|
6
|
+
const reactI18next = require('react-i18next');
|
|
7
|
+
const button = require('./button-DV1G6XrI.cjs');
|
|
8
|
+
const reactSyntaxHighlighter = require('react-syntax-highlighter');
|
|
9
|
+
|
|
10
|
+
const elegantTheme = {
|
|
11
|
+
'code[class*="language-"]': {
|
|
12
|
+
color: "var(--foreground)",
|
|
13
|
+
fontFamily: "var(--font-mono)",
|
|
14
|
+
fontSize: "0.875rem",
|
|
15
|
+
textAlign: "left",
|
|
16
|
+
whiteSpace: "pre",
|
|
17
|
+
wordSpacing: "normal",
|
|
18
|
+
wordBreak: "normal",
|
|
19
|
+
lineHeight: "1.6",
|
|
20
|
+
tabSize: 2,
|
|
21
|
+
hyphens: "none"
|
|
22
|
+
},
|
|
23
|
+
'pre[class*="language-"]': {
|
|
24
|
+
color: "var(--foreground)",
|
|
25
|
+
fontFamily: "var(--font-mono)",
|
|
26
|
+
fontSize: "0.875rem",
|
|
27
|
+
textAlign: "left",
|
|
28
|
+
whiteSpace: "pre",
|
|
29
|
+
wordSpacing: "normal",
|
|
30
|
+
wordBreak: "normal",
|
|
31
|
+
lineHeight: "1.6",
|
|
32
|
+
tabSize: 2,
|
|
33
|
+
hyphens: "none",
|
|
34
|
+
padding: "1rem",
|
|
35
|
+
margin: 0,
|
|
36
|
+
overflow: "auto",
|
|
37
|
+
background: "transparent"
|
|
38
|
+
},
|
|
39
|
+
comment: {
|
|
40
|
+
color: "var(--muted-foreground)",
|
|
41
|
+
fontStyle: "italic"
|
|
42
|
+
},
|
|
43
|
+
prolog: {
|
|
44
|
+
color: "var(--muted-foreground)"
|
|
45
|
+
},
|
|
46
|
+
doctype: {
|
|
47
|
+
color: "var(--muted-foreground)"
|
|
48
|
+
},
|
|
49
|
+
cdata: {
|
|
50
|
+
color: "var(--muted-foreground)"
|
|
51
|
+
},
|
|
52
|
+
punctuation: {
|
|
53
|
+
color: "var(--muted-foreground)"
|
|
54
|
+
},
|
|
55
|
+
property: {
|
|
56
|
+
color: "var(--chart-4)"
|
|
57
|
+
},
|
|
58
|
+
tag: {
|
|
59
|
+
color: "var(--chart-1)"
|
|
60
|
+
},
|
|
61
|
+
boolean: {
|
|
62
|
+
color: "var(--chart-5)"
|
|
63
|
+
},
|
|
64
|
+
number: {
|
|
65
|
+
color: "var(--chart-5)"
|
|
66
|
+
},
|
|
67
|
+
constant: {
|
|
68
|
+
color: "var(--chart-5)"
|
|
69
|
+
},
|
|
70
|
+
symbol: {
|
|
71
|
+
color: "var(--chart-5)"
|
|
72
|
+
},
|
|
73
|
+
deleted: {
|
|
74
|
+
color: "var(--chart-5)"
|
|
75
|
+
},
|
|
76
|
+
selector: {
|
|
77
|
+
color: "var(--chart-2)"
|
|
78
|
+
},
|
|
79
|
+
"attr-name": {
|
|
80
|
+
color: "var(--chart-4)"
|
|
81
|
+
},
|
|
82
|
+
string: {
|
|
83
|
+
color: "var(--chart-2)"
|
|
84
|
+
},
|
|
85
|
+
char: {
|
|
86
|
+
color: "var(--chart-2)"
|
|
87
|
+
},
|
|
88
|
+
builtin: {
|
|
89
|
+
color: "var(--chart-4)"
|
|
90
|
+
},
|
|
91
|
+
inserted: {
|
|
92
|
+
color: "var(--chart-2)"
|
|
93
|
+
},
|
|
94
|
+
operator: {
|
|
95
|
+
color: "var(--primary)"
|
|
96
|
+
},
|
|
97
|
+
entity: {
|
|
98
|
+
color: "var(--chart-4)"
|
|
99
|
+
},
|
|
100
|
+
url: {
|
|
101
|
+
color: "var(--chart-1)"
|
|
102
|
+
},
|
|
103
|
+
".language-css .token.string": {
|
|
104
|
+
color: "var(--chart-2)"
|
|
105
|
+
},
|
|
106
|
+
".style .token.string": {
|
|
107
|
+
color: "var(--chart-2)"
|
|
108
|
+
},
|
|
109
|
+
atrule: {
|
|
110
|
+
color: "var(--chart-3)"
|
|
111
|
+
},
|
|
112
|
+
"attr-value": {
|
|
113
|
+
color: "var(--chart-2)"
|
|
114
|
+
},
|
|
115
|
+
keyword: {
|
|
116
|
+
color: "var(--chart-3)"
|
|
117
|
+
},
|
|
118
|
+
function: {
|
|
119
|
+
color: "var(--chart-1)"
|
|
120
|
+
},
|
|
121
|
+
"class-name": {
|
|
122
|
+
color: "var(--chart-4)"
|
|
123
|
+
},
|
|
124
|
+
regex: {
|
|
125
|
+
color: "var(--chart-5)"
|
|
126
|
+
},
|
|
127
|
+
important: {
|
|
128
|
+
color: "var(--chart-5)",
|
|
129
|
+
fontWeight: "bold"
|
|
130
|
+
},
|
|
131
|
+
variable: {
|
|
132
|
+
color: "var(--chart-5)"
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const CodeBlock = ({
|
|
136
|
+
code,
|
|
137
|
+
language = "tsx",
|
|
138
|
+
filename,
|
|
139
|
+
showLineNumbers = false
|
|
140
|
+
}) => {
|
|
141
|
+
const [copied, setCopied] = React.useState(false);
|
|
142
|
+
const { t } = reactI18next.useTranslation();
|
|
143
|
+
const handleCopy = async () => {
|
|
144
|
+
try {
|
|
145
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
146
|
+
try {
|
|
147
|
+
await navigator.clipboard.writeText(code);
|
|
148
|
+
} catch (clipboardError) {
|
|
149
|
+
if (clipboardError instanceof Error && (clipboardError.name === "NotAllowedError" || clipboardError.message.includes("permissions policy"))) {
|
|
150
|
+
throw new Error("Clipboard permission denied, falling back");
|
|
151
|
+
}
|
|
152
|
+
throw clipboardError;
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
throw new Error("Clipboard API not available");
|
|
156
|
+
}
|
|
157
|
+
setCopied(true);
|
|
158
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
159
|
+
} catch {
|
|
160
|
+
try {
|
|
161
|
+
const textArea = document.createElement("textarea");
|
|
162
|
+
textArea.value = code;
|
|
163
|
+
textArea.style.position = "fixed";
|
|
164
|
+
textArea.style.left = "-999999px";
|
|
165
|
+
textArea.style.top = "-999999px";
|
|
166
|
+
document.body.appendChild(textArea);
|
|
167
|
+
textArea.focus();
|
|
168
|
+
textArea.select();
|
|
169
|
+
const successful = document.execCommand("copy");
|
|
170
|
+
document.body.removeChild(textArea);
|
|
171
|
+
if (successful) {
|
|
172
|
+
setCopied(true);
|
|
173
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
174
|
+
} else {
|
|
175
|
+
console.error("Failed to copy text: execCommand returned false");
|
|
176
|
+
}
|
|
177
|
+
} catch (fallbackErr) {
|
|
178
|
+
console.error("All copy methods failed:", fallbackErr);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const codeString = typeof code === "string" ? code : String(code || "");
|
|
183
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative group rounded-[var(--radius)] border border-border overflow-hidden bg-muted/30", children: [
|
|
184
|
+
filename && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2 bg-muted border-b border-border", children: [
|
|
185
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground font-mono", children: filename }),
|
|
186
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground uppercase", children: language })
|
|
187
|
+
] }),
|
|
188
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
+
button.Button,
|
|
191
|
+
{
|
|
192
|
+
variant: "ghost",
|
|
193
|
+
size: "icon",
|
|
194
|
+
className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity z-10 bg-background/80 hover:bg-background",
|
|
195
|
+
onClick: handleCopy,
|
|
196
|
+
"aria-label": copied ? t("common.copied") : t("common.copyCode"),
|
|
197
|
+
children: copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-4 h-4 text-[var(--toast-success-icon)]", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto w-full max-w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
reactSyntaxHighlighter.Prism,
|
|
202
|
+
{
|
|
203
|
+
language,
|
|
204
|
+
style: elegantTheme,
|
|
205
|
+
showLineNumbers,
|
|
206
|
+
wrapLines: true,
|
|
207
|
+
customStyle: {
|
|
208
|
+
margin: 0,
|
|
209
|
+
padding: "1rem",
|
|
210
|
+
background: "transparent",
|
|
211
|
+
fontSize: "inherit"
|
|
212
|
+
},
|
|
213
|
+
codeTagProps: {
|
|
214
|
+
className: "text-[length:inherit]"
|
|
215
|
+
},
|
|
216
|
+
children: codeString
|
|
217
|
+
}
|
|
218
|
+
) })
|
|
219
|
+
] })
|
|
220
|
+
] });
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
exports.CodeBlock = CodeBlock;
|