@hubspot/ui-extensions-sdk-api-metadata 0.11.6 → 0.12.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/README.md +43 -16
- package/dist/__generated__/component-props.js +1062 -143
- package/dist/__tests__/component-props-docs.spec.d.ts +1 -0
- package/dist/__tests__/component-props-docs.spec.js +14 -0
- package/dist/component-props-docs.d.ts +8 -0
- package/dist/component-props-docs.js +115 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/internal/get-type-source.d.ts +15 -0
- package/dist/internal/get-type-source.js +27 -0
- package/dist/internal/render-prop-type.d.ts +31 -0
- package/dist/internal/render-prop-type.js +213 -0
- package/dist/internal/utils/html-utils.d.ts +7 -0
- package/dist/internal/utils/html-utils.js +18 -0
- package/dist/internal/utils/jsdoc-utils.d.ts +29 -0
- package/dist/internal/utils/jsdoc-utils.js +52 -0
- package/dist/internal/utils/markdown-utils.d.ts +7 -0
- package/dist/internal/utils/markdown-utils.js +14 -0
- package/dist/types.d.ts +39 -0
- package/dist/types.js +9 -0
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@hubspot/ui-extensions-sdk-api-metadata)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
This package provides
|
|
6
|
+
This package provides structured component props documentation for the [HubSpot UI Extensions SDK](https://www.npmjs.com/package/@hubspot/ui-extensions). It extracts TypeScript type information from SDK components and converts it into a documentation-friendly format with rendered HTML suitable for embedding in documentation sites.
|
|
7
7
|
|
|
8
8
|
## ⚠️ Internal Use Only
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ This package provides machine-readable API metadata for the [HubSpot UI Extensio
|
|
|
11
11
|
|
|
12
12
|
## Purpose
|
|
13
13
|
|
|
14
|
-
This package
|
|
14
|
+
This package serves as a data source for documentation generation tools, providing structured documentation for component props including type information, descriptions, default values, and related links.
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -22,27 +22,54 @@ npm install @hubspot/ui-extensions-sdk-api-metadata
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
import {
|
|
26
|
+
getComponentPropsDocumentation,
|
|
27
|
+
ComponentName,
|
|
28
|
+
} from '@hubspot/ui-extensions-sdk-api-metadata';
|
|
29
|
+
|
|
30
|
+
// Get documentation for a specific component's props
|
|
31
|
+
const accordionPropsDocs = getComponentPropsDocumentation(
|
|
32
|
+
ComponentName.Accordion
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Each prop documentation includes:
|
|
36
|
+
accordionPropsDocs.forEach((propDoc) => {
|
|
37
|
+
console.log(propDoc.name); // Prop name (e.g., "open")
|
|
38
|
+
console.log(propDoc.required); // Whether the prop is required
|
|
39
|
+
console.log(propDoc.typeJsx); // Type as JSX string (e.g., "<><code>boolean</code></>")
|
|
40
|
+
console.log(propDoc.descriptionJsx); // Description as JSX string
|
|
41
|
+
console.log(propDoc.defaultValueJsx); // Optional default value as JSX string
|
|
42
|
+
console.log(propDoc.seeJsxItems); // Optional array of related links as JSX strings
|
|
30
43
|
});
|
|
31
|
-
|
|
32
|
-
// Look up a referenced type by its ID
|
|
33
|
-
const referencedType = componentPropsReader.findReferencedTypeById(typeId);
|
|
34
44
|
```
|
|
35
45
|
|
|
36
46
|
## API
|
|
37
47
|
|
|
38
|
-
|
|
48
|
+
### `getComponentPropsDocumentation(componentName: ComponentName): ComponentPropDocumentation[]`
|
|
49
|
+
|
|
50
|
+
Retrieves structured documentation for all props of the specified component.
|
|
51
|
+
|
|
52
|
+
**Parameters:**
|
|
53
|
+
- `componentName` - The component to get documentation for (from the `ComponentName` enum)
|
|
54
|
+
|
|
55
|
+
**Returns:** An array of `ComponentPropDocumentation` objects, sorted with required props first, then alphabetically by name.
|
|
56
|
+
|
|
57
|
+
### `ComponentPropDocumentation`
|
|
58
|
+
|
|
59
|
+
Interface for component prop documentation:
|
|
60
|
+
|
|
61
|
+
| Property | Type | Description |
|
|
62
|
+
|----------|------|-------------|
|
|
63
|
+
| `name` | `string` | The name of the prop |
|
|
64
|
+
| `required` | `boolean` | Whether the prop is required |
|
|
65
|
+
| `typeJsx` | `string` | The type rendered as JSX-embeddable HTML |
|
|
66
|
+
| `descriptionJsx` | `string` | The description rendered as JSX-embeddable HTML |
|
|
67
|
+
| `defaultValueJsx?` | `string` | Optional default value rendered as JSX-embeddable HTML |
|
|
68
|
+
| `seeJsxItems?` | `string[]` | Optional array of related links rendered as JSX-embeddable HTML |
|
|
39
69
|
|
|
40
|
-
|
|
41
|
-
|--------|-------------|
|
|
42
|
-
| `findExportByName(options)` | Finds an export by its name and path |
|
|
43
|
-
| `findReferencedTypeById(typeId)` | Finds a referenced type by its unique identifier |
|
|
70
|
+
### `ComponentName`
|
|
44
71
|
|
|
45
|
-
|
|
72
|
+
Enum of available component names in the SDK (e.g., `ComponentName.Accordion`).
|
|
46
73
|
|
|
47
74
|
## Related Packages
|
|
48
75
|
|