@xyd-js/components 0.1.0-xyd.8 → 0.1.0-xyd.94

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 (322) hide show
  1. package/.idea/git_toolbox_blame.xml +6 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/vcs.xml +6 -0
  4. package/.idea/xyd-components.iml +12 -0
  5. package/CHANGELOG.md +712 -0
  6. package/TODO.md +1 -0
  7. package/content.ts +0 -2
  8. package/dist/CTABanner-Bc77pnms.js +2 -0
  9. package/dist/CTABanner-Bc77pnms.js.map +1 -0
  10. package/dist/CTABanner-DzO62aGj.js +2 -0
  11. package/dist/CTABanner-DzO62aGj.js.map +1 -0
  12. package/dist/CodeSample-BWPDgd2G.js +2 -0
  13. package/dist/CodeSample-BWPDgd2G.js.map +1 -0
  14. package/dist/CodeSample-DLnR-knP.js +2 -0
  15. package/dist/CodeSample-DLnR-knP.js.map +1 -0
  16. package/dist/HomeView-C8QlNdKh.js +2 -0
  17. package/dist/{HomeView-ACBdUgyz.js.map → HomeView-C8QlNdKh.js.map} +1 -1
  18. package/dist/HomeView-ZAP5saNy.js +2 -0
  19. package/dist/{HomeView-B0ATNUF1.js.map → HomeView-ZAP5saNy.js.map} +1 -1
  20. package/dist/Icon-BESh23UN.js +2 -0
  21. package/dist/Icon-BESh23UN.js.map +1 -0
  22. package/dist/Icon-xNucOqd2.js +2 -0
  23. package/dist/Icon-xNucOqd2.js.map +1 -0
  24. package/dist/Text-CfN9RkYA.js +2 -0
  25. package/dist/Text-CfN9RkYA.js.map +1 -0
  26. package/dist/Text-DKycD2zu.js +2 -0
  27. package/dist/Text-DKycD2zu.js.map +1 -0
  28. package/dist/Update-0XruJHjj.js +2 -0
  29. package/dist/Update-0XruJHjj.js.map +1 -0
  30. package/dist/Update-DKOAw8p9.js +2 -0
  31. package/dist/Update-DKOAw8p9.js.map +1 -0
  32. package/dist/VideoGuide-BUyomFVz.js +2 -0
  33. package/dist/VideoGuide-BUyomFVz.js.map +1 -0
  34. package/dist/VideoGuide-B_iUKKv7.js +2 -0
  35. package/dist/VideoGuide-B_iUKKv7.js.map +1 -0
  36. package/dist/_rollupPluginBabelHelpers-CxSUtGup.js +4 -0
  37. package/dist/_rollupPluginBabelHelpers-CxSUtGup.js.map +1 -0
  38. package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js +4 -0
  39. package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js.map +1 -0
  40. package/dist/brand.js +1 -1
  41. package/dist/brand.js.map +1 -1
  42. package/dist/coder/themes/cosmo-light.js.map +1 -1
  43. package/dist/coder.d.ts +29 -9
  44. package/dist/coder.js +1 -1
  45. package/dist/coder.js.map +1 -1
  46. package/dist/content.d.ts +264 -201
  47. package/dist/content.js +1 -1
  48. package/dist/content.js.map +1 -1
  49. package/dist/index.css +261 -211
  50. package/dist/layouts.d.ts +20 -21
  51. package/dist/layouts.js +1 -1
  52. package/dist/layouts.js.map +1 -1
  53. package/dist/pages.js +1 -1
  54. package/dist/pages.js.map +1 -1
  55. package/dist/system.d.ts +10 -0
  56. package/dist/system.js +2 -0
  57. package/dist/system.js.map +1 -0
  58. package/dist/tslib.es6-DyL9kPq9.js +2 -0
  59. package/dist/{tslib.es6-BBkx4Se1.js.map → tslib.es6-DyL9kPq9.js.map} +1 -1
  60. package/dist/tslib.es6-Hqk-Mdr9.js +2 -0
  61. package/dist/{tslib.es6-BF6ZLEXa.js.map → tslib.es6-Hqk-Mdr9.js.map} +1 -1
  62. package/dist/views.js +1 -1
  63. package/dist/writer.d.ts +409 -77
  64. package/dist/writer.js +1 -1
  65. package/dist/writer.js.map +1 -1
  66. package/docs/.nojekyll +1 -0
  67. package/docs/assets/hierarchy.js +1 -0
  68. package/docs/assets/highlight.css +22 -0
  69. package/docs/assets/icons.js +18 -0
  70. package/docs/assets/icons.svg +1 -0
  71. package/docs/assets/main.js +60 -0
  72. package/docs/assets/navigation.js +1 -0
  73. package/docs/assets/search.js +1 -0
  74. package/docs/assets/style.css +1640 -0
  75. package/docs/functions/GuideCard.html +6 -0
  76. package/docs/hierarchy.html +1 -0
  77. package/docs/index.html +2 -0
  78. package/docs/interfaces/GuideCardProps.html +18 -0
  79. package/docs/modules.html +1 -0
  80. package/index.ts +0 -1
  81. package/package.json +9 -15
  82. package/project.json +677 -0
  83. package/rollup.config.js +30 -20
  84. package/src/brand/Button/Button.styles.tsx +0 -3
  85. package/src/brand/CTABanner/CTABanner.styles.tsx +2 -4
  86. package/src/brand/Footer/Footer.styles.tsx +0 -3
  87. package/src/coder/Code/Code.styles.tsx +135 -33
  88. package/src/coder/Code/Code.tsx +129 -38
  89. package/src/coder/Code/CodeLoader.tsx +3 -3
  90. package/src/coder/Code/annotations.tsx +28 -8
  91. package/src/coder/Code/highlight.ts +38 -0
  92. package/src/coder/Code/index.ts +2 -1
  93. package/src/coder/CodeCopy/CodeCopy.styles.tsx +13 -11
  94. package/src/coder/CodeCopy/CodeCopy.tsx +5 -3
  95. package/src/coder/CodeSample/CodeSample.tsx +83 -27
  96. package/src/coder/CodeTabs/CodeTabs.styles.tsx +111 -94
  97. package/src/coder/CodeTabs/CodeTabs.tsx +69 -51
  98. package/src/coder/CodeTheme/CodeTheme.tsx +89 -49
  99. package/src/coder/CodeTheme/index.ts +0 -1
  100. package/src/coder/CoderProvider.tsx +26 -0
  101. package/src/coder/index.ts +8 -4
  102. package/src/content/ContentDecoator.styles.tsx +113 -0
  103. package/src/content/ContentDecorator.tsx +17 -0
  104. package/src/content/GridDecorator.styles.tsx +67 -0
  105. package/src/content/GridDecorator.tsx +21 -0
  106. package/src/content/ReactContent.tsx +575 -0
  107. package/src/content/index.ts +10 -2
  108. package/src/icons/index.ts +0 -0
  109. package/src/kit/Loader/Loader.styles.tsx +53 -0
  110. package/src/kit/Loader/Loader.tsx +22 -0
  111. package/src/kit/index.ts +1 -0
  112. package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +270 -306
  113. package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +171 -91
  114. package/src/layouts/LayoutPrimary/index.ts +0 -2
  115. package/src/layouts/index.ts +0 -7
  116. package/src/system/SearchButton/SearchButton.styles.tsx +86 -0
  117. package/src/system/SearchButton/SearchButton.tsx +116 -0
  118. package/src/system/SearchButton/index.ts +1 -0
  119. package/src/system/index.ts +1 -0
  120. package/src/writer/Anchor/Anchor.styles.tsx +11 -0
  121. package/src/{content → writer}/Anchor/Anchor.tsx +20 -22
  122. package/src/writer/Anchor/index.tsx +1 -0
  123. package/src/writer/Badge/Badge.styles.tsx +37 -27
  124. package/src/writer/Badge/Badge.tsx +34 -48
  125. package/src/writer/Banner/Banner.styles.tsx +91 -0
  126. package/src/writer/Banner/Banner.tsx +70 -0
  127. package/src/writer/Banner/index.ts +1 -0
  128. package/src/writer/Blockquote/Blockquote.styles.tsx +6 -4
  129. package/src/writer/Blockquote/Blockquote.tsx +5 -2
  130. package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +25 -25
  131. package/src/writer/Breadcrumbs/Breadcrumbs.tsx +18 -12
  132. package/src/writer/Button/Button.styles.tsx +137 -0
  133. package/src/writer/Button/Button.tsx +75 -0
  134. package/src/writer/Button/index.ts +2 -0
  135. package/src/writer/Callout/Callout.styles.tsx +35 -42
  136. package/src/writer/Callout/Callout.tsx +30 -15
  137. package/src/writer/Card/Card.styles.tsx +47 -0
  138. package/src/writer/Card/Card.tsx +69 -0
  139. package/src/writer/Card/index.ts +1 -0
  140. package/src/writer/Code/Code.styles.tsx +12 -11
  141. package/src/writer/Code/Code.tsx +6 -3
  142. package/src/writer/ColorSchemeButton/ColorSchemeButton.tsx +172 -0
  143. package/src/writer/ColorSchemeButton/index.ts +1 -0
  144. package/src/writer/Details/Details.styles.tsx +87 -98
  145. package/src/writer/Details/Details.tsx +65 -44
  146. package/src/writer/Example/index.tsx +5 -0
  147. package/src/writer/GuideCard/GuideCard.styles.tsx +100 -103
  148. package/src/writer/GuideCard/GuideCard.tsx +72 -37
  149. package/src/writer/Heading/Heading.styles.tsx +76 -60
  150. package/src/writer/Heading/Heading.tsx +92 -22
  151. package/src/writer/Hr/Hr.styles.tsx +3 -1
  152. package/src/writer/Hr/Hr.tsx +2 -5
  153. package/src/writer/Icon/Icon.tsx +48 -0
  154. package/src/writer/Icon/index.ts +1 -0
  155. package/src/writer/Image/Image.styles.tsx +9 -0
  156. package/src/writer/Image/Image.tsx +19 -0
  157. package/src/writer/Image/index.ts +1 -0
  158. package/src/writer/List/List.styles.tsx +47 -0
  159. package/src/writer/List/List.tsx +29 -0
  160. package/src/writer/List/index.ts +4 -0
  161. package/src/writer/NavLinks/NavLinks.styles.ts +26 -26
  162. package/src/writer/NavLinks/NavLinks.tsx +65 -18
  163. package/src/writer/Pre/Pre.styles.tsx +8 -6
  164. package/src/writer/Pre/Pre.tsx +3 -2
  165. package/src/writer/Steps/Steps.styles.tsx +27 -24
  166. package/src/writer/Steps/Steps.tsx +38 -8
  167. package/src/writer/Table/Table.styles.tsx +65 -34
  168. package/src/writer/Table/Table.tsx +121 -11
  169. package/src/writer/Table/index.ts +0 -11
  170. package/src/writer/Tabs/Tabs.styles.tsx +51 -55
  171. package/src/writer/Tabs/Tabs.tsx +30 -23
  172. package/src/writer/Text/Text.styles.tsx +66 -0
  173. package/src/writer/Text/Text.tsx +79 -0
  174. package/src/writer/Text/index.ts +3 -0
  175. package/src/writer/TocCard/TocCard.module.css +44 -0
  176. package/src/writer/TocCard/TocCard.tsx +42 -0
  177. package/src/writer/TocCard/index.ts +3 -0
  178. package/src/writer/UnderlineNav/Tabs.tsx +51 -0
  179. package/src/writer/UnderlineNav/TabsPrimary.styles.tsx +184 -0
  180. package/src/writer/UnderlineNav/TabsPrimary.tsx +209 -0
  181. package/src/writer/UnderlineNav/TabsSecondary.styles.tsx +77 -0
  182. package/src/writer/UnderlineNav/TabsSecondary.tsx +171 -0
  183. package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +165 -31
  184. package/src/writer/UnderlineNav/UnderlineNav.tsx +257 -22
  185. package/src/writer/UnderlineNav/index.ts +2 -1
  186. package/src/writer/UnderlineNav/useValueChange.ts +60 -0
  187. package/src/writer/Update/Update.styles.tsx +33 -0
  188. package/src/writer/Update/Update.tsx +37 -0
  189. package/src/writer/Update/index.ts +1 -0
  190. package/src/writer/VideoGuide/VideoGuide.module.css +105 -0
  191. package/src/writer/VideoGuide/VideoGuide.tsx +75 -0
  192. package/src/writer/VideoGuide/index.ts +1 -0
  193. package/src/writer/index.ts +23 -1
  194. package/tsconfig.json +9 -3
  195. package/types.d.ts +50 -0
  196. package/writer.ts +1 -1
  197. package/dist/CTABanner-4FVIoaTR.js +0 -2
  198. package/dist/CTABanner-4FVIoaTR.js.map +0 -1
  199. package/dist/CTABanner-C6afsXoE.js +0 -2
  200. package/dist/CTABanner-C6afsXoE.js.map +0 -1
  201. package/dist/CTABanner-CEKs-Hb-.js +0 -2
  202. package/dist/CTABanner-CEKs-Hb-.js.map +0 -1
  203. package/dist/CTABanner-CUNcTr6s.js +0 -2
  204. package/dist/CTABanner-CUNcTr6s.js.map +0 -1
  205. package/dist/CTABanner-D02aIAsD.js +0 -2
  206. package/dist/CTABanner-D02aIAsD.js.map +0 -1
  207. package/dist/CTABanner-Dm3tUG3I.js +0 -2
  208. package/dist/CTABanner-Dm3tUG3I.js.map +0 -1
  209. package/dist/CTABanner-MCOcVowa.js +0 -2
  210. package/dist/CTABanner-MCOcVowa.js.map +0 -1
  211. package/dist/CTABanner-X6K49gSr.js +0 -2
  212. package/dist/CTABanner-X6K49gSr.js.map +0 -1
  213. package/dist/CodeSample-B9VUhTKF.js +0 -2
  214. package/dist/CodeSample-B9VUhTKF.js.map +0 -1
  215. package/dist/CodeSample-BSXeFy0x.js +0 -2
  216. package/dist/CodeSample-BSXeFy0x.js.map +0 -1
  217. package/dist/CodeSample-BwP208sQ.js +0 -2
  218. package/dist/CodeSample-BwP208sQ.js.map +0 -1
  219. package/dist/CodeSample-CUemtj_W.js +0 -2
  220. package/dist/CodeSample-CUemtj_W.js.map +0 -1
  221. package/dist/CodeSample-D0iKih-A.js +0 -2
  222. package/dist/CodeSample-D0iKih-A.js.map +0 -1
  223. package/dist/CodeSample-D33vTa6M.js +0 -2
  224. package/dist/CodeSample-D33vTa6M.js.map +0 -1
  225. package/dist/CodeSample-DUSx2KBt.js +0 -2
  226. package/dist/CodeSample-DUSx2KBt.js.map +0 -1
  227. package/dist/CodeSample-P4yxkHPW.js +0 -2
  228. package/dist/CodeSample-P4yxkHPW.js.map +0 -1
  229. package/dist/HomeView-ACBdUgyz.js +0 -2
  230. package/dist/HomeView-B0ATNUF1.js +0 -2
  231. package/dist/HomeView-COJrg8Ju.js +0 -2
  232. package/dist/HomeView-COJrg8Ju.js.map +0 -1
  233. package/dist/HomeView-Cun4apuy.js +0 -2
  234. package/dist/HomeView-Cun4apuy.js.map +0 -1
  235. package/dist/HomeView-D4DXEOOn.js +0 -2
  236. package/dist/HomeView-D4DXEOOn.js.map +0 -1
  237. package/dist/HomeView-DaH1PSBB.js +0 -2
  238. package/dist/HomeView-DaH1PSBB.js.map +0 -1
  239. package/dist/HomeView-O_lj2c2t.js +0 -2
  240. package/dist/HomeView-O_lj2c2t.js.map +0 -1
  241. package/dist/HomeView-_Nu2RcOM.js +0 -2
  242. package/dist/HomeView-_Nu2RcOM.js.map +0 -1
  243. package/dist/UnderlineNav-BCyB0G5d.js +0 -2
  244. package/dist/UnderlineNav-BCyB0G5d.js.map +0 -1
  245. package/dist/UnderlineNav-BEhDJk0H.js +0 -2
  246. package/dist/UnderlineNav-BEhDJk0H.js.map +0 -1
  247. package/dist/UnderlineNav-BqZ2xAp7.js +0 -2
  248. package/dist/UnderlineNav-BqZ2xAp7.js.map +0 -1
  249. package/dist/UnderlineNav-C2-4Vyj8.js +0 -2
  250. package/dist/UnderlineNav-C2-4Vyj8.js.map +0 -1
  251. package/dist/UnderlineNav-Co08Gykm.js +0 -2
  252. package/dist/UnderlineNav-Co08Gykm.js.map +0 -1
  253. package/dist/UnderlineNav-DC3UVmnZ.js +0 -2
  254. package/dist/UnderlineNav-DC3UVmnZ.js.map +0 -1
  255. package/dist/UnderlineNav-DsRYwuGB.js +0 -2
  256. package/dist/UnderlineNav-DsRYwuGB.js.map +0 -1
  257. package/dist/UnderlineNav-FbclXKUW.js +0 -2
  258. package/dist/UnderlineNav-FbclXKUW.js.map +0 -1
  259. package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js +0 -2
  260. package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js.map +0 -1
  261. package/dist/_rollupPluginBabelHelpers-BHehKRBq.js +0 -2
  262. package/dist/_rollupPluginBabelHelpers-BHehKRBq.js.map +0 -1
  263. package/dist/_rollupPluginBabelHelpers-Bunpz22T.js +0 -2
  264. package/dist/_rollupPluginBabelHelpers-Bunpz22T.js.map +0 -1
  265. package/dist/_rollupPluginBabelHelpers-CVblpRvU.js +0 -2
  266. package/dist/_rollupPluginBabelHelpers-CVblpRvU.js.map +0 -1
  267. package/dist/_rollupPluginBabelHelpers-CxmswfqM.js +0 -2
  268. package/dist/_rollupPluginBabelHelpers-CxmswfqM.js.map +0 -1
  269. package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js +0 -2
  270. package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js.map +0 -1
  271. package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js +0 -2
  272. package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js.map +0 -1
  273. package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js +0 -2
  274. package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js.map +0 -1
  275. package/dist/index-B0FncPxO.js +0 -2
  276. package/dist/index-B0FncPxO.js.map +0 -1
  277. package/dist/index-BEm-xkm-.js +0 -2
  278. package/dist/index-BEm-xkm-.js.map +0 -1
  279. package/dist/index-BHwtxG27.js +0 -2
  280. package/dist/index-BHwtxG27.js.map +0 -1
  281. package/dist/index-BTcmIG47.js +0 -2
  282. package/dist/index-BTcmIG47.js.map +0 -1
  283. package/dist/index-CNkHt1r7.js +0 -2
  284. package/dist/index-CNkHt1r7.js.map +0 -1
  285. package/dist/index-D0XuyFm7.js +0 -2
  286. package/dist/index-D0XuyFm7.js.map +0 -1
  287. package/dist/index-DBspcqWq.js +0 -2
  288. package/dist/index-DBspcqWq.js.map +0 -1
  289. package/dist/index-DVBO4gYE.js +0 -2
  290. package/dist/index-DVBO4gYE.js.map +0 -1
  291. package/dist/tslib.es6-BBkx4Se1.js +0 -2
  292. package/dist/tslib.es6-BF6ZLEXa.js +0 -2
  293. package/dist/tslib.es6-BOZCDgb8.js +0 -2
  294. package/dist/tslib.es6-BOZCDgb8.js.map +0 -1
  295. package/dist/tslib.es6-Cjl5tesf.js +0 -2
  296. package/dist/tslib.es6-Cjl5tesf.js.map +0 -1
  297. package/dist/tslib.es6-DEH7Dkgy.js +0 -2
  298. package/dist/tslib.es6-DEH7Dkgy.js.map +0 -1
  299. package/dist/tslib.es6-DTeJ7dWi.js +0 -2
  300. package/dist/tslib.es6-DTeJ7dWi.js.map +0 -1
  301. package/dist/tslib.es6-U9-f6pA7.js +0 -2
  302. package/dist/tslib.es6-U9-f6pA7.js.map +0 -1
  303. package/dist/tslib.es6-cb69JjeS.js +0 -2
  304. package/dist/tslib.es6-cb69JjeS.js.map +0 -1
  305. package/src/content/Anchor/Anchor.styles.tsx +0 -5
  306. package/src/content/Anchor/index.tsx +0 -3
  307. package/src/content/Content/Content.styles.tsx +0 -9
  308. package/src/content/Content/Content.tsx +0 -13
  309. package/src/content/Content/index.tsx +0 -3
  310. package/src/content/Content.tsx +0 -179
  311. package/src/content/Subtitle/Subtitle.styles.ts +0 -8
  312. package/src/content/Subtitle/Subtitle.tsx +0 -12
  313. package/src/content/Subtitle/index.tsx +0 -3
  314. package/src/layouts/Layout.styles.tsx +0 -155
  315. package/src/layouts/Layout.tsx +0 -119
  316. package/src/ui/Loader/Loader.styles.tsx +0 -54
  317. package/src/ui/Loader/Loader.tsx +0 -26
  318. package/src/ui/index.ts +0 -1
  319. package/src/writer/Icon/index.tsx +0 -355
  320. package/src/writer/Table/TableV2.styles.tsx +0 -117
  321. package/src/writer/Table/TableV2.tsx +0 -83
  322. /package/src/{ui → kit}/TODO.md +0 -0
package/rollup.config.js CHANGED
@@ -1,24 +1,24 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import {fileURLToPath} from 'url';
3
+ import { fileURLToPath } from 'url';
4
4
 
5
5
  import resolve from '@rollup/plugin-node-resolve';
6
6
  import commonjs from '@rollup/plugin-commonjs';
7
7
  import typescript from '@rollup/plugin-typescript';
8
8
  import dts from 'rollup-plugin-dts';
9
- import {terser} from 'rollup-plugin-terser';
9
+ import { terser } from 'rollup-plugin-terser';
10
10
  import babel from '@rollup/plugin-babel';
11
11
  import postcss from 'rollup-plugin-postcss';
12
12
  import wyw from '@wyw-in-js/rollup';
13
13
 
14
- import {createRequire} from 'module';
14
+ import { createRequire } from 'module';
15
15
 
16
16
  const require = createRequire(import.meta.url);
17
17
  const {
18
18
  dependencies,
19
19
  peerDependencies,
20
20
  devDependencies
21
- } = require('./package.json', {assert: {type: 'json'}});
21
+ } = require('./package.json', { assert: { type: 'json' } });
22
22
 
23
23
  const external = [
24
24
  ...Object.keys(dependencies),
@@ -47,6 +47,7 @@ export default [
47
47
  pages: 'src/pages/index.ts',
48
48
  views: 'src/views/index.ts',
49
49
  writer: 'writer.ts',
50
+ system: 'src/system/index.ts',
50
51
  ...themes
51
52
  },
52
53
  output: [
@@ -66,25 +67,25 @@ export default [
66
67
  '@babel/preset-react'
67
68
  ],
68
69
  },
69
- classNameSlug: (hash, title, {file}) => {
70
- // Get the full path after 'src/components/'
71
- const pathParts = file.split('/');
72
- const componentsIndex = pathParts.indexOf('src');
73
- if (componentsIndex === -1) return `XydComponents-Component-${title}`;
70
+ // classNameSlug: (hash, title, {file}) => {
71
+ // // Get the full path after 'src/components/'
72
+ // const pathParts = file.split('/');
73
+ // const componentsIndex = pathParts.indexOf('src');
74
+ // if (componentsIndex === -1) return `XydComponents-Component-${title}`;
74
75
 
75
- // Get everything after 'components' directory
76
- const componentPath = pathParts
77
- .slice(componentsIndex + 1)
78
- .filter(part => !part.endsWith('.styles.tsx')) // Remove styles.tsx
79
- .join('-');
76
+ // // Get everything after 'components' directory
77
+ // const componentPath = pathParts
78
+ // .slice(componentsIndex + 1)
79
+ // .filter(part => !part.endsWith('.styles.tsx')) // Remove styles.tsx
80
+ // .join('-');
80
81
 
81
- // Use the title as the style name (it's already the variable name)
82
- const styleName = title.replace(/^\$/, ''); // Remove $ prefix if present
82
+ // // Use the title as the style name (it's already the variable name)
83
+ // const styleName = title.replace(/^\$/, ''); // Remove $ prefix if present
83
84
 
84
- // TODO: in the future hash + system to override styles for specific components if hash
85
- return `XydComponents-Component-${componentPath}__${styleName}`;
86
- // return `XydComponents-Component-${componentPath}__${styleName}_${hash}`;
87
- }
85
+ // // TODO: in the future hash + system to override styles for specific components if hash
86
+ // return `XydComponents-Component-${componentPath}__${styleName}`;
87
+ // // return `XydComponents-Component-${componentPath}__${styleName}_${hash}`;
88
+ // }
88
89
  }),
89
90
  postcss({
90
91
  extract: true,
@@ -182,6 +183,15 @@ export default [
182
183
  plugins: [dts()],
183
184
  external
184
185
  },
186
+ {
187
+ input: 'src/system/index.ts',
188
+ output: {
189
+ file: 'dist/system.d.ts',
190
+ format: 'es',
191
+ },
192
+ plugins: [dts()],
193
+ external
194
+ },
185
195
  ...Object.keys(themes).map(theme => ({
186
196
  input: themes[theme],
187
197
  output: {
@@ -4,12 +4,9 @@ export const ButtonHost = css`
4
4
  display: inline-block;
5
5
  border: 1px solid transparent;
6
6
  text-align: center;
7
- font-weight: 600;
8
7
  white-space: nowrap;
9
8
  border-radius: 20px;
10
9
  padding: 0 20px;
11
- line-height: 38px;
12
- font-size: 14px;
13
10
  border-color: transparent;
14
11
  color: #3c3c43;
15
12
  background-color: #f7f7f8;
@@ -60,8 +60,7 @@ export const CTABannerHeadingHost = css`
60
60
  `;
61
61
 
62
62
  export const CTABannerHeadingTitle = css`
63
- font-size: 76px;
64
- font-weight: 900;
63
+ font-weight: var(--xyd-font-weight-black);
65
64
  text-align: center;
66
65
  letter-spacing: 3px;
67
66
  margin: 0;
@@ -69,8 +68,7 @@ export const CTABannerHeadingTitle = css`
69
68
 
70
69
  export const CTABannerHeadingSubtitle = css`
71
70
  color: #3c3c43;
72
- font-size: 46px;
73
- font-weight: 600;
71
+ font-weight: var(--xyd-font-weight-semibold);
74
72
  text-align: center;
75
73
  `;
76
74
 
@@ -14,8 +14,5 @@ export const FooterContainer = css`
14
14
  `;
15
15
 
16
16
  export const FooterTextContainer = css`
17
- line-height: 24px;
18
- font-size: 14px;
19
- font-weight: 500;
20
17
  color: rgba(60, 60, 67, .78);
21
18
  `;
@@ -1,47 +1,149 @@
1
- import {css} from "@linaria/core";
1
+ import { css } from "@linaria/core";
2
2
 
3
- export const MarkHost = css`
4
- display: flex;
5
- border-left-width: 4px;
6
- border-color: transparent;
7
- margin: 4px 0;
3
+ export const LineNumberHost = css`
4
+ @layer defaults {
5
+ display: flex;
6
+ position: relative;
7
+
8
+ [part="line-number"] {
9
+ /* margin: 0 12px 0px 4px; */
10
+ width: 25px;
11
+ left: -15px;
12
+ position: absolute;
13
+ margin: 0;
14
+ text-align: right;
15
+ user-select: none;
16
+ opacity: 0.5;
17
+ }
18
+ }
8
19
  `;
9
20
 
10
- export const MarkLine = css`
11
- flex: 1 1 0%;
12
- `;
21
+ export const MarkHost = css`
22
+ @layer defaults {
23
+ display: flex;
24
+ border-left-width: 4px;
25
+ border-color: transparent;
26
+ margin: 4px 0;
13
27
 
14
- export const MarkAnnotated = css`
15
- border-color: #60A5FA;
16
- background-color: #EEF2FF;
17
- `;
28
+ &[data-annotated="true"] {
29
+ border-color: var(--xyd-coder-code-mark-border-color);
30
+ background-color: var(--xyd-coder-code-mark-bgcolor);
31
+ }
18
32
 
19
- export const LineNumberHost = css`
20
- margin: 0 12px 0px 4px;
21
- //text-align: right;
22
- user-select: none;
23
- opacity: 0.5;
33
+ &[data-diff="true"] {
34
+ position: relative;
35
+
36
+ &[data-query="-"] {
37
+ border-color: var(--xyd-text-color--error--active);
38
+ background-color: var(--xyd-text-color--error--muted);
39
+ }
40
+
41
+ &[data-query="+"] {
42
+ border-color: var(--xyd-text-color--success--active);
43
+ background-color: var(--xyd-text-color--success--muted);
44
+ }
45
+
46
+ & > :first-child {
47
+ position: absolute;
48
+ left: 5px;
49
+ }
50
+ }
51
+
52
+ [part="line"] {
53
+ flex: 1 1 0%;
54
+ }
55
+
56
+ xyd-code-linenumber [part="line"]{
57
+ position: relative;
58
+ left: 25px;
59
+ }
60
+ }
24
61
  `;
25
62
 
63
+ export const MarkInlineHost = css`
64
+ @layer defaults {
65
+ display: inline-block;
66
+
67
+ outline: solid 1px var(--xyd-coder-code-mark-border-color);
68
+ background: var(--xyd-coder-code-mark-bgcolor);
69
+
70
+
71
+ &[data-diff="true"] {
72
+ &[data-query="-"] {
73
+ border-color: var(--xyd-text-color--error--active);
74
+ background-color: var(--xyd-text-color--error--muted);
75
+ }
76
+
77
+ &[data-query="+"] {
78
+ border-color: var(--xyd-text-color--success--active);
79
+ background-color: var(--xyd-text-color--success--muted);
80
+ }
81
+ }
82
+ }
83
+ `
84
+
85
+ export const BgHost = css`
86
+ @layer defaults {
87
+ &[data-annotated="true"] {
88
+ border-color: var(--xyd-coder-code-mark-border-color);
89
+ background-color: var(--xyd-coder-code-mark-bgcolor);
90
+ }
91
+ }
92
+ `
93
+
26
94
  export const CodeHost = css`
27
- max-height: 400px;
28
- background: linear-gradient(45deg, rgb(247, 247, 248) 0%, rgb(247, 247, 248) 100%) !important;
95
+ @layer defaults {
96
+ max-height: 400px;
97
+ background: var(--xyd-coder-code-background); // cuz can be overwritten by style - better solution in the future?
98
+
99
+ margin: 0;
100
+ padding: 8px 16px;
29
101
 
30
- margin: 0;
31
- padding: 8px 16px;
102
+ border-top: 1px solid var(--xyd-coder-code-border-color);
103
+
104
+ &:not(:has(+ [part="code-description"])) {
105
+ border-bottom-left-radius: 10px;
106
+ border-bottom-right-radius: 10px;
107
+ }
32
108
 
33
- border-top: 1px solid rgb(236, 236, 241);
34
- border-bottom-left-radius: 10px;
35
- border-bottom-right-radius: 10px;
109
+ white-space: pre-wrap;
110
+ word-break: break-all;
36
111
 
37
- font-size: 12px;
38
- line-height: 20px;
39
- white-space: pre-wrap;
40
- word-break: break-all;
112
+ overflow-y: scroll;
41
113
 
42
- overflow-y: scroll;
114
+ &[data-size="full"] {
115
+ max-height: 100%;
116
+ }
117
+
118
+ & > div {
119
+ }
120
+ }
43
121
  `;
44
122
 
45
- export const CodeHostFull = css`
46
- max-height: 100%;
47
- `;
123
+
124
+ export const CodeDescription = css`
125
+ padding: 17px 20px 10px;
126
+ background-color: var(--white);
127
+ border-radius: 0 0 8px 7px;
128
+ display: flex;
129
+ gap: 12px;
130
+ align-items: flex-start;
131
+ color: var(--text-primary);
132
+
133
+ & > div:first-child {
134
+ display: flex;
135
+ align-items: center;
136
+ padding-top: 5px;
137
+ }
138
+
139
+ & > div:last-child {
140
+ display: flex;
141
+ flex-direction: column;
142
+ gap: 4px;
143
+
144
+ > span {
145
+ display: flex;
146
+ align-items: center;
147
+ }
148
+ }
149
+ `
@@ -1,76 +1,167 @@
1
- import React, {Suspense} from "react";
2
- import type {HighlightedCode, AnnotationHandler} from "codehike/code";
3
- import {InnerLine, Pre} from "codehike/code";
4
- import {Theme} from "@code-hike/lighter";
1
+ import React, { Suspense } from "react";
2
+ import type { HighlightedCode, AnnotationHandler } from "codehike/code";
3
+ import { InnerLine, Pre } from "codehike/code";
4
+ import { Theme } from "@code-hike/lighter";
5
5
 
6
- import {CodeTheme, type CodeThemeBlockProps} from "../CodeTheme";
6
+ import { Text } from "../../writer/Text"
7
+ import { CodeTheme, type CodeThemeBlockProps } from "../CodeTheme";
7
8
  import * as cn from "./Code.styles";
8
- import {CodeLoader} from "./CodeLoader";
9
+ import { CodeLoader } from "./CodeLoader";
10
+ import { Icon } from "src/writer/Icon";
9
11
 
10
12
  export interface CodeProps {
11
- codeblocks: CodeThemeBlockProps[];
13
+ codeblocks?: CodeThemeBlockProps[];
12
14
  theme?: Theme
13
15
  children: React.ReactNode
14
16
  }
15
17
 
16
18
  export function Code(props: CodeProps) {
17
- return <Suspense fallback={<CodeLoader/>}>
18
- <CodeTheme codeblocks={props.codeblocks} theme={props.theme}>
19
+ return <Suspense fallback={<CodeLoader />}>
20
+ <CodeTheme
21
+ codeblocks={props.codeblocks}
22
+ theme={props.theme}
23
+ >
19
24
  {props.children}
20
25
  </CodeTheme>
21
26
  </Suspense>
22
27
  }
23
28
 
24
29
  // TODO: fix any
25
- Code.LineNumber = function LineNumber(props: any) {
30
+ Code.LineNumber = function CodeLineNumber(props: any) {
26
31
  if (!props.children || !props.children.length) {
27
32
  return null
28
33
  }
29
34
  return (
30
- <>
31
- <span
32
- style={{minWidth: `${props.width}ch`}}
35
+ <xyd-code-linenumber
33
36
  className={cn.LineNumberHost}
37
+ style={{ minWidth: `${props.width}ch` }}
34
38
  >
35
- {props.lineNumber}
36
- </span>
37
- <InnerLine merge={props}/>
38
- </>
39
+ <span part="line-number">
40
+ {props.lineNumber}
41
+ </span>
42
+ <InnerLine merge={props} />
43
+ </xyd-code-linenumber>
39
44
  )
40
45
  }
41
46
 
42
47
  // TODO: fix any
43
- Code.Mark = function Mark(props: any) {
44
- return <div className={`${cn.MarkHost} ${props.annotation && cn.MarkAnnotated}`}>
48
+ Code.Mark = function CodeMark(props: any) {
49
+ return <xyd-code-mark
50
+ data-diff={props.annotation?.diff ? "true" : undefined}
51
+ data-query={props.annotation?.diff && props.annotation?.query ? props.annotation?.query : undefined}
52
+ data-annotated={String(!!props.annotation)}
53
+ className={`${cn.MarkHost}`}
54
+ >
45
55
  <InnerLine
56
+ part="line"
46
57
  merge={props}
47
- className={cn.MarkLine}
48
58
  />
49
- </div>
59
+ </xyd-code-mark>
60
+ }
61
+
62
+ Code.MarkInline = function CodeMarkInline(props: any) {
63
+ return (
64
+ <xyd-code-mark-inline
65
+ data-diff={props.annotation?.diff ? "true" : undefined}
66
+ data-query={props.annotation?.diff && props.annotation?.query ? props.annotation?.query : undefined}
67
+ className={cn.MarkInlineHost}
68
+ >
69
+ {props.children}
70
+ </xyd-code-mark-inline>
71
+ )
50
72
  }
51
73
 
52
74
  // TODO: fix any
53
75
  Code.Bg = function CodeLine(props: any) {
54
- return <span className={`${props.annotation && cn.MarkAnnotated}`}>
76
+ return <xyd-code-bg
77
+ data-annotated={String(!!props.annotation)}
78
+ className={`${cn.BgHost}`}
79
+ >
55
80
  {props.children}
56
- </span>
81
+ </xyd-code-bg>
57
82
  }
58
83
 
59
84
  Code.Pre = function CodePre(props: {
60
- codeblock: HighlightedCode,
61
- size?: "full",
62
- handlers: AnnotationHandler[],
63
- className?: string,
64
- }
85
+ codeblock: HighlightedCode,
86
+ size?: "full",
87
+ handlers: AnnotationHandler[],
88
+ className?: string,
89
+ descriptionHead?: string | React.ReactNode,
90
+ descriptionContent?: string | React.ReactNode,
91
+ descriptionIcon?: string
92
+ }
65
93
  ) {
66
- return <Pre
67
- className={`
68
- ${cn.CodeHost}
69
- ${props?.size === "full" && cn.CodeHostFull}
70
- ${props.className}
71
- `}
72
- style={props.codeblock?.style || props.codeblock?.style}
73
- code={props.codeblock}
74
- handlers={props.handlers}
75
- />
94
+ const {
95
+ size,
96
+ className,
97
+ codeblock,
98
+ handlers,
99
+ } = props;
100
+
101
+ fixLastToken(codeblock)
102
+
103
+ let description: React.ReactNode | null = null
104
+
105
+ if (props.descriptionHead || props.descriptionContent) {
106
+ description = <div part="code-description" className={cn.CodeDescription}>
107
+ <div>
108
+ {props.descriptionIcon ? <Icon name={props.descriptionIcon} size={16} /> : <_DefaultDescriptionIcon />}
109
+ </div>
110
+
111
+ <div>
112
+ <Text weight="bold">
113
+ {props.descriptionHead}
114
+ </Text>
115
+ <span>
116
+ {props.descriptionContent}
117
+ </span>
118
+ </div>
119
+ </div>
120
+
121
+ }
122
+ return <xyd-code-pre>
123
+ <Pre
124
+ part="pre"
125
+ data-size={size}
126
+ style={codeblock?.style || codeblock?.style}
127
+ className={`${cn.CodeHost} ${className || ""}`}
128
+ code={codeblock}
129
+ handlers={handlers}
130
+ />
131
+
132
+ {description}
133
+ </xyd-code-pre>
134
+ }
135
+
136
+ /**
137
+ * FOR SOME REASONS FOR SINGLE CODE BLOCKS LAST TOKEN IS EMPTY STRING
138
+ *
139
+ * @todo: fix this
140
+ */
141
+ function fixLastToken(codeblock: HighlightedCode) {
142
+ const lastToken = codeblock.tokens[codeblock.tokens.length - 1]
143
+ if (typeof lastToken === 'string' && (lastToken === ' ' || lastToken === '\n')) {
144
+ codeblock.tokens.pop()
145
+ }
146
+ }
147
+
148
+ function _DefaultDescriptionIcon() {
149
+ return <svg
150
+ xmlns="http://www.w3.org/2000/svg"
151
+ viewBox="0 0 24 24"
152
+ strokeWidth={3}
153
+ stroke="currentColor"
154
+ fill="none"
155
+ width={16}
156
+ strokeLinecap="round"
157
+ strokeLinejoin="round"
158
+ >
159
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
160
+ <path d="M12 12l8 -4.5" />
161
+ <path d="M12 12v9" />
162
+ <path d="M12 12l-8 -4.5" />
163
+ <path d="M12 12l8 4.5" />
164
+ <path d="M12 3v9" />
165
+ <path d="M12 12l-8 4.5" />
166
+ </svg>
76
167
  }
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
 
3
3
  import * as cn from "./Code.styles";
4
- import {Loader} from "../../ui";
4
+ import {Loader} from "../../kit";
5
5
 
6
6
  export function CodeLoader() {
7
- return <div className={cn.CodeHost}>
7
+ return <xyd-code-loader className={cn.CodeHost}>
8
8
  <Loader/>
9
- </div>
9
+ </xyd-code-loader>
10
10
  }
@@ -1,31 +1,51 @@
1
1
  import React from "react";
2
- import {AnnotationHandler} from "codehike/code";
2
+ import { AnnotationHandler, BlockAnnotation, InnerLine } from "codehike/code";
3
3
 
4
- import {Code} from "./Code";
4
+ import { Code } from "./Code";
5
5
 
6
6
  const markAnnotation: AnnotationHandler = {
7
7
  name: "mark",
8
8
  Line: (props) => {
9
- return <Code.Mark {...props}/>
10
- }
9
+ return <Code.Mark {...props} />
10
+ },
11
+ Inline: (props) => {
12
+ return <Code.MarkInline {...props} />
13
+ },
11
14
  }
12
15
 
13
16
  const bgAnnotation: AnnotationHandler = {
14
17
  name: "bg",
15
18
  Inline: (props) => {
16
- return <Code.Bg {...props}/>
19
+ return <Code.Bg {...props} />
17
20
  }
18
21
  }
19
22
 
20
23
  const lineNumberAnnotation: AnnotationHandler = {
21
24
  name: "line-numbers",
22
- Line: ({annotation, ...props}) => {
23
- return <Code.LineNumber {...props}/>
25
+ Line: ({ annotation, ...props }) => {
26
+ return <Code.LineNumber {...props} />
27
+ },
28
+ }
29
+
30
+ export const diffAnnotation: AnnotationHandler = {
31
+ name: "diff",
32
+ onlyIfAnnotated: true,
33
+ transform: (annotation: BlockAnnotation) => {
34
+ return [annotation, { ...annotation, name: "mark", query: annotation.query, diff: true }]
24
35
  },
36
+ Line: ({ annotation, ...props }) => (
37
+ <>
38
+ <div>
39
+ {annotation?.query}
40
+ </div>
41
+ <InnerLine merge={props} />
42
+ </>
43
+ ),
25
44
  }
26
45
 
27
46
  export const annotations = {
28
47
  mark: markAnnotation,
29
48
  bg: bgAnnotation,
30
- lineNumbers: lineNumberAnnotation
49
+ lineNumbers: lineNumberAnnotation,
50
+ diff: diffAnnotation
31
51
  }
@@ -7,6 +7,7 @@ import {
7
7
  import {
8
8
  type Lines,
9
9
  type Tokens,
10
+ highlight as lighterAsync,
10
11
  highlightSync as lighter,
11
12
  LANG_NAMES,
12
13
  type Theme
@@ -57,6 +58,43 @@ export function highlight(
57
58
  };
58
59
  }
59
60
 
61
+ export async function highlightAsync(
62
+ data: RawCode,
63
+ theme: Theme,
64
+ lang: string
65
+ ): Promise<HighlightedCode> {
66
+ if (!LANG_NAMES.includes(lang)) {
67
+ console.warn(`Unknown language "${lang}"`);
68
+ lang = 'txt';
69
+ }
70
+
71
+ const {
72
+ lines,
73
+ lang: lighterLang,
74
+ style
75
+ } = await lighterAsync(data.value, lang, theme as any, {
76
+ annotations: [],
77
+ scopes: false // true for better token transitions, but breaks css themes
78
+ });
79
+
80
+ const tokens = joinLines(lines);
81
+ // split surrounding whitespace for each token
82
+ const splitTokens = splitWhitespace(tokens);
83
+ // join consecutive whitespace tokens
84
+ const joinedTokens = joinWhitespace(splitTokens);
85
+
86
+ return {
87
+ ...data,
88
+ code: data.value,
89
+ tokens: joinedTokens,
90
+ lang: lighterLang,
91
+ annotations: [], // TODO: in the future
92
+ // annotations: compatAnnotations(annotations),
93
+ themeName: typeof theme === 'string' ? theme : theme?.name || 'unknown',
94
+ style
95
+ };
96
+ }
97
+
60
98
  function compatAnnotations(annotations: any[]): CodeAnnotation[] {
61
99
  const newAnnotations: CodeAnnotation[] = [];
62
100
  for (const a of annotations) {
@@ -11,5 +11,6 @@ export {
11
11
  CodeLoader,
12
12
  } from "./CodeLoader"
13
13
  export {
14
- highlight
14
+ highlight,
15
+ highlightAsync
15
16
  } from "./highlight"