@intlayer/design-system 3.5.4 → 3.5.5

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 (224) hide show
  1. package/dist/.vite/manifest.json +112 -45
  2. package/dist/CopyButton-Cxu3goRg.cjs +59 -0
  3. package/dist/CopyButton-Cxu3goRg.cjs.map +1 -0
  4. package/dist/CopyButton-DlcDlf6U.js +60 -0
  5. package/dist/CopyButton-DlcDlf6U.js.map +1 -0
  6. package/dist/components/Auth/SignUpForm/signUpForm.content.d.ts +11 -11
  7. package/dist/components/Auth/useAuth/useSession.cjs +1 -0
  8. package/dist/components/Auth/useAuth/useSession.cjs.map +1 -1
  9. package/dist/components/Auth/useAuth/useSession.mjs +1 -0
  10. package/dist/components/Auth/useAuth/useSession.mjs.map +1 -1
  11. package/dist/components/Breadcrumb/breadcrumb.content.cjs +26 -0
  12. package/dist/components/Breadcrumb/breadcrumb.content.cjs.map +1 -0
  13. package/dist/components/Breadcrumb/breadcrumb.content.d.ts +8 -0
  14. package/dist/components/Breadcrumb/breadcrumb.content.d.ts.map +1 -0
  15. package/dist/components/Breadcrumb/breadcrumb.content.mjs +26 -0
  16. package/dist/components/Breadcrumb/breadcrumb.content.mjs.map +1 -0
  17. package/dist/components/Breadcrumb/index.cjs +103 -34
  18. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  19. package/dist/components/Breadcrumb/index.d.ts +6 -2
  20. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  21. package/dist/components/Breadcrumb/index.mjs +103 -34
  22. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  23. package/dist/components/Button/Button.cjs +7 -8
  24. package/dist/components/Button/Button.cjs.map +1 -1
  25. package/dist/components/Button/Button.d.ts.map +1 -1
  26. package/dist/components/Button/Button.mjs +7 -8
  27. package/dist/components/Button/Button.mjs.map +1 -1
  28. package/dist/components/Container/index.cjs +2 -2
  29. package/dist/components/Container/index.cjs.map +1 -1
  30. package/dist/components/Container/index.mjs +2 -2
  31. package/dist/components/Container/index.mjs.map +1 -1
  32. package/dist/components/DictionaryEditor/index.cjs +4 -0
  33. package/dist/components/DictionaryEditor/index.cjs.map +1 -1
  34. package/dist/components/DictionaryEditor/index.mjs +4 -0
  35. package/dist/components/DictionaryEditor/index.mjs.map +1 -1
  36. package/dist/components/DictionaryEditor/useEditedContentStore.cjs +3 -0
  37. package/dist/components/DictionaryEditor/useEditedContentStore.cjs.map +1 -1
  38. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts +2 -2
  39. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts.map +1 -1
  40. package/dist/components/DictionaryEditor/useEditedContentStore.mjs +3 -0
  41. package/dist/components/DictionaryEditor/useEditedContentStore.mjs.map +1 -1
  42. package/dist/components/DictionaryEditor/useEditionPanelStore.cjs.map +1 -1
  43. package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts +1 -1
  44. package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts.map +1 -1
  45. package/dist/components/DictionaryEditor/useEditionPanelStore.mjs.map +1 -1
  46. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +7 -5
  47. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  48. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +1 -0
  49. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  50. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +7 -5
  51. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  52. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +6 -3
  53. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  54. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +1 -0
  55. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  56. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +6 -3
  57. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  58. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +20 -18
  59. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
  60. package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts +1 -0
  61. package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
  62. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +20 -18
  63. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
  64. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.cjs +10 -2
  65. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.cjs.map +1 -1
  66. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts +2 -0
  67. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts.map +1 -1
  68. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs +10 -2
  69. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs.map +1 -1
  70. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +10 -14
  71. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
  72. package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
  73. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +10 -14
  74. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
  75. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +60 -17
  76. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  77. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  78. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +63 -20
  79. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  80. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +32 -0
  81. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  82. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +4 -0
  83. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  84. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -0
  85. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  86. package/dist/components/DropDown/index.cjs.map +1 -1
  87. package/dist/components/DropDown/index.d.ts +18 -1
  88. package/dist/components/DropDown/index.d.ts.map +1 -1
  89. package/dist/components/DropDown/index.mjs.map +1 -1
  90. package/dist/components/Headers/index.cjs +1 -1
  91. package/dist/components/Headers/index.cjs.map +1 -1
  92. package/dist/components/Headers/index.mjs +1 -1
  93. package/dist/components/Headers/index.mjs.map +1 -1
  94. package/dist/components/IDE/CodeRender copy.cjs +141 -0
  95. package/dist/components/IDE/CodeRender copy.cjs.map +1 -0
  96. package/dist/components/IDE/CodeRender copy.d.ts +14 -0
  97. package/dist/components/IDE/CodeRender copy.d.ts.map +1 -0
  98. package/dist/components/IDE/CodeRender copy.mjs +141 -0
  99. package/dist/components/IDE/CodeRender copy.mjs.map +1 -0
  100. package/dist/components/IDE/CodeRender.cjs +39 -625
  101. package/dist/components/IDE/CodeRender.cjs.map +1 -1
  102. package/dist/components/IDE/CodeRender.d.ts +4 -5
  103. package/dist/components/IDE/CodeRender.d.ts.map +1 -1
  104. package/dist/components/IDE/CodeRender.mjs +40 -604
  105. package/dist/components/IDE/CodeRender.mjs.map +1 -1
  106. package/dist/components/IDE/CopyButton.cjs +40 -0
  107. package/dist/components/IDE/CopyButton.cjs.map +1 -0
  108. package/dist/components/IDE/CopyButton.content.cjs +26 -0
  109. package/dist/components/IDE/CopyButton.content.cjs.map +1 -0
  110. package/dist/components/IDE/CopyButton.content.d.ts +8 -0
  111. package/dist/components/IDE/CopyButton.content.d.ts.map +1 -0
  112. package/dist/components/IDE/CopyButton.content.mjs +26 -0
  113. package/dist/components/IDE/CopyButton.content.mjs.map +1 -0
  114. package/dist/components/IDE/CopyButton.d.ts +7 -0
  115. package/dist/components/IDE/CopyButton.d.ts.map +1 -0
  116. package/dist/components/IDE/CopyButton.mjs +40 -0
  117. package/dist/components/IDE/CopyButton.mjs.map +1 -0
  118. package/dist/components/IDE/IDE.cjs +1 -1
  119. package/dist/components/IDE/IDE.cjs.map +1 -1
  120. package/dist/components/IDE/IDE.mjs +1 -1
  121. package/dist/components/IDE/IDE.mjs.map +1 -1
  122. package/dist/components/IDE/MarkDownRender.cjs +10 -2
  123. package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
  124. package/dist/components/IDE/MarkDownRender.d.ts.map +1 -1
  125. package/dist/components/IDE/MarkDownRender.mjs +10 -2
  126. package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
  127. package/dist/components/IDE/MonacoCode.cjs +129 -0
  128. package/dist/components/IDE/MonacoCode.cjs.map +1 -0
  129. package/dist/components/IDE/MonacoCode.d.ts +14 -0
  130. package/dist/components/IDE/MonacoCode.d.ts.map +1 -0
  131. package/dist/components/IDE/MonacoCode.mjs +129 -0
  132. package/dist/components/IDE/MonacoCode.mjs.map +1 -0
  133. package/dist/components/Link/Link.cjs +50 -31
  134. package/dist/components/Link/Link.cjs.map +1 -1
  135. package/dist/components/Link/Link.d.ts +3 -0
  136. package/dist/components/Link/Link.d.ts.map +1 -1
  137. package/dist/components/Link/Link.mjs +51 -32
  138. package/dist/components/Link/Link.mjs.map +1 -1
  139. package/dist/components/Link/index.cjs +1 -0
  140. package/dist/components/Link/index.cjs.map +1 -1
  141. package/dist/components/Link/index.mjs +3 -2
  142. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs +118 -34
  143. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
  144. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts +2 -0
  145. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts.map +1 -1
  146. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +119 -35
  147. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
  148. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs +63 -1
  149. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs.map +1 -1
  150. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +6 -0
  151. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts.map +1 -1
  152. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs +63 -1
  153. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs.map +1 -1
  154. package/dist/components/MarkDownRender/index.cjs +4 -2
  155. package/dist/components/MarkDownRender/index.cjs.map +1 -1
  156. package/dist/components/MarkDownRender/index.d.ts +3 -1
  157. package/dist/components/MarkDownRender/index.d.ts.map +1 -1
  158. package/dist/components/MarkDownRender/index.mjs +4 -2
  159. package/dist/components/MarkDownRender/index.mjs.map +1 -1
  160. package/dist/components/Modal/Modal.cjs +8 -10
  161. package/dist/components/Modal/Modal.cjs.map +1 -1
  162. package/dist/components/Modal/Modal.d.ts.map +1 -1
  163. package/dist/components/Modal/Modal.mjs +8 -10
  164. package/dist/components/Modal/Modal.mjs.map +1 -1
  165. package/dist/components/Navbar/DesktopNavbar.cjs +1 -1
  166. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  167. package/dist/components/Navbar/DesktopNavbar.mjs +1 -1
  168. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  169. package/dist/components/index.cjs +5 -0
  170. package/dist/components/index.cjs.map +1 -1
  171. package/dist/components/index.mjs +6 -1
  172. package/dist/components/index.mjs.map +1 -1
  173. package/dist/design-system.css +235 -0
  174. package/dist/hooks/index.cjs +6 -0
  175. package/dist/hooks/index.cjs.map +1 -1
  176. package/dist/hooks/index.d.ts +1 -0
  177. package/dist/hooks/index.d.ts.map +1 -1
  178. package/dist/hooks/index.mjs +7 -1
  179. package/dist/hooks/index.mjs.map +1 -1
  180. package/dist/hooks/intlayerAPIHooks.cjs +8 -2
  181. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  182. package/dist/hooks/intlayerAPIHooks.d.ts +4 -0
  183. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  184. package/dist/hooks/intlayerAPIHooks.mjs +8 -2
  185. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  186. package/dist/hooks/useAsync/index.cjs +3 -0
  187. package/dist/hooks/useAsync/index.cjs.map +1 -1
  188. package/dist/hooks/useAsync/index.d.ts +1 -0
  189. package/dist/hooks/useAsync/index.d.ts.map +1 -1
  190. package/dist/hooks/useAsync/index.mjs +4 -1
  191. package/dist/hooks/useAsync/index.mjs.map +1 -1
  192. package/dist/hooks/useAsync/useAsync.cjs +2 -9
  193. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  194. package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
  195. package/dist/hooks/useAsync/useAsync.mjs +3 -10
  196. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  197. package/dist/hooks/useAsync/useAsyncStateStore.cjs +123 -69
  198. package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
  199. package/dist/hooks/useAsync/useAsyncStateStore.d.ts +35 -11
  200. package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
  201. package/dist/hooks/useAsync/useAsyncStateStore.mjs +123 -69
  202. package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
  203. package/dist/hooks/useIntlayerAPI.d.ts +3 -0
  204. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  205. package/dist/hooks/useIsDarkMode.cjs +15 -0
  206. package/dist/hooks/useIsDarkMode.cjs.map +1 -0
  207. package/dist/hooks/useIsDarkMode.d.ts +2 -0
  208. package/dist/hooks/useIsDarkMode.d.ts.map +1 -0
  209. package/dist/hooks/useIsDarkMode.mjs +15 -0
  210. package/dist/hooks/useIsDarkMode.mjs.map +1 -0
  211. package/dist/libs/intlayer-api/ai.cjs +24 -0
  212. package/dist/libs/intlayer-api/ai.cjs.map +1 -0
  213. package/dist/libs/intlayer-api/ai.d.ts +10 -0
  214. package/dist/libs/intlayer-api/ai.d.ts.map +1 -0
  215. package/dist/libs/intlayer-api/ai.mjs +24 -0
  216. package/dist/libs/intlayer-api/ai.mjs.map +1 -0
  217. package/dist/libs/intlayer-api/index.cjs +3 -1
  218. package/dist/libs/intlayer-api/index.cjs.map +1 -1
  219. package/dist/libs/intlayer-api/index.d.ts +6 -0
  220. package/dist/libs/intlayer-api/index.d.ts.map +1 -1
  221. package/dist/libs/intlayer-api/index.mjs +3 -1
  222. package/dist/libs/intlayer-api/index.mjs.map +1 -1
  223. package/dist/tailwind.css +1 -1
  224. package/package.json +19 -16
@@ -1,612 +1,48 @@
1
1
  "use client";
2
2
  import { j as jsxRuntimeExports } from "../../jsx-runtime-DaNGiM0W.js";
3
- import { CopyCheckIcon, CopyIcon } from "lucide-react";
4
- import { lazy, useState, useEffect, Suspense } from "react";
5
- import CopyToClipboard from "react-copy-to-clipboard";
3
+ import highlight from "highlight.js";
4
+ import { forwardRef, useRef, useEffect } from "react";
6
5
  import { cn } from "../../utils/cn.mjs";
7
- import { Loader } from "../Loader/index.mjs";
8
- const okaidia = {
9
- 'code[class*="language-"]': {
10
- "color": "#f8f8f2",
11
- "background": "none",
12
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
13
- "fontFamily": "Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",
14
- "fontSize": "1em",
15
- "textAlign": "left",
16
- "whiteSpace": "pre",
17
- "wordSpacing": "normal",
18
- "wordBreak": "normal",
19
- "wordWrap": "normal",
20
- "lineHeight": "1.5",
21
- "MozTabSize": "4",
22
- "OTabSize": "4",
23
- "tabSize": "4",
24
- "WebkitHyphens": "none",
25
- "MozHyphens": "none",
26
- "msHyphens": "none",
27
- "hyphens": "none"
28
- },
29
- 'pre[class*="language-"]': {
30
- "color": "#f8f8f2",
31
- "background": "#272822",
32
- "textShadow": "0 1px rgba(0, 0, 0, 0.3)",
33
- "fontFamily": "Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",
34
- "fontSize": "1em",
35
- "textAlign": "left",
36
- "whiteSpace": "pre",
37
- "wordSpacing": "normal",
38
- "wordBreak": "normal",
39
- "wordWrap": "normal",
40
- "lineHeight": "1.5",
41
- "MozTabSize": "4",
42
- "OTabSize": "4",
43
- "tabSize": "4",
44
- "WebkitHyphens": "none",
45
- "MozHyphens": "none",
46
- "msHyphens": "none",
47
- "hyphens": "none",
48
- "padding": "1em",
49
- "margin": ".5em 0",
50
- "overflow": "auto",
51
- "borderRadius": "0.3em"
52
- },
53
- ':not(pre) > code[class*="language-"]': {
54
- "background": "#272822",
55
- "padding": ".1em",
56
- "borderRadius": ".3em",
57
- "whiteSpace": "normal"
58
- },
59
- "comment": {
60
- "color": "#8292a2"
61
- },
62
- "prolog": {
63
- "color": "#8292a2"
64
- },
65
- "doctype": {
66
- "color": "#8292a2"
67
- },
68
- "cdata": {
69
- "color": "#8292a2"
70
- },
71
- "punctuation": {
72
- "color": "#f8f8f2"
73
- },
74
- "namespace": {
75
- "Opacity": ".7"
76
- },
77
- "property": {
78
- "color": "#f92672"
79
- },
80
- "tag": {
81
- "color": "#f92672"
82
- },
83
- "constant": {
84
- "color": "#f92672"
85
- },
86
- "symbol": {
87
- "color": "#f92672"
88
- },
89
- "deleted": {
90
- "color": "#f92672"
91
- },
92
- "boolean": {
93
- "color": "#ae81ff"
94
- },
95
- "number": {
96
- "color": "#ae81ff"
97
- },
98
- "selector": {
99
- "color": "#a6e22e"
100
- },
101
- "attr-name": {
102
- "color": "#a6e22e"
103
- },
104
- "string": {
105
- "color": "#a6e22e"
106
- },
107
- "char": {
108
- "color": "#a6e22e"
109
- },
110
- "builtin": {
111
- "color": "#a6e22e"
112
- },
113
- "inserted": {
114
- "color": "#a6e22e"
115
- },
116
- "operator": {
117
- "color": "#f8f8f2"
118
- },
119
- "entity": {
120
- "color": "#f8f8f2",
121
- "cursor": "help"
122
- },
123
- "url": {
124
- "color": "#f8f8f2"
125
- },
126
- ".language-css .token.string": {
127
- "color": "#f8f8f2"
128
- },
129
- ".style .token.string": {
130
- "color": "#f8f8f2"
131
- },
132
- "variable": {
133
- "color": "#f8f8f2"
134
- },
135
- "atrule": {
136
- "color": "#e6db74"
137
- },
138
- "attr-value": {
139
- "color": "#e6db74"
140
- },
141
- "function": {
142
- "color": "#e6db74"
143
- },
144
- "class-name": {
145
- "color": "#e6db74"
146
- },
147
- "keyword": {
148
- "color": "#66d9ef"
149
- },
150
- "regex": {
151
- "color": "#fd971f"
152
- },
153
- "important": {
154
- "color": "#fd971f",
155
- "fontWeight": "bold"
156
- },
157
- "bold": {
158
- "fontWeight": "bold"
159
- },
160
- "italic": {
161
- "fontStyle": "italic"
6
+ import { CopyButton } from "./CopyButton.mjs";
7
+ const Code = forwardRef(
8
+ ({
9
+ children,
10
+ language,
11
+ isDarkMode,
12
+ showHeader = true,
13
+ showLineNumbers = true,
14
+ className,
15
+ ...props
16
+ }, ref) => {
17
+ const codeRef = useRef(null);
18
+ useEffect(() => {
19
+ if (codeRef && codeRef.current && !codeRef.current.hasAttribute("data-highlighted")) {
20
+ highlight.highlightElement(codeRef.current);
21
+ codeRef.current.setAttribute("data-highlighted", "true");
22
+ }
23
+ }, [children, showLineNumbers]);
24
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
25
+ "div",
26
+ {
27
+ className: cn(
28
+ "relative h-full w-full text-sm leading-6",
29
+ showLineNumbers && "ml-0",
30
+ className
31
+ ),
32
+ ref,
33
+ ...props,
34
+ children: [
35
+ showHeader && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
36
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-card dark:bg-card-dark text-neutral dark:text-neutral-dark flex h-9 w-full items-center rounded-t-xl pl-4 text-sm", children: language ?? "javascript" }),
37
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sticky top-28", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-0 right-2 flex h-9 items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyButton, { content: children }) }) })
38
+ ] }),
39
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid size-full grid-cols-[0px] overflow-auto p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: `language-${language} w-fit`, ref: codeRef, children }) }) })
40
+ ]
41
+ }
42
+ );
162
43
  }
163
- };
164
- const coldarkCold = {
165
- 'code[class*="language-"]': {
166
- "color": "#111b27",
167
- "background": "none",
168
- "fontFamily": 'Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace',
169
- "textAlign": "left",
170
- "whiteSpace": "pre",
171
- "wordSpacing": "normal",
172
- "wordBreak": "normal",
173
- "wordWrap": "normal",
174
- "lineHeight": "1.5",
175
- "MozTabSize": "4",
176
- "OTabSize": "4",
177
- "tabSize": "4",
178
- "WebkitHyphens": "none",
179
- "MozHyphens": "none",
180
- "msHyphens": "none",
181
- "hyphens": "none"
182
- },
183
- 'pre[class*="language-"]': {
184
- "color": "#111b27",
185
- "background": "#e3eaf2",
186
- "fontFamily": 'Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace',
187
- "textAlign": "left",
188
- "whiteSpace": "pre",
189
- "wordSpacing": "normal",
190
- "wordBreak": "normal",
191
- "wordWrap": "normal",
192
- "lineHeight": "1.5",
193
- "MozTabSize": "4",
194
- "OTabSize": "4",
195
- "tabSize": "4",
196
- "WebkitHyphens": "none",
197
- "MozHyphens": "none",
198
- "msHyphens": "none",
199
- "hyphens": "none",
200
- "padding": "1em",
201
- "margin": "0.5em 0",
202
- "overflow": "auto"
203
- },
204
- 'pre[class*="language-"]::-moz-selection': {
205
- "background": "#8da1b9"
206
- },
207
- 'pre[class*="language-"] ::-moz-selection': {
208
- "background": "#8da1b9"
209
- },
210
- 'code[class*="language-"]::-moz-selection': {
211
- "background": "#8da1b9"
212
- },
213
- 'code[class*="language-"] ::-moz-selection': {
214
- "background": "#8da1b9"
215
- },
216
- 'pre[class*="language-"]::selection': {
217
- "background": "#8da1b9"
218
- },
219
- 'pre[class*="language-"] ::selection': {
220
- "background": "#8da1b9"
221
- },
222
- 'code[class*="language-"]::selection': {
223
- "background": "#8da1b9"
224
- },
225
- 'code[class*="language-"] ::selection': {
226
- "background": "#8da1b9"
227
- },
228
- ':not(pre) > code[class*="language-"]': {
229
- "background": "#e3eaf2",
230
- "padding": "0.1em 0.3em",
231
- "borderRadius": "0.3em",
232
- "whiteSpace": "normal"
233
- },
234
- "comment": {
235
- "color": "#3c526d"
236
- },
237
- "prolog": {
238
- "color": "#3c526d"
239
- },
240
- "doctype": {
241
- "color": "#3c526d"
242
- },
243
- "cdata": {
244
- "color": "#3c526d"
245
- },
246
- "punctuation": {
247
- "color": "#111b27"
248
- },
249
- "delimiter.important": {
250
- "color": "#006d6d",
251
- "fontWeight": "inherit"
252
- },
253
- "selector.parent": {
254
- "color": "#006d6d"
255
- },
256
- "tag": {
257
- "color": "#006d6d"
258
- },
259
- "tag.punctuation": {
260
- "color": "#006d6d"
261
- },
262
- "attr-name": {
263
- "color": "#755f00"
264
- },
265
- "boolean": {
266
- "color": "#755f00"
267
- },
268
- "boolean.important": {
269
- "color": "#755f00"
270
- },
271
- "number": {
272
- "color": "#755f00"
273
- },
274
- "constant": {
275
- "color": "#755f00"
276
- },
277
- "selector.attribute": {
278
- "color": "#755f00"
279
- },
280
- "class-name": {
281
- "color": "#005a8e"
282
- },
283
- "key": {
284
- "color": "#005a8e"
285
- },
286
- "parameter": {
287
- "color": "#005a8e"
288
- },
289
- "property": {
290
- "color": "#005a8e"
291
- },
292
- "property-access": {
293
- "color": "#005a8e"
294
- },
295
- "variable": {
296
- "color": "#005a8e"
297
- },
298
- "attr-value": {
299
- "color": "#116b00"
300
- },
301
- "inserted": {
302
- "color": "#116b00"
303
- },
304
- "color": {
305
- "color": "#116b00"
306
- },
307
- "selector.value": {
308
- "color": "#116b00"
309
- },
310
- "string": {
311
- "color": "#116b00"
312
- },
313
- "string.url-link": {
314
- "color": "#116b00"
315
- },
316
- "builtin": {
317
- "color": "#af00af"
318
- },
319
- "keyword-array": {
320
- "color": "#af00af"
321
- },
322
- "package": {
323
- "color": "#af00af"
324
- },
325
- "regex": {
326
- "color": "#af00af"
327
- },
328
- "function": {
329
- "color": "#7c00aa"
330
- },
331
- "selector.class": {
332
- "color": "#7c00aa"
333
- },
334
- "selector.id": {
335
- "color": "#7c00aa"
336
- },
337
- "atrule.rule": {
338
- "color": "#a04900"
339
- },
340
- "combinator": {
341
- "color": "#a04900"
342
- },
343
- "keyword": {
344
- "color": "#a04900"
345
- },
346
- "operator": {
347
- "color": "#a04900"
348
- },
349
- "pseudo-class": {
350
- "color": "#a04900"
351
- },
352
- "pseudo-element": {
353
- "color": "#a04900"
354
- },
355
- "selector": {
356
- "color": "#a04900"
357
- },
358
- "unit": {
359
- "color": "#a04900"
360
- },
361
- "deleted": {
362
- "color": "#c22f2e"
363
- },
364
- "important": {
365
- "color": "#c22f2e",
366
- "fontWeight": "bold"
367
- },
368
- "keyword-this": {
369
- "color": "#005a8e",
370
- "fontWeight": "bold"
371
- },
372
- "this": {
373
- "color": "#005a8e",
374
- "fontWeight": "bold"
375
- },
376
- "bold": {
377
- "fontWeight": "bold"
378
- },
379
- "italic": {
380
- "fontStyle": "italic"
381
- },
382
- "entity": {
383
- "cursor": "help"
384
- },
385
- ".language-markdown .token.title": {
386
- "color": "#005a8e",
387
- "fontWeight": "bold"
388
- },
389
- ".language-markdown .token.title .token.punctuation": {
390
- "color": "#005a8e",
391
- "fontWeight": "bold"
392
- },
393
- ".language-markdown .token.blockquote.punctuation": {
394
- "color": "#af00af"
395
- },
396
- ".language-markdown .token.code": {
397
- "color": "#006d6d"
398
- },
399
- ".language-markdown .token.hr.punctuation": {
400
- "color": "#005a8e"
401
- },
402
- ".language-markdown .token.url > .token.content": {
403
- "color": "#116b00"
404
- },
405
- ".language-markdown .token.url-link": {
406
- "color": "#755f00"
407
- },
408
- ".language-markdown .token.list.punctuation": {
409
- "color": "#af00af"
410
- },
411
- ".language-markdown .token.table-header": {
412
- "color": "#111b27"
413
- },
414
- ".language-json .token.operator": {
415
- "color": "#111b27"
416
- },
417
- ".language-scss .token.variable": {
418
- "color": "#006d6d"
419
- },
420
- "token.tab:not(:empty):before": {
421
- "color": "#3c526d"
422
- },
423
- "token.cr:before": {
424
- "color": "#3c526d"
425
- },
426
- "token.lf:before": {
427
- "color": "#3c526d"
428
- },
429
- "token.space:before": {
430
- "color": "#3c526d"
431
- },
432
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a": {
433
- "color": "#e3eaf2",
434
- "background": "#005a8e"
435
- },
436
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button": {
437
- "color": "#e3eaf2",
438
- "background": "#005a8e"
439
- },
440
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover": {
441
- "color": "#e3eaf2",
442
- "background": "#005a8eda",
443
- "textDecoration": "none"
444
- },
445
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus": {
446
- "color": "#e3eaf2",
447
- "background": "#005a8eda",
448
- "textDecoration": "none"
449
- },
450
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover": {
451
- "color": "#e3eaf2",
452
- "background": "#005a8eda",
453
- "textDecoration": "none"
454
- },
455
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus": {
456
- "color": "#e3eaf2",
457
- "background": "#005a8eda",
458
- "textDecoration": "none"
459
- },
460
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span": {
461
- "color": "#e3eaf2",
462
- "background": "#3c526d"
463
- },
464
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover": {
465
- "color": "#e3eaf2",
466
- "background": "#3c526d"
467
- },
468
- "div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus": {
469
- "color": "#e3eaf2",
470
- "background": "#3c526d"
471
- },
472
- ".line-highlight.line-highlight": {
473
- "background": "linear-gradient(to right, #8da1b92f 70%, #8da1b925)"
474
- },
475
- ".line-highlight.line-highlight:before": {
476
- "backgroundColor": "#3c526d",
477
- "color": "#e3eaf2",
478
- "boxShadow": "0 1px #8da1b9"
479
- },
480
- ".line-highlight.line-highlight[data-end]:after": {
481
- "backgroundColor": "#3c526d",
482
- "color": "#e3eaf2",
483
- "boxShadow": "0 1px #8da1b9"
484
- },
485
- "pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before": {
486
- "backgroundColor": "#3c526d1f"
487
- },
488
- ".line-numbers.line-numbers .line-numbers-rows": {
489
- "borderRight": "1px solid #8da1b97a",
490
- "background": "#d0dae77a"
491
- },
492
- ".line-numbers .line-numbers-rows > span:before": {
493
- "color": "#3c526dda"
494
- },
495
- ".rainbow-braces .token.token.punctuation.brace-level-1": {
496
- "color": "#755f00"
497
- },
498
- ".rainbow-braces .token.token.punctuation.brace-level-5": {
499
- "color": "#755f00"
500
- },
501
- ".rainbow-braces .token.token.punctuation.brace-level-9": {
502
- "color": "#755f00"
503
- },
504
- ".rainbow-braces .token.token.punctuation.brace-level-2": {
505
- "color": "#af00af"
506
- },
507
- ".rainbow-braces .token.token.punctuation.brace-level-6": {
508
- "color": "#af00af"
509
- },
510
- ".rainbow-braces .token.token.punctuation.brace-level-10": {
511
- "color": "#af00af"
512
- },
513
- ".rainbow-braces .token.token.punctuation.brace-level-3": {
514
- "color": "#005a8e"
515
- },
516
- ".rainbow-braces .token.token.punctuation.brace-level-7": {
517
- "color": "#005a8e"
518
- },
519
- ".rainbow-braces .token.token.punctuation.brace-level-11": {
520
- "color": "#005a8e"
521
- },
522
- ".rainbow-braces .token.token.punctuation.brace-level-4": {
523
- "color": "#7c00aa"
524
- },
525
- ".rainbow-braces .token.token.punctuation.brace-level-8": {
526
- "color": "#7c00aa"
527
- },
528
- ".rainbow-braces .token.token.punctuation.brace-level-12": {
529
- "color": "#7c00aa"
530
- },
531
- "pre.diff-highlight > code .token.token.deleted:not(.prefix)": {
532
- "backgroundColor": "#c22f2e1f"
533
- },
534
- "pre > code.diff-highlight .token.token.deleted:not(.prefix)": {
535
- "backgroundColor": "#c22f2e1f"
536
- },
537
- "pre.diff-highlight > code .token.token.inserted:not(.prefix)": {
538
- "backgroundColor": "#116b001f"
539
- },
540
- "pre > code.diff-highlight .token.token.inserted:not(.prefix)": {
541
- "backgroundColor": "#116b001f"
542
- },
543
- ".command-line .command-line-prompt": {
544
- "borderRight": "1px solid #8da1b97a"
545
- },
546
- ".command-line .command-line-prompt > span:before": {
547
- "color": "#3c526dda"
548
- }
549
- };
550
- const SyntaxHighlighter = lazy(
551
- () => import("react-syntax-highlighter").then((module) => ({
552
- default: module.Prism
553
- }))
554
44
  );
555
- const Code = ({
556
- children,
557
- language,
558
- isDarkMode,
559
- showLineNumbers = true,
560
- ...props
561
- }) => {
562
- const [isDarkModeState, setIsDarkModeState] = useState(false);
563
- const [copied, setCopied] = useState(false);
564
- useEffect(
565
- () => (
566
- // Necessary to fix first render bug
567
- setIsDarkModeState(isDarkMode ?? false)
568
- ),
569
- [isDarkMode]
570
- );
571
- useEffect(() => {
572
- const timer = setTimeout(() => {
573
- setCopied(false);
574
- }, 1e3);
575
- return () => clearTimeout(timer);
576
- }, [copied]);
577
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
578
- "div",
579
- {
580
- className: cn(
581
- "relative h-full w-full text-sm",
582
- showLineNumbers && "ml-0"
583
- ),
584
- children: [
585
- /* @__PURE__ */ jsxRuntimeExports.jsx(CopyToClipboard, { text: children, onCopy: () => setCopied(true), children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "absolute right-3 top-3", "aria-label": "Copy code", children: copied ? /* @__PURE__ */ jsxRuntimeExports.jsx(CopyCheckIcon, { className: "size-4" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { className: "size-4" }) }) }),
586
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid size-full grid-cols-[0px] overflow-auto p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, {}), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
587
- SyntaxHighlighter,
588
- {
589
- customStyle: {
590
- display: void 0,
591
- overflowX: "auto",
592
- overflowY: "auto",
593
- padding: void 0,
594
- color: void 0,
595
- background: "inherit",
596
- margin: void 0
597
- },
598
- PreTag: (props2) => props2.children,
599
- language: language ?? "javascript",
600
- style: isDarkModeState ? okaidia : coldarkCold,
601
- showLineNumbers,
602
- ...props,
603
- children: String(children).replace(/\n$/, "")
604
- }
605
- ) }) })
606
- ]
607
- }
608
- );
609
- };
45
+ Code.displayName = "Code";
610
46
  export {
611
47
  Code
612
48
  };