Skip to content

Commit 8720a06

Browse files
committed
subtables, downgrade tailwind
1 parent 56caab1 commit 8720a06

File tree

3 files changed

+78
-57
lines changed

3 files changed

+78
-57
lines changed

package-lock.json

Lines changed: 28 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141
"dependencies": {
4242
"@actions/core": "^1.11.1",
4343
"@babel/generator": "^7.27.5",
44-
"@babel/types": "^7.27.6",
44+
"@babel/types": "^7.27.7",
4545
"@clack/prompts": "^0.11.0",
4646
"@heroicons/react": "^2.2.0",
4747
"@node-core/rehype-shiki": "1.0.1-6dcda98c94808919558c488d45925365b6558715",
48-
"@node-core/ui-components": "1.0.1-49d65845ae6ff8d53a36f08f2f6353edc12d9b2f",
48+
"@node-core/ui-components": "1.0.1-a0f03ae69979a5fea7c16262ff88cbeef11452c2",
4949
"@orama/orama": "^3.1.7",
5050
"@orama/plugin-data-persistence": "^3.1.7",
5151
"@orama/react-components": "^0.8.1",
52-
"@tailwindcss/postcss": "^4.1.10",
52+
"@tailwindcss/postcss": "4.1.10",
5353
"acorn": "^8.14.1",
5454
"commander": "^14.0.0",
5555
"dedent": "^1.6.0",
@@ -80,7 +80,7 @@
8080
"remark-stringify": "^11.0.0",
8181
"semver": "^7.7.1",
8282
"shiki": "^3.4.2",
83-
"tailwindcss": "^4.1.10",
83+
"tailwindcss": "^4.1.11",
8484
"unified": "^11.0.5",
8585
"unist-builder": "^4.0.0",
8686
"unist-util-find": "^3.0.0",

src/generators/jsx-ast/utils/createSignatureElements.mjs

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ const checkPossibleType = node =>
2222
/**
2323
* Gets a list of properties from a typed list
2424
* @param {import('mdast').List} node
25-
* @param {string} prefix
2625
*/
27-
export const parseListIntoProperties = (node, prefix = '') => {
26+
export const parseListIntoProperties = node => {
2827
const properties = [];
2928

3029
for (const item of node.children) {
@@ -34,9 +33,7 @@ export const parseListIntoProperties = (node, prefix = '') => {
3433
const [{ children }, ...otherChildren] = item.children;
3534

3635
if (children[0].type === 'inlineCode') {
37-
name = (
38-
prefix ? `${prefix}.${children.shift().value}` : children.shift().value
39-
).trimEnd();
36+
name = children.shift().value.trimEnd();
4037
} else if (children[0].value && children[0].value.startsWith('Returns')) {
4138
children.shift();
4239
name = 'Returns';
@@ -65,14 +62,12 @@ export const parseListIntoProperties = (node, prefix = '') => {
6562
children[0].value = children[0].value.trimStart();
6663
}
6764

68-
properties.push({ name, types, desc: children });
69-
70-
const sublist = otherChildren.find(createQueries.UNIST.isTypedList);
71-
if (sublist) {
72-
properties.push(
73-
...parseListIntoProperties(sublist, name === 'Returns' ? '_' : name)
74-
);
75-
}
65+
properties.push({
66+
name,
67+
types,
68+
desc: children,
69+
sublist: otherChildren.find(createQueries.UNIST.isTypedList),
70+
});
7671
}
7772

7873
return properties;
@@ -81,33 +76,19 @@ export const parseListIntoProperties = (node, prefix = '') => {
8176
/**
8277
* Creates a property table
8378
* @param {import('mdast').List} node
79+
* @param {boolean} withHeading
8480
* @returns {import('hast').Element}
8581
*/
86-
export const createPropertyTable = node => {
82+
export const createPropertyTable = (node, withHeading = true) => {
8783
const properties = parseListIntoProperties(node);
8884

8985
// Determine which columns to show based on data availability
9086
const hasName = properties.some(prop => prop.name);
9187
const hasType = properties.some(prop => prop.types.length > 0);
9288
const hasDesc = properties.some(prop => prop.desc.length > 0);
9389

94-
// Create table headers based on available data
95-
const headers = [];
96-
97-
if (hasName) {
98-
headers.push(createElement('th', 'Property'));
99-
}
100-
101-
if (hasType) {
102-
headers.push(createElement('th', 'Type'));
103-
}
104-
105-
if (hasDesc) {
106-
headers.push(createElement('th', 'Description'));
107-
}
108-
10990
// Create table rows
110-
const rows = properties.map(prop => {
91+
const rows = properties.flatMap(prop => {
11192
const cells = [];
11293

11394
if (hasName) {
@@ -128,16 +109,44 @@ export const createPropertyTable = node => {
128109
cells.push(createElement('td', prop.desc));
129110
}
130111

131-
return createElement('tr', cells);
112+
return prop.sublist
113+
? [
114+
createElement('tr', cells),
115+
createElement(
116+
'tr',
117+
createElement(
118+
'td',
119+
{ colspan: cells.length },
120+
createPropertyTable(prop.sublist, false)
121+
)
122+
),
123+
]
124+
: createElement('tr', cells);
132125
});
133126

134-
// Create the table element
135-
const table = createElement('table', [
136-
createElement('thead', [createElement('tr', headers)]),
137-
createElement('tbody', rows),
138-
]);
127+
if (withHeading) {
128+
// Create table headers based on available data
129+
const headers = [];
130+
131+
if (hasName) {
132+
headers.push(createElement('th', 'Property'));
133+
}
134+
135+
if (hasType) {
136+
headers.push(createElement('th', 'Type'));
137+
}
138+
139+
if (hasDesc) {
140+
headers.push(createElement('th', 'Description'));
141+
}
142+
143+
return createElement('table', [
144+
createElement('thead', [createElement('tr', headers)]),
145+
createElement('tbody', rows),
146+
]);
147+
}
139148

140-
return table;
149+
return createElement('table', createElement('tbody', rows));
141150
};
142151

143152
/**

0 commit comments

Comments
 (0)