@describe-me/react 0.3.0 → 0.4.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.
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
import { type ComponentInfo } from '@describe-me/core';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Pull the component name, its defining file when the plugin registered it,
|
|
5
|
+
* and JSON-safe props out of a React element.
|
|
6
|
+
*/
|
|
4
7
|
export declare function describeElement(ui: ReactElement): ComponentInfo;
|
package/dist/describe-element.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { serializeValue } from '@describe-me/core';
|
|
2
|
-
/**
|
|
1
|
+
import { describeComponentType, serializeValue } from '@describe-me/core';
|
|
2
|
+
/**
|
|
3
|
+
* Pull the component name, its defining file when the plugin registered it,
|
|
4
|
+
* and JSON-safe props out of a React element.
|
|
5
|
+
*/
|
|
3
6
|
export function describeElement(ui) {
|
|
4
|
-
const
|
|
5
|
-
const name = typeof type === 'string'
|
|
6
|
-
? type
|
|
7
|
-
: (type?.displayName ??
|
|
8
|
-
type?.name ??
|
|
9
|
-
'Anonymous');
|
|
7
|
+
const identity = describeComponentType(ui.type);
|
|
10
8
|
const props = serializeValue(ui.props ?? {});
|
|
11
|
-
return {
|
|
9
|
+
return { ...identity, props };
|
|
12
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@describe-me/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "React adapter for describe-me: drop-in render functions that record frames",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vitest",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"sideEffects": false,
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@describe-me/core": "^0.
|
|
47
|
+
"@describe-me/core": "^0.4.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@testing-library/react": ">=16",
|