react-lib-tools 0.0.3 → 0.0.4

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.
@@ -1,18 +1,14 @@
1
1
  import { AnchorHTMLAttributes } from 'react';
2
2
  import { ClassValue } from 'clsx';
3
- import { ComponentMetadata } from '../types';
4
3
  import { ComponentType } from 'react';
5
4
  import { CSSProperties } from 'react';
6
5
  import { HTMLAttributes } from 'react';
7
- import { ImperativeHandleMetadata } from '../types';
8
6
  import { InputHTMLAttributes } from 'react';
9
- import { Intent } from '../types';
10
7
  import { JSX } from 'react/jsx-runtime';
11
8
  import { LazyExoticComponent } from 'react';
12
9
  import { MouseEvent as MouseEvent_2 } from 'react';
13
10
  import { PropsWithChildren } from 'react';
14
11
  import { ReactNode } from 'react';
15
- import { Section } from '../types';
16
12
 
17
13
  export declare function AppRoot({ hideVersions, navLinks, packageDescription, packageName, routes }: {
18
14
  hideVersions?: boolean | undefined;
@@ -69,7 +65,21 @@ export declare function Code({ className, html }: {
69
65
  html: string;
70
66
  }): JSX.Element;
71
67
 
72
- export { ComponentMetadata }
68
+ export declare type ComponentMetadata = {
69
+ description: Section[];
70
+ filePath: string;
71
+ name: string;
72
+ props: {
73
+ [name: string]: ComponentPropMetadata;
74
+ };
75
+ };
76
+
77
+ declare type ComponentPropMetadata = {
78
+ description: Section[];
79
+ html: string;
80
+ name: string;
81
+ required: boolean;
82
+ };
73
83
 
74
84
  export declare function ComponentProps({ json, section }: {
75
85
  json: ComponentMetadata;
@@ -95,7 +105,18 @@ export declare function ImperativeHandle({ json, section }: {
95
105
  section: string;
96
106
  }): JSX.Element;
97
107
 
98
- export { ImperativeHandleMetadata }
108
+ export declare type ImperativeHandleMetadata = {
109
+ description: Section[];
110
+ filePath: string;
111
+ name: string;
112
+ methods: ImperativeHandleMethodMetadata[];
113
+ };
114
+
115
+ declare type ImperativeHandleMethodMetadata = {
116
+ description: Section[];
117
+ html: string;
118
+ name: string;
119
+ };
99
120
 
100
121
  export declare function Input<Type extends string>({ children, className, onChange, value, ...rest }: PropsWithChildren<Omit<InputHTMLAttributes<HTMLInputElement>, "onChange"> & {
101
122
  className?: string | undefined;
@@ -103,7 +124,7 @@ export declare function Input<Type extends string>({ children, className, onChan
103
124
  value: Type;
104
125
  }>): JSX.Element;
105
126
 
106
- export { Intent }
127
+ export declare type Intent = "danger" | "none" | "primary" | "success" | "warning";
107
128
 
108
129
  export declare function Link({ children, onClick, to, ...rest }: Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
109
130
  children?: ReactNode | RenderFunction;
@@ -139,7 +160,10 @@ declare type RenderFunction = (params: {
139
160
  isPending: boolean;
140
161
  }) => ReactNode;
141
162
 
142
- export { Section }
163
+ export declare type Section = {
164
+ content: string;
165
+ intent?: Intent | undefined;
166
+ };
143
167
 
144
168
  export declare function Select<Value extends string>({ className, defaultValue, onChange, options, placeholder, value }: {
145
169
  className?: string;
package/lib/types.ts ADDED
@@ -0,0 +1,35 @@
1
+ export type Intent = "danger" | "none" | "primary" | "success" | "warning";
2
+
3
+ export type Section = {
4
+ content: string;
5
+ intent?: Intent | undefined;
6
+ };
7
+
8
+ export type ComponentPropMetadata = {
9
+ description: Section[];
10
+ html: string;
11
+ name: string;
12
+ required: boolean;
13
+ };
14
+
15
+ export type ComponentMetadata = {
16
+ description: Section[];
17
+ filePath: string;
18
+ name: string;
19
+ props: {
20
+ [name: string]: ComponentPropMetadata;
21
+ };
22
+ };
23
+
24
+ export type ImperativeHandleMethodMetadata = {
25
+ description: Section[];
26
+ html: string;
27
+ name: string;
28
+ };
29
+
30
+ export type ImperativeHandleMetadata = {
31
+ description: Section[];
32
+ filePath: string;
33
+ name: string;
34
+ methods: ImperativeHandleMethodMetadata[];
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-lib-tools",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
6
6
  "contributors": [
@@ -16,6 +16,7 @@
16
16
  "types": "dist/react-lib-tools.d.ts",
17
17
  "files": [
18
18
  "dist",
19
+ "lib/types.ts",
19
20
  "scripts",
20
21
  "styles.css"
21
22
  ],
@@ -2,7 +2,7 @@ import { writeFile } from "node:fs/promises";
2
2
  import { join, relative } from "node:path";
3
3
  import { cwd } from "node:process";
4
4
  import { type FileParser, type PropItem } from "react-docgen-typescript";
5
- import type { ComponentMetadata } from "../../../types.ts";
5
+ import type { ComponentMetadata } from "../../../lib/types.ts";
6
6
  import { assert } from "../assert.ts";
7
7
  import { syntaxHighlight } from "../syntax-highlight.ts";
8
8
  import { getPropTypeText } from "./getPropTypeText.ts";
@@ -2,7 +2,7 @@ import type { InterfaceNode } from "@ts-ast-parser/core";
2
2
  import assert from "node:assert";
3
3
  import { writeFile } from "node:fs/promises";
4
4
  import { join } from "path";
5
- import type { ImperativeHandleMetadata } from "../../../types.ts";
5
+ import type { ImperativeHandleMetadata } from "../../../lib/types.ts";
6
6
  import { syntaxHighlight } from "../syntax-highlight.ts";
7
7
  import { parseDescription } from "./parseDescription.ts";
8
8
 
@@ -1,4 +1,4 @@
1
- import type { Intent, Section } from "../../../types.ts";
1
+ import type { Intent, Section } from "../../../lib/types.ts";
2
2
  import { syntaxHighlight, type Language } from "../syntax-highlight.ts";
3
3
  import { formatDescriptionText } from "./formatDescriptionText.ts";
4
4