@fumadocs/ui 16.2.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 (68) hide show
  1. package/LICENSE +21 -0
  2. package/css/base.css +217 -0
  3. package/css/colors/black.css +39 -0
  4. package/css/colors/catppuccin.css +49 -0
  5. package/css/colors/dusk.css +47 -0
  6. package/css/colors/index.css +51 -0
  7. package/css/colors/neutral.css +7 -0
  8. package/css/colors/ocean.css +48 -0
  9. package/css/colors/purple.css +39 -0
  10. package/css/colors/shadcn.css +36 -0
  11. package/css/colors/solar.css +75 -0
  12. package/css/colors/vitepress.css +77 -0
  13. package/css/shiki.css +90 -0
  14. package/dist/cn.d.ts +2 -0
  15. package/dist/cn.d.ts.map +1 -0
  16. package/dist/cn.js +1 -0
  17. package/dist/components/toc/clerk.d.ts +3 -0
  18. package/dist/components/toc/clerk.d.ts.map +1 -0
  19. package/dist/components/toc/clerk.js +76 -0
  20. package/dist/components/toc/default.d.ts +3 -0
  21. package/dist/components/toc/default.d.ts.map +1 -0
  22. package/dist/components/toc/default.js +19 -0
  23. package/dist/components/toc/index.d.ts +11 -0
  24. package/dist/components/toc/index.d.ts.map +1 -0
  25. package/dist/components/toc/index.js +64 -0
  26. package/dist/contexts/i18n.d.ts +50 -0
  27. package/dist/contexts/i18n.d.ts.map +1 -0
  28. package/dist/contexts/i18n.js +55 -0
  29. package/dist/contexts/search.d.ts +61 -0
  30. package/dist/contexts/search.d.ts.map +1 -0
  31. package/dist/contexts/search.js +59 -0
  32. package/dist/contexts/tree.d.ts +15 -0
  33. package/dist/contexts/tree.d.ts.map +1 -0
  34. package/dist/contexts/tree.js +32 -0
  35. package/dist/hooks/use-copy-button.d.ts +3 -0
  36. package/dist/hooks/use-copy-button.d.ts.map +1 -0
  37. package/dist/hooks/use-copy-button.js +27 -0
  38. package/dist/hooks/use-footer-items.d.ts +6 -0
  39. package/dist/hooks/use-footer-items.d.ts.map +1 -0
  40. package/dist/hooks/use-footer-items.js +27 -0
  41. package/dist/hooks/use-is-scroll-top.d.ts +4 -0
  42. package/dist/hooks/use-is-scroll-top.d.ts.map +1 -0
  43. package/dist/hooks/use-is-scroll-top.js +17 -0
  44. package/dist/i18n.d.ts +14 -0
  45. package/dist/i18n.d.ts.map +1 -0
  46. package/dist/i18n.js +16 -0
  47. package/dist/icons.d.ts +49 -0
  48. package/dist/icons.d.ts.map +1 -0
  49. package/dist/icons.js +281 -0
  50. package/dist/link-item.d.ts +78 -0
  51. package/dist/link-item.d.ts.map +1 -0
  52. package/dist/link-item.js +12 -0
  53. package/dist/merge-refs.d.ts +3 -0
  54. package/dist/merge-refs.d.ts.map +1 -0
  55. package/dist/merge-refs.js +12 -0
  56. package/dist/og/next.d.ts +15 -0
  57. package/dist/og/next.d.ts.map +1 -0
  58. package/dist/og/next.js +45 -0
  59. package/dist/typography/index.d.ts +10 -0
  60. package/dist/typography/index.d.ts.map +1 -0
  61. package/dist/typography/index.js +137 -0
  62. package/dist/typography/styles.d.ts +93 -0
  63. package/dist/typography/styles.d.ts.map +1 -0
  64. package/dist/typography/styles.js +433 -0
  65. package/dist/urls.d.ts +6 -0
  66. package/dist/urls.d.ts.map +1 -0
  67. package/dist/urls.js +13 -0
  68. package/package.json +75 -0
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ImageResponse } from 'next/og';
3
+ export function generateOGImage(options) {
4
+ const { title, description, icon, site, primaryColor, primaryTextColor, ...rest } = options;
5
+ return new ImageResponse(generate({
6
+ title,
7
+ description,
8
+ icon,
9
+ site,
10
+ primaryTextColor,
11
+ primaryColor,
12
+ }), {
13
+ width: 1200,
14
+ height: 630,
15
+ ...rest,
16
+ });
17
+ }
18
+ export function generate({ primaryColor = 'rgba(255,150,255,0.3)', primaryTextColor = 'rgb(255,150,255)', ...props }) {
19
+ return (_jsxs("div", { style: {
20
+ display: 'flex',
21
+ flexDirection: 'column',
22
+ width: '100%',
23
+ height: '100%',
24
+ color: 'white',
25
+ padding: '4rem',
26
+ backgroundColor: '#0c0c0c',
27
+ backgroundImage: `linear-gradient(to top right, ${primaryColor}, transparent)`,
28
+ }, children: [_jsxs("div", { style: {
29
+ display: 'flex',
30
+ flexDirection: 'row',
31
+ alignItems: 'center',
32
+ gap: '16px',
33
+ marginBottom: '12px',
34
+ color: primaryTextColor,
35
+ }, children: [props.icon, _jsx("p", { style: {
36
+ fontSize: '56px',
37
+ fontWeight: 600,
38
+ }, children: props.site })] }), _jsx("p", { style: {
39
+ fontWeight: 800,
40
+ fontSize: '82px',
41
+ }, children: props.title }), _jsx("p", { style: {
42
+ fontSize: '52px',
43
+ color: 'rgba(240,240,240,0.8)',
44
+ }, children: props.description })] }));
45
+ }
@@ -0,0 +1,10 @@
1
+ export interface Options {
2
+ className?: string;
3
+ /**
4
+ * Disable custom table styles
5
+ */
6
+ disableRoundedTable?: boolean;
7
+ }
8
+ export declare const typography: unknown;
9
+ export default typography;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typography/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,OAAO;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAmJD,eAAO,MAAM,UAAU,EAAE,OAsCxB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,137 @@
1
+ import * as styles from './styles.js';
2
+ import plugin from 'tailwindcss/plugin';
3
+ import merge from 'lodash.merge';
4
+ import parser from 'postcss-selector-parser';
5
+ function inWhere(selector, { className, prefix, modifier }) {
6
+ const prefixedNot = prefix(`.not-${className}`).slice(1);
7
+ const selectorPrefix = selector.startsWith('>')
8
+ ? `${modifier === 'DEFAULT' ? `.${className}` : `.${className}-${modifier}`} `
9
+ : '';
10
+ // Parse the selector, if every component ends in the same pseudo element(s) then move it to the end
11
+ const [trailingPseudo, rebuiltSelector] = commonTrailingPseudos(selector);
12
+ if (trailingPseudo) {
13
+ return `:where(${selectorPrefix}${rebuiltSelector}):not(:where([class~="${prefixedNot}"],[class~="${prefixedNot}"] *))${trailingPseudo}`;
14
+ }
15
+ return `:where(${selectorPrefix}${selector}):not(:where([class~="${prefixedNot}"],[class~="${prefixedNot}"] *))`;
16
+ }
17
+ function configToCss(config = {}, { className, modifier, prefix }) {
18
+ function updateSelector(k, v) {
19
+ if (Array.isArray(v)) {
20
+ return [k, v];
21
+ }
22
+ if (typeof v === 'object' && v !== null) {
23
+ const nested = Object.values(v).some((prop) => typeof prop === 'object');
24
+ if (nested) {
25
+ return [
26
+ inWhere(k, { className, modifier, prefix }),
27
+ v,
28
+ Object.fromEntries(Object.entries(v).map(([k, v]) => updateSelector(k, v))),
29
+ ];
30
+ }
31
+ return [inWhere(k, { className, modifier, prefix }), v];
32
+ }
33
+ return [k, v];
34
+ }
35
+ const css = config.css ?? [];
36
+ return Object.fromEntries(Object.entries(merge({}, ...(Array.isArray(css) ? css : [css]))).map(([k, v]) => updateSelector(k, v)));
37
+ }
38
+ const parseSelector = parser();
39
+ function commonTrailingPseudos(selector) {
40
+ const ast = parseSelector.astSync(selector);
41
+ const matrix = [];
42
+ // Put the pseudo elements in reverse order in a sparse, column-major 2D array
43
+ for (const [i, sel] of ast.nodes.entries()) {
44
+ for (const [j, child] of [...sel.nodes].reverse().entries()) {
45
+ // We only care about pseudo elements
46
+ if (child.type !== 'pseudo' || !child.value.startsWith('::')) {
47
+ break;
48
+ }
49
+ matrix[j] = matrix[j] || [];
50
+ matrix[j][i] = child;
51
+ }
52
+ }
53
+ const trailingPseudos = parser.selector({
54
+ value: '',
55
+ });
56
+ // At this point the pseudo elements are in a column-major 2D array
57
+ // This means each row contains one "column" of pseudo elements from each selector
58
+ // We can compare all the pseudo elements in a row to see if they are the same
59
+ for (const pseudos of matrix) {
60
+ // It's a sparse 2D array so there are going to be holes in the rows
61
+ // We skip those
62
+ if (!pseudos) {
63
+ continue;
64
+ }
65
+ const values = new Set(pseudos.map((p) => p.value));
66
+ // The pseudo elements are not the same
67
+ if (values.size > 1) {
68
+ break;
69
+ }
70
+ pseudos.forEach((pseudo) => pseudo.remove());
71
+ trailingPseudos.prepend(pseudos[0]);
72
+ }
73
+ if (trailingPseudos.nodes.length) {
74
+ return [trailingPseudos.toString(), ast.toString()];
75
+ }
76
+ return [null, selector];
77
+ }
78
+ const SELECTORS = [
79
+ ['headings', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'th'],
80
+ ['h1'],
81
+ ['h2'],
82
+ ['h3'],
83
+ ['h4'],
84
+ ['h5'],
85
+ ['h6'],
86
+ ['p'],
87
+ ['a'],
88
+ ['blockquote'],
89
+ ['figure'],
90
+ ['figcaption'],
91
+ ['strong'],
92
+ ['em'],
93
+ ['kbd'],
94
+ ['code'],
95
+ ['pre'],
96
+ ['ol'],
97
+ ['ul'],
98
+ ['li'],
99
+ ['table'],
100
+ ['thead'],
101
+ ['tr'],
102
+ ['th'],
103
+ ['td'],
104
+ ['img'],
105
+ ['video'],
106
+ ['hr'],
107
+ ['lead', '[class~="lead"]'],
108
+ ];
109
+ export const typography = plugin.withOptions(({ className = 'prose', ...styleOptions } = {}) => {
110
+ return ({ addVariant, addComponents, ...rest }) => {
111
+ const prefix = rest.prefix;
112
+ for (const [name, ...values] of SELECTORS) {
113
+ const selectors = values.length === 0 ? [name] : values;
114
+ const selector = selectors.join(', ');
115
+ addVariant(`${className}-${name}`, `& :is(${inWhere(selector, {
116
+ prefix,
117
+ className,
118
+ })})`);
119
+ }
120
+ addComponents({
121
+ [`.${className}`]: configToCss({
122
+ ...styles.DEFAULT,
123
+ css: [
124
+ ...(styles.DEFAULT.css ?? []),
125
+ styleOptions.disableRoundedTable
126
+ ? styles.normalTable
127
+ : styles.roundedTable,
128
+ ],
129
+ }, {
130
+ className,
131
+ modifier: 'DEFAULT',
132
+ prefix,
133
+ }),
134
+ });
135
+ };
136
+ });
137
+ export default typography;
@@ -0,0 +1,93 @@
1
+ export declare const roundedTable: {
2
+ table: {
3
+ borderCollapse: string;
4
+ borderSpacing: string;
5
+ background: string;
6
+ borderRadius: string;
7
+ border: string;
8
+ overflow: string;
9
+ };
10
+ th: {
11
+ textAlign: string;
12
+ padding: string;
13
+ 'border-inline-start': string;
14
+ background: string;
15
+ };
16
+ 'th:first-child': {
17
+ 'border-inline-start': string;
18
+ };
19
+ 'th:not(tr:last-child *), td:not(tr:last-child *)': {
20
+ 'border-bottom': string;
21
+ };
22
+ td: {
23
+ textAlign: string;
24
+ 'border-inline-start': string;
25
+ padding: string;
26
+ };
27
+ 'td:first-child': {
28
+ 'border-inline-start': string;
29
+ };
30
+ 'tfoot th, tfoot td': {
31
+ borderTopWidth: string;
32
+ borderTopColor: string;
33
+ };
34
+ 'thead th, thead td': {
35
+ borderBottomWidth: string;
36
+ borderBottomColor: string;
37
+ };
38
+ };
39
+ export declare const normalTable: {
40
+ thead: {
41
+ borderBottomWidth: string;
42
+ borderBottomColor: string;
43
+ };
44
+ 'thead th': {
45
+ verticalAlign: string;
46
+ paddingInlineEnd: string;
47
+ paddingBottom: string;
48
+ paddingInlineStart: string;
49
+ };
50
+ 'thead th:first-child': {
51
+ paddingInlineStart: string;
52
+ };
53
+ 'thead th:last-child': {
54
+ paddingInlineEnd: string;
55
+ };
56
+ 'tbody td, tfoot td': {
57
+ paddingTop: string;
58
+ paddingInlineEnd: string;
59
+ paddingBottom: string;
60
+ paddingInlineStart: string;
61
+ };
62
+ 'tbody td:first-child, tfoot td:first-child': {
63
+ paddingInlineStart: string;
64
+ };
65
+ 'tbody td:last-child, tfoot td:last-child': {
66
+ paddingInlineEnd: string;
67
+ };
68
+ 'tbody tr': {
69
+ borderBottomWidth: string;
70
+ borderBottomColor: string;
71
+ };
72
+ 'tbody tr:last-child': {
73
+ borderBottomWidth: string;
74
+ };
75
+ 'tbody td': {
76
+ verticalAlign: string;
77
+ };
78
+ tfoot: {
79
+ borderTopWidth: string;
80
+ borderTopColor: string;
81
+ };
82
+ 'tfoot td': {
83
+ verticalAlign: string;
84
+ };
85
+ 'th, td': {
86
+ textAlign: string;
87
+ };
88
+ };
89
+ export interface Config {
90
+ css?: Record<string, string | Record<string, string>>[];
91
+ }
92
+ export declare const DEFAULT: Config;
93
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/typography/styles.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCxB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDvB,CAAC;AAEF,MAAM,WAAW,MAAM;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;CACzD;AAED,eAAO,MAAM,OAAO,EAAE,MA+TrB,CAAC"}