@contentful/experiences-sdk-react 1.3.0 → 1.3.1-dev-20240508T1336-149a569.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/dist/index.js +32 -38
- package/dist/index.js.map +1 -1
- package/dist/src/hooks/useClassName.d.ts +13 -0
- package/dist/src/sdkVersion.d.ts +1 -1
- package/package.json +5 -5
- package/dist/src/hooks/useStyleTag.d.ts +0 -16
- /package/dist/src/hooks/{useStyleTag.spec.d.ts → useClassName.spec.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentTreeNode } from '@contentful/experiences-core/types';
|
|
2
|
+
/**
|
|
3
|
+
* This hook can generate className and inject styles on a client side as a <style> tag
|
|
4
|
+
* or it derives the className set on the server side
|
|
5
|
+
*
|
|
6
|
+
* @param node: the componenet node for which the styles will be injected
|
|
7
|
+
* @param props: the props of the component, represented by the node
|
|
8
|
+
* @returns the className that was eitner generated on the client side or derived from the value, set on server side
|
|
9
|
+
*/
|
|
10
|
+
export declare const useClassName: ({ node, props, }: {
|
|
11
|
+
node: ComponentTreeNode;
|
|
12
|
+
props: Record<string, any>;
|
|
13
|
+
}) => string;
|
package/dist/src/sdkVersion.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.3.0
|
|
1
|
+
export declare const SDK_VERSION = "1.3.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experiences-sdk-react",
|
|
3
|
-
"version": "1.3.0",
|
|
3
|
+
"version": "1.3.1-dev-20240508T1336-149a569.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/src/index.d.ts",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"depcruise": "depcruise src"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@contentful/experiences-components-react": "
|
|
35
|
-
"@contentful/experiences-core": "
|
|
36
|
-
"@contentful/experiences-visual-editor-react": "
|
|
34
|
+
"@contentful/experiences-components-react": "1.3.1-dev-20240508T1336-149a569.0",
|
|
35
|
+
"@contentful/experiences-core": "1.3.1-dev-20240508T1336-149a569.0",
|
|
36
|
+
"@contentful/experiences-visual-editor-react": "1.3.1-dev-20240508T1336-149a569.0",
|
|
37
37
|
"@contentful/rich-text-types": "^16.2.1",
|
|
38
38
|
"classnames": "^2.3.2",
|
|
39
39
|
"csstype": "^3.1.2",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"dist",
|
|
90
90
|
"package.json"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "149a56978043fd799fce5d09b47626f2d414cf93"
|
|
93
93
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from '@contentful/experiences-core/types';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param styles: the list of styles to apply
|
|
5
|
-
* @param nodeId: [Optional] the id of node that these styles will be applied to
|
|
6
|
-
* @returns className: the className that was used
|
|
7
|
-
* Builds and adds a style tag in the document. Returns the className to be attached to the element.
|
|
8
|
-
* In editor mode the nodeId is used as the identifier in order to avoid creating endless tags as the styles are tweeked
|
|
9
|
-
* In preview/delivery mode the styles don't change oftem so we're using the md5 hash of the content of the tag
|
|
10
|
-
*/
|
|
11
|
-
export declare const useStyleTag: ({ styles, nodeId }: {
|
|
12
|
-
styles: CSSProperties;
|
|
13
|
-
nodeId?: string | undefined;
|
|
14
|
-
}) => {
|
|
15
|
-
className: string;
|
|
16
|
-
};
|
|
File without changes
|