@contentful/experiences-sdk-react 1.30.5-prerelease-20250207T1349-200d927.0 → 1.30.5-prerelease-20250207T1706-1350c89.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/blocks/preview/CompositionBlock.js +1 -0
- package/dist/blocks/preview/CompositionBlock.js.map +1 -1
- package/dist/blocks/preview/PreviewUnboundImage.js +1 -1
- package/dist/blocks/preview/PreviewUnboundImage.js.map +1 -1
- package/dist/hooks/useMediaQuery.js +0 -2
- package/dist/hooks/useMediaQuery.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/sdkVersion.js +1 -1
- package/dist/sdkVersion.js.map +1 -1
- package/dist/src/sdkVersion.d.ts +1 -1
- package/dist/src/utils/parseComponentProps.d.ts +3 -2
- package/dist/utils/parseComponentProps.js +17 -3
- package/dist/utils/parseComponentProps.js.map +1 -1
- package/package.json +6 -6
|
@@ -63,6 +63,7 @@ const CompositionBlock = ({ node: rawNode, locale, entityStore, hyperlinkPattern
|
|
|
63
63
|
: cfSsrClassName,
|
|
64
64
|
};
|
|
65
65
|
const { contentProps = {}, styleProps = {}, customDesignProps = {}, mediaQuery, } = parseComponentProps({
|
|
66
|
+
mainBreakpoint,
|
|
66
67
|
componentDefinition: componentRegistration.definition,
|
|
67
68
|
node,
|
|
68
69
|
resolveCustomDesignValue: ({ propertyName, valuesByBreakpoint }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositionBlock.js","sources":["../../../../src/blocks/preview/CompositionBlock.tsx"],"sourcesContent":["import React, { ReactNode, useEffect, useMemo, useState } from 'react';\nimport type { UnresolvedLink } from 'contentful';\nimport {\n EntityStore,\n resolveHyperlinkPattern,\n sanitizeNodeProps,\n} from '@contentful/experiences-core';\nimport {\n CONTENTFUL_COMPONENTS,\n HYPERLINK_DEFAULT_PATTERN,\n} from '@contentful/experiences-core/constants';\nimport type {\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n ResolveDesignValueType,\n StyleProps,\n} from '@contentful/experiences-core/types';\nimport { createAssemblyRegistration, getComponentRegistration } from '../../core/componentRegistry';\nimport { checkIsAssemblyNode, transformBoundContentValue } from '@contentful/experiences-core';\nimport { useInjectStylesheet } from '../../hooks/useClassName';\nimport {\n Assembly,\n Columns,\n ContentfulContainer,\n SingleColumn,\n} from '@contentful/experiences-components-react';\nimport { resolveAssembly } from '../../core/preview/assemblyUtils';\nimport { Entry } from 'contentful';\nimport PreviewUnboundImage from './PreviewUnboundImage';\nimport { parseComponentProps } from '../../utils/parseComponentProps';\nimport { resolveClassNamesFromBuiltInStyles } from '../../hooks/useMediaQuery';\n\ntype CompositionBlockProps = {\n node: ComponentTreeNode;\n locale: string;\n entityStore: EntityStore;\n hyperlinkPattern?: string | undefined;\n resolveDesignValue: ResolveDesignValueType;\n getPatternChildNodeClassName?: (childNodeId: string) => string | undefined;\n wrappingPatternIds?: Set<string>;\n};\n\nexport const CompositionBlock = ({\n node: rawNode,\n locale,\n entityStore,\n hyperlinkPattern,\n resolveDesignValue,\n getPatternChildNodeClassName,\n wrappingPatternIds: parentWrappingPatternIds = new Set(),\n}: CompositionBlockProps) => {\n const [hasRendered, setHasRendered] = useState(false);\n\n useEffect(() => {\n setHasRendered(true);\n }, []);\n\n const isAssembly = useMemo(\n () =>\n checkIsAssemblyNode({\n componentId: rawNode.definitionId,\n usedComponents: entityStore.usedComponents,\n }),\n [entityStore.usedComponents, rawNode.definitionId],\n );\n\n const node = useMemo(() => {\n return isAssembly\n ? resolveAssembly({\n node: rawNode,\n entityStore,\n })\n : rawNode;\n }, [entityStore, isAssembly, rawNode]);\n\n const wrappingPatternIds = useMemo(() => {\n if (isAssembly) {\n return new Set([node.definitionId, ...parentWrappingPatternIds]);\n }\n return parentWrappingPatternIds;\n }, [isAssembly, node, parentWrappingPatternIds]);\n\n const componentRegistration = useMemo(() => {\n const registration = getComponentRegistration(node.definitionId as string);\n\n if (isAssembly && !registration) {\n return createAssemblyRegistration({\n definitionId: node.definitionId as string,\n component: Assembly,\n });\n }\n return registration;\n }, [isAssembly, node.definitionId]);\n\n const { ssrProps, contentProps, props, mediaQuery } = useMemo(() => {\n // In SSR, we store the className under breakpoints[0] which is resolved here to the actual string\n const cfSsrClassNameValues = node.variables.cfSsrClassName as DesignValue | undefined;\n const mainBreakpoint = entityStore.breakpoints[0];\n const cfSsrClassName = cfSsrClassNameValues?.valuesByBreakpoint?.[mainBreakpoint.id] as\n | string\n | undefined;\n\n // Don't enrich the assembly wrapper node with props\n if (!componentRegistration || isAssembly) {\n const ssrProps = { cfSsrClassName };\n const props: Record<string, PrimitiveValue> = { className: cfSsrClassName };\n return {\n ssrProps,\n props,\n };\n }\n\n const ssrProps: Record<string, string | undefined> = {\n cfSsrClassName:\n node.id && getPatternChildNodeClassName\n ? getPatternChildNodeClassName(node.id)\n : cfSsrClassName,\n };\n\n const {\n contentProps = {},\n styleProps = {},\n customDesignProps = {},\n mediaQuery,\n } = parseComponentProps({\n componentDefinition: componentRegistration.definition,\n node,\n resolveCustomDesignValue: ({ propertyName, valuesByBreakpoint }) => {\n return resolveDesignValue(valuesByBreakpoint, propertyName);\n },\n resolveBoundValue: ({ binding, propertyName, dataType }) => {\n const [, uuid] = binding.path.split('/');\n const boundEntityLink = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n const boundValue = transformBoundContentValue(\n node.variables,\n entityStore,\n boundEntityLink,\n resolveDesignValue,\n propertyName,\n dataType,\n binding.path,\n );\n\n return boundValue;\n },\n resolveHyperlinkValue: ({ linkTargetKey }) => {\n const boundEntity = entityStore.dataSource[linkTargetKey];\n const hyperlinkEntry = entityStore.getEntryOrAsset(boundEntity, linkTargetKey);\n\n const value = resolveHyperlinkPattern(\n componentRegistration.definition.hyperlinkPattern ||\n hyperlinkPattern ||\n HYPERLINK_DEFAULT_PATTERN,\n hyperlinkEntry as Entry,\n locale,\n );\n\n return value;\n },\n resolveUnboundValue: ({ mappingKey, defaultValue }) => {\n return entityStore.unboundValues[mappingKey]?.value ?? defaultValue;\n },\n resolveClassNamesFromBuiltInStyles: (designPropsByBreakpointId) => {\n return resolveClassNamesFromBuiltInStyles({\n designPropsByBreakpointId,\n breakpoints: entityStore.breakpoints,\n node,\n });\n },\n });\n\n const slotsProps: Record<string, ReactNode> = {};\n\n if (componentRegistration.definition.slots) {\n for (const slotId in componentRegistration.definition.slots) {\n const slotNode = node.children.find((child) => child.slotId === slotId);\n if (slotNode) {\n slotsProps[slotId] = (\n <CompositionBlock\n node={slotNode}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n wrappingPatternIds={wrappingPatternIds}\n />\n );\n }\n }\n }\n\n const props: Record<string, PrimitiveValue> = {\n className: ssrProps.cfSsrClassName ?? mediaQuery?.className,\n ...styleProps,\n ...contentProps,\n ...customDesignProps,\n ...slotsProps,\n };\n\n return {\n ssrProps,\n contentProps,\n slotsProps,\n styleProps,\n customDesignProps,\n mediaQuery,\n props,\n };\n }, [\n node.variables,\n node.id,\n node.children,\n resolveDesignValue,\n componentRegistration,\n isAssembly,\n getPatternChildNodeClassName,\n entityStore,\n hyperlinkPattern,\n locale,\n wrappingPatternIds,\n ]);\n\n // do not inject the stylesheet into the dom because it's already been done on the server side\n useInjectStylesheet(ssrProps.cfSsrClassName ? undefined : mediaQuery);\n\n if (!componentRegistration) {\n return null;\n }\n\n // When detecting a circular dependency, we stop silently. The editor mode will render an actionable error.\n if (parentWrappingPatternIds.has(node.definitionId)) {\n return null;\n }\n\n const { component } = componentRegistration;\n\n // Retrieves the CSS class name for a given child node ID.\n const _getPatternChildNodeClassName = (childNodeId: string) => {\n if (isAssembly) {\n // @ts-expect-error -- property cfSsrClassName is a map (id to classNames) that is added during rendering in ssrStyles\n const classesForNode: DesignValue | undefined = node.variables.cfSsrClassName?.[childNodeId];\n if (!classesForNode) return undefined;\n return resolveDesignValue(classesForNode.valuesByBreakpoint, 'cfSsrClassName') as string;\n }\n return getPatternChildNodeClassName?.(childNodeId);\n };\n\n const children =\n componentRegistration.definition.children === true\n ? node.children.map((childNode: ComponentTreeNode, index) => {\n return (\n <CompositionBlock\n getPatternChildNodeClassName={\n isAssembly || getPatternChildNodeClassName\n ? _getPatternChildNodeClassName\n : undefined\n }\n node={childNode}\n key={index}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n wrappingPatternIds={wrappingPatternIds}\n />\n );\n })\n : null;\n\n if (\n [CONTENTFUL_COMPONENTS.container.id, CONTENTFUL_COMPONENTS.section.id].includes(\n node.definitionId,\n )\n ) {\n return (\n <ContentfulContainer\n editorMode={false}\n cfHyperlink={(contentProps as StyleProps).cfHyperlink}\n cfOpenInNewTab={(contentProps as StyleProps).cfOpenInNewTab}\n className={props.className as string | undefined}>\n {children}\n </ContentfulContainer>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.columns.id) {\n return (\n <Columns editorMode={false} className={props.className as string | undefined}>\n {children}\n </Columns>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.singleColumn.id) {\n return (\n <SingleColumn editorMode={false} className={props.className as string | undefined}>\n {children}\n </SingleColumn>\n );\n }\n\n if (\n node.definitionId === CONTENTFUL_COMPONENTS.image.id &&\n node.variables.cfImageAsset?.type === 'UnboundValue'\n ) {\n return (\n <PreviewUnboundImage\n node={node}\n nodeProps={props}\n component={component}\n breakpoints={entityStore.breakpoints}\n />\n );\n }\n\n return React.createElement(\n component,\n {\n ...sanitizeNodeProps(props),\n key: `${node.id}-${hasRendered}`,\n },\n children ?? (typeof props.children === 'string' ? props.children : null),\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;AA2CO,MAAM,gBAAgB,GAAG,CAAC,EAC/B,IAAI,EAAE,OAAO,EACb,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,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S,EAAE,KAAK,CAAC,SAA+B,EAAA,QAAA,EAC/C,QAAQ,EAAA,CACW,EACtB;KACH;IAED,IAAI,IAAI,CAAC,YAAY,KAAK,qBAAqB,CAAC,OAAO,CAAC,EAAE,EAAE;AAC1D,QAAA,QACEA,GAAC,CAAA,OAAO,EAAC,EAAA,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAA+B,YACzE,QAAQ,EAAA,CACD,EACV;KACH;IAED,IAAI,IAAI,CAAC,YAAY,KAAK,qBAAqB,CAAC,YAAY,CAAC,EAAE,EAAE;AAC/D,QAAA,QACEA,GAAC,CAAA,YAAY,EAAC,EAAA,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAA+B,YAC9E,QAAQ,EAAA,CACI,EACf;KACH;IAED,IACE,IAAI,CAAC,YAAY,KAAK,qBAAqB,CAAC,KAAK,CAAC,EAAE;QACpD,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,KAAK,cAAc,EACpD;QACA,QACEA,IAAC,mBAAmB,EAAA,EAClB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,KAAK,EAChB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,CAAC,WAAW,EACpC,CAAA,EACF;KACH;AAED,IAAA,OAAO,KAAK,CAAC,aAAa,CACxB,SAAS,EACT;QACE,GAAG,iBAAiB,CAAC,KAAK,CAAC;AAC3B,QAAA,GAAG,EAAE,CAAG,EAAA,IAAI,CAAC,EAAE,CAAA,CAAA,EAAI,WAAW,CAAE,CAAA;KACjC,EACD,QAAQ,KAAK,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CACzE,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"CompositionBlock.js","sources":["../../../../src/blocks/preview/CompositionBlock.tsx"],"sourcesContent":["import React, { ReactNode, useEffect, useMemo, useState } from 'react';\nimport type { UnresolvedLink } from 'contentful';\nimport {\n EntityStore,\n resolveHyperlinkPattern,\n sanitizeNodeProps,\n} from '@contentful/experiences-core';\nimport {\n CONTENTFUL_COMPONENTS,\n HYPERLINK_DEFAULT_PATTERN,\n} from '@contentful/experiences-core/constants';\nimport type {\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n ResolveDesignValueType,\n StyleProps,\n} from '@contentful/experiences-core/types';\nimport { createAssemblyRegistration, getComponentRegistration } from '../../core/componentRegistry';\nimport { checkIsAssemblyNode, transformBoundContentValue } from '@contentful/experiences-core';\nimport { useInjectStylesheet } from '../../hooks/useClassName';\nimport {\n Assembly,\n Columns,\n ContentfulContainer,\n SingleColumn,\n} from '@contentful/experiences-components-react';\nimport { resolveAssembly } from '../../core/preview/assemblyUtils';\nimport { Entry } from 'contentful';\nimport PreviewUnboundImage from './PreviewUnboundImage';\nimport { parseComponentProps } from '../../utils/parseComponentProps';\nimport { resolveClassNamesFromBuiltInStyles } from '../../hooks/useMediaQuery';\n\ntype CompositionBlockProps = {\n node: ComponentTreeNode;\n locale: string;\n entityStore: EntityStore;\n hyperlinkPattern?: string | undefined;\n resolveDesignValue: ResolveDesignValueType;\n getPatternChildNodeClassName?: (childNodeId: string) => string | undefined;\n wrappingPatternIds?: Set<string>;\n};\n\nexport const CompositionBlock = ({\n node: rawNode,\n locale,\n entityStore,\n hyperlinkPattern,\n resolveDesignValue,\n getPatternChildNodeClassName,\n wrappingPatternIds: parentWrappingPatternIds = new Set(),\n}: CompositionBlockProps) => {\n const [hasRendered, setHasRendered] = useState(false);\n\n useEffect(() => {\n setHasRendered(true);\n }, []);\n\n const isAssembly = useMemo(\n () =>\n checkIsAssemblyNode({\n componentId: rawNode.definitionId,\n usedComponents: entityStore.usedComponents,\n }),\n [entityStore.usedComponents, rawNode.definitionId],\n );\n\n const node = useMemo(() => {\n return isAssembly\n ? resolveAssembly({\n node: rawNode,\n entityStore,\n })\n : rawNode;\n }, [entityStore, isAssembly, rawNode]);\n\n const wrappingPatternIds = useMemo(() => {\n if (isAssembly) {\n return new Set([node.definitionId, ...parentWrappingPatternIds]);\n }\n return parentWrappingPatternIds;\n }, [isAssembly, node, parentWrappingPatternIds]);\n\n const componentRegistration = useMemo(() => {\n const registration = getComponentRegistration(node.definitionId as string);\n\n if (isAssembly && !registration) {\n return createAssemblyRegistration({\n definitionId: node.definitionId as string,\n component: Assembly,\n });\n }\n return registration;\n }, [isAssembly, node.definitionId]);\n\n const { ssrProps, contentProps, props, mediaQuery } = useMemo(() => {\n // In SSR, we store the className under breakpoints[0] which is resolved here to the actual string\n const cfSsrClassNameValues = node.variables.cfSsrClassName as DesignValue | undefined;\n const mainBreakpoint = entityStore.breakpoints[0];\n const cfSsrClassName = cfSsrClassNameValues?.valuesByBreakpoint?.[mainBreakpoint.id] as\n | string\n | undefined;\n\n // Don't enrich the assembly wrapper node with props\n if (!componentRegistration || isAssembly) {\n const ssrProps = { cfSsrClassName };\n const props: Record<string, PrimitiveValue> = { className: cfSsrClassName };\n return {\n ssrProps,\n props,\n };\n }\n\n const ssrProps: Record<string, string | undefined> = {\n cfSsrClassName:\n node.id && getPatternChildNodeClassName\n ? getPatternChildNodeClassName(node.id)\n : cfSsrClassName,\n };\n\n const {\n contentProps = {},\n styleProps = {},\n customDesignProps = {},\n mediaQuery,\n } = parseComponentProps({\n mainBreakpoint,\n componentDefinition: componentRegistration.definition,\n node,\n resolveCustomDesignValue: ({ propertyName, valuesByBreakpoint }) => {\n return resolveDesignValue(valuesByBreakpoint, propertyName);\n },\n resolveBoundValue: ({ binding, propertyName, dataType }) => {\n const [, uuid] = binding.path.split('/');\n const boundEntityLink = entityStore.dataSource[uuid] as UnresolvedLink<'Entry' | 'Asset'>;\n const boundValue = transformBoundContentValue(\n node.variables,\n entityStore,\n boundEntityLink,\n resolveDesignValue,\n propertyName,\n dataType,\n binding.path,\n );\n\n return boundValue;\n },\n resolveHyperlinkValue: ({ linkTargetKey }) => {\n const boundEntity = entityStore.dataSource[linkTargetKey];\n const hyperlinkEntry = entityStore.getEntryOrAsset(boundEntity, linkTargetKey);\n\n const value = resolveHyperlinkPattern(\n componentRegistration.definition.hyperlinkPattern ||\n hyperlinkPattern ||\n HYPERLINK_DEFAULT_PATTERN,\n hyperlinkEntry as Entry,\n locale,\n );\n\n return value;\n },\n resolveUnboundValue: ({ mappingKey, defaultValue }) => {\n return entityStore.unboundValues[mappingKey]?.value ?? defaultValue;\n },\n resolveClassNamesFromBuiltInStyles: (designPropsByBreakpointId) => {\n return resolveClassNamesFromBuiltInStyles({\n designPropsByBreakpointId,\n breakpoints: entityStore.breakpoints,\n node,\n });\n },\n });\n\n const slotsProps: Record<string, ReactNode> = {};\n\n if (componentRegistration.definition.slots) {\n for (const slotId in componentRegistration.definition.slots) {\n const slotNode = node.children.find((child) => child.slotId === slotId);\n if (slotNode) {\n slotsProps[slotId] = (\n <CompositionBlock\n node={slotNode}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n wrappingPatternIds={wrappingPatternIds}\n />\n );\n }\n }\n }\n\n const props: Record<string, PrimitiveValue> = {\n className: ssrProps.cfSsrClassName ?? mediaQuery?.className,\n ...styleProps,\n ...contentProps,\n ...customDesignProps,\n ...slotsProps,\n };\n\n return {\n ssrProps,\n contentProps,\n slotsProps,\n styleProps,\n customDesignProps,\n mediaQuery,\n props,\n };\n }, [\n node.variables,\n node.id,\n node.children,\n resolveDesignValue,\n componentRegistration,\n isAssembly,\n getPatternChildNodeClassName,\n entityStore,\n hyperlinkPattern,\n locale,\n wrappingPatternIds,\n ]);\n\n // do not inject the stylesheet into the dom because it's already been done on the server side\n useInjectStylesheet(ssrProps.cfSsrClassName ? undefined : mediaQuery);\n\n if (!componentRegistration) {\n return null;\n }\n\n // When detecting a circular dependency, we stop silently. The editor mode will render an actionable error.\n if (parentWrappingPatternIds.has(node.definitionId)) {\n return null;\n }\n\n const { component } = componentRegistration;\n\n // Retrieves the CSS class name for a given child node ID.\n const _getPatternChildNodeClassName = (childNodeId: string) => {\n if (isAssembly) {\n // @ts-expect-error -- property cfSsrClassName is a map (id to classNames) that is added during rendering in ssrStyles\n const classesForNode: DesignValue | undefined = node.variables.cfSsrClassName?.[childNodeId];\n if (!classesForNode) return undefined;\n return resolveDesignValue(classesForNode.valuesByBreakpoint, 'cfSsrClassName') as string;\n }\n return getPatternChildNodeClassName?.(childNodeId);\n };\n\n const children =\n componentRegistration.definition.children === true\n ? node.children.map((childNode: ComponentTreeNode, index) => {\n return (\n <CompositionBlock\n getPatternChildNodeClassName={\n isAssembly || getPatternChildNodeClassName\n ? _getPatternChildNodeClassName\n : undefined\n }\n node={childNode}\n key={index}\n locale={locale}\n hyperlinkPattern={hyperlinkPattern}\n entityStore={entityStore}\n resolveDesignValue={resolveDesignValue}\n wrappingPatternIds={wrappingPatternIds}\n />\n );\n })\n : null;\n\n if (\n [CONTENTFUL_COMPONENTS.container.id, CONTENTFUL_COMPONENTS.section.id].includes(\n node.definitionId,\n )\n ) {\n return (\n <ContentfulContainer\n editorMode={false}\n cfHyperlink={(contentProps as StyleProps).cfHyperlink}\n cfOpenInNewTab={(contentProps as StyleProps).cfOpenInNewTab}\n className={props.className as string | undefined}>\n {children}\n </ContentfulContainer>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.columns.id) {\n return (\n <Columns editorMode={false} className={props.className as string | undefined}>\n {children}\n </Columns>\n );\n }\n\n if (node.definitionId === CONTENTFUL_COMPONENTS.singleColumn.id) {\n return (\n <SingleColumn editorMode={false} className={props.className as string | undefined}>\n {children}\n </SingleColumn>\n );\n }\n\n if (\n node.definitionId === CONTENTFUL_COMPONENTS.image.id &&\n node.variables.cfImageAsset?.type === 'UnboundValue'\n ) {\n return (\n <PreviewUnboundImage\n node={node}\n nodeProps={props}\n component={component}\n breakpoints={entityStore.breakpoints}\n />\n );\n }\n\n return React.createElement(\n component,\n {\n ...sanitizeNodeProps(props),\n key: `${node.id}-${hasRendered}`,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AC,QAAQ,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CACzE,CAAC;AACJ;;;;"}
|
|
@@ -44,7 +44,7 @@ const PreviewUnboundImage = ({ breakpoints, node, nodeProps, component, }) => {
|
|
|
44
44
|
useInjectStylesheet(imageMedia);
|
|
45
45
|
return (jsx("div", { className: classNames('cf-preview-unbound-image', wrapperMedia.className), children: React.createElement(component, {
|
|
46
46
|
...sanitizeNodeProps(nodeProps),
|
|
47
|
-
className:
|
|
47
|
+
className: classNames(nodeProps.className, imageMedia.className),
|
|
48
48
|
}) }));
|
|
49
49
|
};
|
|
50
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewUnboundImage.js","sources":["../../../../src/blocks/preview/PreviewUnboundImage.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport type {\n Breakpoint,\n ComponentTreeNode,\n PrimitiveValue,\n} from '@contentful/experiences-core/types';\nimport { sanitizeNodeProps } from '@contentful/experiences-core';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { useInjectStylesheet } from '../../hooks/useClassName';\nimport classNames from 'classnames';\n\ninterface PreviewUnboundImageProps {\n breakpoints: Breakpoint[];\n node: ComponentTreeNode;\n nodeProps: Record<PropertyKey, PrimitiveValue>;\n component: React.ElementType;\n}\n\n/**\n * This component is used to render a placeholder Image component in the preview\n * when the image is unbound. It applies the Image size styles to a wrapping div.\n */\nconst PreviewUnboundImage: React.FC<PreviewUnboundImageProps> = ({\n breakpoints,\n node,\n nodeProps,\n component,\n}) => {\n const { wrapperStyle, imageStyle } = useMemo(() => {\n const imageStyle: Record<string, any> = {};\n const wrapperStyle: Record<string, any> = {};\n\n if (nodeProps.cfImageOptions && typeof nodeProps.cfImageOptions === 'object') {\n for (const [breakpointId, styles] of Object.entries(nodeProps.cfImageOptions)) {\n imageStyle[breakpointId] = {\n cfImageOptions: {\n ...styles,\n height: '100%',\n width: '100%',\n },\n };\n\n wrapperStyle[breakpointId] = {\n cfHeight: styles.height,\n cfWidth: styles.width,\n };\n }\n }\n\n return { imageStyle, wrapperStyle };\n }, [nodeProps.cfImageOptions]);\n\n const wrapperMedia = useMediaQuery({\n designPropsByBreakpointId: wrapperStyle,\n node,\n breakpoints,\n });\n\n const imageMedia = useMediaQuery({\n designPropsByBreakpointId: imageStyle,\n node,\n breakpoints,\n });\n\n useInjectStylesheet(wrapperMedia);\n useInjectStylesheet(imageMedia);\n\n return (\n <div className={classNames('cf-preview-unbound-image', wrapperMedia.className)}>\n {React.createElement(component, {\n ...sanitizeNodeProps(nodeProps),\n className:
|
|
1
|
+
{"version":3,"file":"PreviewUnboundImage.js","sources":["../../../../src/blocks/preview/PreviewUnboundImage.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport type {\n Breakpoint,\n ComponentTreeNode,\n PrimitiveValue,\n} from '@contentful/experiences-core/types';\nimport { sanitizeNodeProps } from '@contentful/experiences-core';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { useInjectStylesheet } from '../../hooks/useClassName';\nimport classNames from 'classnames';\n\ninterface PreviewUnboundImageProps {\n breakpoints: Breakpoint[];\n node: ComponentTreeNode;\n nodeProps: Record<PropertyKey, PrimitiveValue>;\n component: React.ElementType;\n}\n\n/**\n * This component is used to render a placeholder Image component in the preview\n * when the image is unbound. It applies the Image size styles to a wrapping div.\n */\nconst PreviewUnboundImage: React.FC<PreviewUnboundImageProps> = ({\n breakpoints,\n node,\n nodeProps,\n component,\n}) => {\n const { wrapperStyle, imageStyle } = useMemo(() => {\n const imageStyle: Record<string, any> = {};\n const wrapperStyle: Record<string, any> = {};\n\n if (nodeProps.cfImageOptions && typeof nodeProps.cfImageOptions === 'object') {\n for (const [breakpointId, styles] of Object.entries(nodeProps.cfImageOptions)) {\n imageStyle[breakpointId] = {\n cfImageOptions: {\n ...styles,\n height: '100%',\n width: '100%',\n },\n };\n\n wrapperStyle[breakpointId] = {\n cfHeight: styles.height,\n cfWidth: styles.width,\n };\n }\n }\n\n return { imageStyle, wrapperStyle };\n }, [nodeProps.cfImageOptions]);\n\n const wrapperMedia = useMediaQuery({\n designPropsByBreakpointId: wrapperStyle,\n node,\n breakpoints,\n });\n\n const imageMedia = useMediaQuery({\n designPropsByBreakpointId: imageStyle,\n node,\n breakpoints,\n });\n\n useInjectStylesheet(wrapperMedia);\n useInjectStylesheet(imageMedia);\n\n return (\n <div className={classNames('cf-preview-unbound-image', wrapperMedia.className)}>\n {React.createElement(component, {\n ...sanitizeNodeProps(nodeProps),\n className: classNames(nodeProps.className, imageMedia.className),\n })}\n </div>\n );\n};\n\nexport default PreviewUnboundImage;\n"],"names":["_jsx"],"mappings":";;;;;;;AAkBA;;;AAGG;AACH,MAAM,mBAAmB,GAAuC,CAAC,EAC/D,WAAW,EACX,IAAI,EACJ,SAAS,EACT,SAAS,GACV,KAAI;IACH,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,MAAK;QAChD,MAAM,UAAU,GAAwB,EAAE,CAAC;QAC3C,MAAM,YAAY,GAAwB,EAAE,CAAC;QAE7C,IAAI,SAAS,CAAC,cAAc,IAAI,OAAO,SAAS,CAAC,cAAc,KAAK,QAAQ,EAAE;AAC5E,YAAA,KAAK,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE;gBAC7E,UAAU,CAAC,YAAY,CAAC,GAAG;AACzB,oBAAA,cAAc,EAAE;AACd,wBAAA,GAAG,MAAM;AACT,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,KAAK,EAAE,MAAM;AACd,qBAAA;iBACF,CAAC;gBAEF,YAAY,CAAC,YAAY,CAAC,GAAG;oBAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM;oBACvB,OAAO,EAAE,MAAM,CAAC,KAAK;iBACtB,CAAC;aACH;SACF;AAED,QAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACtC,KAAC,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;IAE/B,MAAM,YAAY,GAAG,aAAa,CAAC;AACjC,QAAA,yBAAyB,EAAE,YAAY;QACvC,IAAI;QACJ,WAAW;AACZ,KAAA,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,aAAa,CAAC;AAC/B,QAAA,yBAAyB,EAAE,UAAU;QACrC,IAAI;QACJ,WAAW;AACZ,KAAA,CAAC,CAAC;IAEH,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAClC,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAEhC,IAAA,QACEA,GAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE,YAAY,CAAC,SAAS,CAAC,EAC3E,QAAA,EAAA,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE;YAC9B,GAAG,iBAAiB,CAAC,SAAS,CAAC;YAC/B,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC;SACjE,CAAC,EAAA,CACE,EACN;AACJ;;;;"}
|
|
@@ -3,7 +3,6 @@ import { EMPTY_CONTAINER_HEIGHT } from '@contentful/experiences-core/constants';
|
|
|
3
3
|
import md5 from 'md5';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
|
|
6
|
-
// TODO: move to ssrStyles.ts file and reuse it there
|
|
7
6
|
const resolveClassNamesFromBuiltInStyles = ({ designPropsByBreakpointId, breakpoints, node, }) => {
|
|
8
7
|
const mapOfDesignVariableKeys = flattenDesignTokenRegistry(designTokensRegistry);
|
|
9
8
|
const result = [];
|
|
@@ -62,7 +61,6 @@ const resolveClassNamesFromBuiltInStyles = ({ designPropsByBreakpointId, breakpo
|
|
|
62
61
|
}
|
|
63
62
|
return result;
|
|
64
63
|
};
|
|
65
|
-
// TODO: move to ssrStyles.ts file and reuse it there
|
|
66
64
|
const convertResolvedDesignValuesToMediaQuery = (styleSheetData) => {
|
|
67
65
|
/**
|
|
68
66
|
* {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMediaQuery.js","sources":["../../../src/hooks/useMediaQuery.ts"],"sourcesContent":["import {\n buildCfStyles,\n designTokensRegistry,\n flattenDesignTokenRegistry,\n isStructureWithRelativeHeight,\n maybePopulateDesignTokenValue,\n toCSSAttribute,\n toCSSString,\n toMediaQuery,\n} from '@contentful/experiences-core';\nimport { EMPTY_CONTAINER_HEIGHT } from '@contentful/experiences-core/constants';\nimport { Breakpoint, ComponentTreeNode } from '@contentful/experiences-core/types';\nimport md5 from 'md5';\nimport { useMemo } from 'react';\n\ntype ResolvedStylesheetData = Array<{\n className: string;\n breakpointCondition: string;\n css: string;\n}>;\n\
|
|
1
|
+
{"version":3,"file":"useMediaQuery.js","sources":["../../../src/hooks/useMediaQuery.ts"],"sourcesContent":["import {\n buildCfStyles,\n designTokensRegistry,\n flattenDesignTokenRegistry,\n isStructureWithRelativeHeight,\n maybePopulateDesignTokenValue,\n toCSSAttribute,\n toCSSString,\n toMediaQuery,\n} from '@contentful/experiences-core';\nimport { EMPTY_CONTAINER_HEIGHT } from '@contentful/experiences-core/constants';\nimport { Breakpoint, ComponentTreeNode } from '@contentful/experiences-core/types';\nimport md5 from 'md5';\nimport { useMemo } from 'react';\n\ntype ResolvedStylesheetData = Array<{\n className: string;\n breakpointCondition: string;\n css: string;\n}>;\n\nexport const resolveClassNamesFromBuiltInStyles = ({\n designPropsByBreakpointId,\n breakpoints,\n node,\n}: {\n designPropsByBreakpointId: Record<string, Record<string, any>>;\n breakpoints: Breakpoint[];\n node: ComponentTreeNode;\n}): ResolvedStylesheetData => {\n const mapOfDesignVariableKeys = flattenDesignTokenRegistry(designTokensRegistry);\n const currentNodeClassNames: string[] = [];\n\n const result: Array<{\n className: string;\n breakpointCondition: string;\n css: string;\n }> = [];\n\n // then for each breakpoint\n for (const breakpoint of breakpoints) {\n const designProps = designPropsByBreakpointId[breakpoint.id];\n if (!designProps) {\n continue;\n }\n\n const propsByBreakpointWithResolvedDesignTokens = Object.entries(designProps).reduce(\n (acc, [propName, propValue]) => {\n return {\n ...acc,\n [propName]: maybePopulateDesignTokenValue(propName, propValue, mapOfDesignVariableKeys),\n };\n },\n {},\n );\n\n // We convert cryptic prop keys to css variables\n // Eg: cfMargin to margin\n const stylesForBreakpoint = buildCfStyles(propsByBreakpointWithResolvedDesignTokens);\n\n if (\n !node.children.length &&\n isStructureWithRelativeHeight(node.definitionId, stylesForBreakpoint.height)\n ) {\n stylesForBreakpoint.minHeight = EMPTY_CONTAINER_HEIGHT;\n }\n\n const stylesForBreakpointWithoutUndefined: Record<string, string> = Object.fromEntries(\n Object.entries(stylesForBreakpoint)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [toCSSAttribute(key), value]),\n );\n\n /**\n * stylesForBreakpoint {\n margin: '0 0 0 0',\n padding: '0 0 0 0',\n 'background-color': 'rgba(246, 246, 246, 1)',\n width: '100%',\n height: 'fit-content',\n 'max-width': 'none',\n border: '0px solid rgba(0, 0, 0, 0)',\n 'border-radius': '0px',\n gap: '0px 0px',\n 'align-items': 'center',\n 'justify-content': 'safe center',\n 'flex-direction': 'column',\n 'flex-wrap': 'nowrap',\n 'font-style': 'normal',\n 'text-decoration': 'none',\n 'box-sizing': 'border-box'\n }\n */\n // I create a hash of the object above because that would ensure hash stability\n const styleHash = md5(JSON.stringify(stylesForBreakpointWithoutUndefined));\n\n // and prefix the className to make sure the value can be processed\n const className = `cfstyles-${styleHash}`;\n\n // I save the generated hashes into an array to later save it in the tree node\n // as cfSsrClassName prop\n // making sure to avoid the duplicates in case styles for > 1 breakpoints are the same\n if (!currentNodeClassNames.includes(className)) {\n currentNodeClassNames.push(className);\n }\n\n // otherwise, save it to the stylesheet\n result.push({\n className,\n breakpointCondition: breakpoint.query,\n css: toCSSString(stylesForBreakpointWithoutUndefined),\n });\n }\n\n return result;\n};\n\nexport const convertResolvedDesignValuesToMediaQuery = (styleSheetData: ResolvedStylesheetData) => {\n /**\n * {\n * className: ['cfstyles-123', 'cfstyles-456'],\n * styleSheet: `\n * @media (max-width: 1024px) {\n * .cfstyles-123 { color: red; }\n * }\n * @media (max-width: 768px) {\n * .cfstyles-456 { color: blue; }\n * }\n * `\n * }\n */\n const styleSheet = styleSheetData.reduce<{ className: Array<string>; css: string }>(\n (acc, { breakpointCondition, className, css }) => {\n if (acc.className.includes(className)) {\n return acc;\n }\n\n const mediaQuery = toMediaQuery({\n condition: breakpointCondition,\n cssByClassName: { [className]: css },\n });\n return {\n className: [...acc.className, className],\n css: `${acc.css}${mediaQuery}`,\n };\n },\n {\n className: [],\n css: '',\n },\n );\n\n const className = styleSheet.className.join(' ');\n\n return {\n css: styleSheet.css,\n hash: `cf-${md5(className)}`,\n className,\n };\n};\n\nexport const useMediaQuery = ({\n designPropsByBreakpointId,\n breakpoints,\n node,\n}: {\n designPropsByBreakpointId: Record<string, Record<string, any>>;\n breakpoints: Breakpoint[];\n node: ComponentTreeNode;\n}) => {\n return useMemo(() => {\n const styleSheetData = resolveClassNamesFromBuiltInStyles({\n designPropsByBreakpointId,\n breakpoints,\n node,\n });\n\n return convertResolvedDesignValuesToMediaQuery(styleSheetData);\n }, [designPropsByBreakpointId, breakpoints, node]);\n};\n"],"names":[],"mappings":";;;;;AAqBO,MAAM,kCAAkC,GAAG,CAAC,EACjD,yBAAyB,EACzB,WAAW,EACX,IAAI,GAKL,KAA4B;AAC3B,IAAA,MAAM,uBAAuB,GAAG,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;IAGjF,MAAM,MAAM,GAIP,EAAE,CAAC;;AAGR,IAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,WAAW,GAAG,yBAAyB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,WAAW,EAAE;YAChB,SAAS;SACV;QAED,MAAM,yCAAyC,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC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AACrD;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import * as _contentful_experiences_core_constants from '@contentful/experiences
|
|
|
8
8
|
export { CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, LATEST_SCHEMA_VERSION } from '@contentful/experiences-core/constants';
|
|
9
9
|
import { ContentfulClientApi } from 'contentful';
|
|
10
10
|
|
|
11
|
-
declare const SDK_VERSION = "1.30.5-prerelease-
|
|
11
|
+
declare const SDK_VERSION = "1.30.5-prerelease-20250207T1706-1350c89.0";
|
|
12
12
|
|
|
13
13
|
type ExperienceRootProps = {
|
|
14
14
|
experience?: Experience<EntityStore> | string | null;
|
package/dist/sdkVersion.js
CHANGED
package/dist/sdkVersion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '1.30.5-prerelease-
|
|
1
|
+
{"version":3,"file":"sdkVersion.js","sources":["../../src/sdkVersion.ts"],"sourcesContent":["export const SDK_VERSION = '1.30.5-prerelease-20250207T1706-1350c89.0';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;;;"}
|
package/dist/src/sdkVersion.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.30.5-prerelease-
|
|
1
|
+
export declare const SDK_VERSION = "1.30.5-prerelease-20250207T1706-1350c89.0";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoundComponentPropertyTypes, BoundValue, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableType, ComponentTreeNode, PrimitiveValue } from '@contentful/experiences-core/types';
|
|
1
|
+
import { BoundComponentPropertyTypes, BoundValue, Breakpoint, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableType, ComponentTreeNode, PrimitiveValue } from '@contentful/experiences-core/types';
|
|
2
2
|
/**
|
|
3
3
|
* The previous logic of prop mapping was too complex and mixed different ues cases together.
|
|
4
4
|
* In this function, I aim to simplify the logic by focusing on the following specific cases FOR PREVIEW/DELIVERY MODES
|
|
@@ -10,7 +10,8 @@ import { BoundComponentPropertyTypes, BoundValue, ComponentDefinition, Component
|
|
|
10
10
|
* 4) Those DesignValue props which can NOT be converted to CSS (custom design props) should be resolved dynamically
|
|
11
11
|
* for each breakpoint
|
|
12
12
|
*/
|
|
13
|
-
export declare const parseComponentProps: ({ componentDefinition, node, resolveClassNamesFromBuiltInStyles, resolveCustomDesignValue, resolveBoundValue, resolveHyperlinkValue, resolveUnboundValue, }: {
|
|
13
|
+
export declare const parseComponentProps: ({ mainBreakpoint, componentDefinition, node, resolveClassNamesFromBuiltInStyles, resolveCustomDesignValue, resolveBoundValue, resolveHyperlinkValue, resolveUnboundValue, }: {
|
|
14
|
+
mainBreakpoint: Breakpoint;
|
|
14
15
|
node: ComponentTreeNode;
|
|
15
16
|
componentDefinition: ComponentDefinition;
|
|
16
17
|
resolveClassNamesFromBuiltInStyles: (propsByBreakpointId: Record<string, Record<string, PrimitiveValue>>) => Array<{
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { isCfStyleAttribute } from '@contentful/experiences-core';
|
|
2
2
|
import { convertResolvedDesignValuesToMediaQuery } from '../hooks/useMediaQuery.js';
|
|
3
3
|
|
|
4
|
+
const isSpecialCaseCssProp = (propName) => {
|
|
5
|
+
return propName === 'cfBackgroundImageUrl' || propName.startsWith('cfBackgroundImageUrl_');
|
|
6
|
+
};
|
|
4
7
|
/**
|
|
5
8
|
* The previous logic of prop mapping was too complex and mixed different ues cases together.
|
|
6
9
|
* In this function, I aim to simplify the logic by focusing on the following specific cases FOR PREVIEW/DELIVERY MODES
|
|
@@ -12,7 +15,7 @@ import { convertResolvedDesignValuesToMediaQuery } from '../hooks/useMediaQuery.
|
|
|
12
15
|
* 4) Those DesignValue props which can NOT be converted to CSS (custom design props) should be resolved dynamically
|
|
13
16
|
* for each breakpoint
|
|
14
17
|
*/
|
|
15
|
-
const parseComponentProps = ({ componentDefinition, node, resolveClassNamesFromBuiltInStyles, resolveCustomDesignValue, resolveBoundValue, resolveHyperlinkValue, resolveUnboundValue, }) => {
|
|
18
|
+
const parseComponentProps = ({ mainBreakpoint, componentDefinition, node, resolveClassNamesFromBuiltInStyles, resolveCustomDesignValue, resolveBoundValue, resolveHyperlinkValue, resolveUnboundValue, }) => {
|
|
16
19
|
const styleProps = {};
|
|
17
20
|
const customDesignProps = {};
|
|
18
21
|
const contentProps = {};
|
|
@@ -41,7 +44,13 @@ const parseComponentProps = ({ componentDefinition, node, resolveClassNamesFromB
|
|
|
41
44
|
dataType: propDefinition.type,
|
|
42
45
|
binding: propertyValue,
|
|
43
46
|
});
|
|
44
|
-
|
|
47
|
+
const propValue = boundValue ?? propDefinition.defaultValue;
|
|
48
|
+
if (isSpecialCaseCssProp(propName)) {
|
|
49
|
+
styleProps[propName] = { [mainBreakpoint.id]: propValue };
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
contentProps[propName] = propValue;
|
|
53
|
+
}
|
|
45
54
|
break;
|
|
46
55
|
}
|
|
47
56
|
case 'HyperlinkValue': {
|
|
@@ -58,7 +67,12 @@ const parseComponentProps = ({ componentDefinition, node, resolveClassNamesFromB
|
|
|
58
67
|
mappingKey: propertyValue.key,
|
|
59
68
|
defaultValue: propDefinition.defaultValue,
|
|
60
69
|
});
|
|
61
|
-
|
|
70
|
+
if (isSpecialCaseCssProp(propName)) {
|
|
71
|
+
styleProps[propName] = { [mainBreakpoint.id]: unboundValue };
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
contentProps[propName] = unboundValue;
|
|
75
|
+
}
|
|
62
76
|
break;
|
|
63
77
|
}
|
|
64
78
|
case 'ComponentValue':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseComponentProps.js","sources":["../../../src/utils/parseComponentProps.ts"],"sourcesContent":["import { isCfStyleAttribute } from '@contentful/experiences-core';\nimport {\n BoundComponentPropertyTypes,\n BoundValue,\n ComponentDefinition,\n ComponentDefinitionVariable,\n ComponentDefinitionVariableType,\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n} from '@contentful/experiences-core/types';\nimport { convertResolvedDesignValuesToMediaQuery } from '../hooks/useMediaQuery';\n\n/**\n * The previous logic of prop mapping was too complex and mixed different ues cases together.\n * In this function, I aim to simplify the logic by focusing on the following specific cases FOR PREVIEW/DELIVERY MODES\n * 1) Any non `DesignValue` props should be resolved and returned as is\n * 2) Some exceptions like `cfImageAsset` and `cfBackgroundImageUrl` (BoundValue) should be handled separately\n * and be resolved for the default breakpoint only (cause we don't allow binding per breakpoint anyway)\n * 3) Those DesignValue props which can be converted to CSS should be grouped and resolved into a CSS media query\n * for each breakpoint\n * 4) Those DesignValue props which can NOT be converted to CSS (custom design props) should be resolved dynamically\n * for each breakpoint\n */\nexport const parseComponentProps = ({\n componentDefinition,\n node,\n resolveClassNamesFromBuiltInStyles,\n resolveCustomDesignValue,\n resolveBoundValue,\n resolveHyperlinkValue,\n resolveUnboundValue,\n}: {\n node: ComponentTreeNode;\n componentDefinition: ComponentDefinition;\n resolveClassNamesFromBuiltInStyles: (\n propsByBreakpointId: Record<string, Record<string, PrimitiveValue>>,\n ) => Array<{ className: string; breakpointCondition: string; css: string }>;\n resolveCustomDesignValue: (data: {\n propertyName: string;\n valuesByBreakpoint: Record<string, any>;\n }) => PrimitiveValue;\n resolveBoundValue: (data: {\n propertyName: string;\n dataType: ComponentDefinitionVariableType;\n binding: BoundValue;\n }) => BoundComponentPropertyTypes;\n resolveHyperlinkValue: (data: { linkTargetKey: string }) => string | null;\n resolveUnboundValue: (data: {\n mappingKey: string;\n defaultValue: ComponentDefinitionVariable['defaultValue'];\n }) => any;\n}) => {\n const styleProps: Record<string, DesignValue['valuesByBreakpoint']> = {};\n const customDesignProps: Record<string, PrimitiveValue> = {};\n const contentProps: Record<string, any> = {};\n\n for (const [propName, propDefinition] of Object.entries(componentDefinition.variables)) {\n const propertyValue = node.variables[propName];\n if (!propertyValue) continue;\n\n switch (propertyValue.type) {\n case 'DesignValue': {\n if (isCfStyleAttribute(propName)) {\n // for such properties we know how to convert them to CSS, so we will build a media query from it below after the loop is over\n styleProps[propName] = propertyValue.valuesByBreakpoint;\n } else {\n // for custom design props, the value will be resolved with the javascript per breakpoint at runtime\n customDesignProps[propName] = resolveCustomDesignValue({\n propertyName: propName,\n valuesByBreakpoint: propertyValue.valuesByBreakpoint,\n });\n }\n break;\n }\n case 'BoundValue': {\n const boundValue = resolveBoundValue({\n propertyName: propName,\n dataType: propDefinition.type as ComponentDefinitionVariableType,\n binding: propertyValue,\n });\n
|
|
1
|
+
{"version":3,"file":"parseComponentProps.js","sources":["../../../src/utils/parseComponentProps.ts"],"sourcesContent":["import { isCfStyleAttribute } from '@contentful/experiences-core';\nimport {\n BoundComponentPropertyTypes,\n BoundValue,\n Breakpoint,\n ComponentDefinition,\n ComponentDefinitionVariable,\n ComponentDefinitionVariableType,\n ComponentTreeNode,\n DesignValue,\n PrimitiveValue,\n} from '@contentful/experiences-core/types';\nimport { convertResolvedDesignValuesToMediaQuery } from '../hooks/useMediaQuery';\n\nconst isSpecialCaseCssProp = (propName: string) => {\n return propName === 'cfBackgroundImageUrl' || propName.startsWith('cfBackgroundImageUrl_');\n};\n\n/**\n * The previous logic of prop mapping was too complex and mixed different ues cases together.\n * In this function, I aim to simplify the logic by focusing on the following specific cases FOR PREVIEW/DELIVERY MODES\n * 1) Any non `DesignValue` props should be resolved and returned as is\n * 2) Some exceptions like `cfImageAsset` and `cfBackgroundImageUrl` (BoundValue) should be handled separately\n * and be resolved for the default breakpoint only (cause we don't allow binding per breakpoint anyway)\n * 3) Those DesignValue props which can be converted to CSS should be grouped and resolved into a CSS media query\n * for each breakpoint\n * 4) Those DesignValue props which can NOT be converted to CSS (custom design props) should be resolved dynamically\n * for each breakpoint\n */\nexport const parseComponentProps = ({\n mainBreakpoint,\n componentDefinition,\n node,\n resolveClassNamesFromBuiltInStyles,\n resolveCustomDesignValue,\n resolveBoundValue,\n resolveHyperlinkValue,\n resolveUnboundValue,\n}: {\n mainBreakpoint: Breakpoint;\n node: ComponentTreeNode;\n componentDefinition: ComponentDefinition;\n resolveClassNamesFromBuiltInStyles: (\n propsByBreakpointId: Record<string, Record<string, PrimitiveValue>>,\n ) => Array<{ className: string; breakpointCondition: string; css: string }>;\n resolveCustomDesignValue: (data: {\n propertyName: string;\n valuesByBreakpoint: Record<string, any>;\n }) => PrimitiveValue;\n resolveBoundValue: (data: {\n propertyName: string;\n dataType: ComponentDefinitionVariableType;\n binding: BoundValue;\n }) => BoundComponentPropertyTypes;\n resolveHyperlinkValue: (data: { linkTargetKey: string }) => string | null;\n resolveUnboundValue: (data: {\n mappingKey: string;\n defaultValue: ComponentDefinitionVariable['defaultValue'];\n }) => any;\n}) => {\n const styleProps: Record<string, DesignValue['valuesByBreakpoint']> = {};\n const customDesignProps: Record<string, PrimitiveValue> = {};\n const contentProps: Record<string, any> = {};\n\n for (const [propName, propDefinition] of Object.entries(componentDefinition.variables)) {\n const propertyValue = node.variables[propName];\n if (!propertyValue) continue;\n\n switch (propertyValue.type) {\n case 'DesignValue': {\n if (isCfStyleAttribute(propName)) {\n // for such properties we know how to convert them to CSS, so we will build a media query from it below after the loop is over\n styleProps[propName] = propertyValue.valuesByBreakpoint;\n } else {\n // for custom design props, the value will be resolved with the javascript per breakpoint at runtime\n customDesignProps[propName] = resolveCustomDesignValue({\n propertyName: propName,\n valuesByBreakpoint: propertyValue.valuesByBreakpoint,\n });\n }\n break;\n }\n case 'BoundValue': {\n const boundValue = resolveBoundValue({\n propertyName: propName,\n dataType: propDefinition.type as ComponentDefinitionVariableType,\n binding: propertyValue,\n });\n\n const propValue = boundValue ?? propDefinition.defaultValue;\n\n if (isSpecialCaseCssProp(propName)) {\n styleProps[propName] = { [mainBreakpoint.id]: propValue };\n } else {\n contentProps[propName] = propValue;\n }\n propValue;\n break;\n }\n\n case 'HyperlinkValue': {\n const hyperlink = resolveHyperlinkValue({\n linkTargetKey: propertyValue.linkTargetKey,\n });\n if (hyperlink) {\n contentProps[propName] = hyperlink;\n }\n break;\n }\n case 'UnboundValue': {\n const unboundValue = resolveUnboundValue({\n mappingKey: propertyValue.key,\n defaultValue: propDefinition.defaultValue,\n });\n\n if (isSpecialCaseCssProp(propName)) {\n styleProps[propName] = { [mainBreakpoint.id]: unboundValue };\n } else {\n contentProps[propName] = unboundValue;\n }\n break;\n }\n case 'ComponentValue':\n // We're rendering a pattern entry. Content cannot be set for ComponentValue type properties\n // directly in the pattern so we can safely use the default value\n // This can either a design (style) or a content variable\n contentProps[propName] = propDefinition.defaultValue;\n break;\n default:\n break;\n }\n }\n\n /**\n * {\n desktop: {\n cfVerticalAlignment: 'center',\n cfHorizontalAlignment: 'center',\n cfMargin: '0 0 0 0',\n cfPadding: '0 0 0 0',\n cfBackgroundColor: 'rgba(246, 246, 246, 1)',\n cfWidth: 'fill',\n cfHeight: 'fit-content',\n cfMaxWidth: 'none',\n cfFlexDirection: 'column',\n cfFlexWrap: 'nowrap',\n cfBorder: '0px solid rgba(0, 0, 0, 0)',\n cfBorderRadius: '0px',\n cfGap: '0px 0px',\n cfBackgroundImageOptions: { scaling: 'fill', alignment: 'left top', targetSize: '2000px' }\n },\n tablet: {},\n mobile: {}\n }\n */\n const stylePropsIndexedByBreakpoint = Object.entries(styleProps).reduce<\n Record<string, Record<string, PrimitiveValue>>\n >((acc, [propName, valuesByBreakpoint]) => {\n for (const [breakpointId, value] of Object.entries(valuesByBreakpoint)) {\n if (!acc[breakpointId]) {\n acc[breakpointId] = {};\n }\n\n acc[breakpointId][propName] = value;\n }\n\n return acc;\n }, {});\n\n /**\n * [\n * {\n * className: 'cfstyles-123',\n * breakpointCondition: '<=1024px',\n * css: '.cfstyles-123 { color: red; }'\n * },\n * {\n * className: 'cfstyles-456',\n * breakpointCondition: '<=768px',\n * css: '.cfstyles-456 { color: blue; }'\n * }\n * ]\n */\n const styleSheetData = resolveClassNamesFromBuiltInStyles(stylePropsIndexedByBreakpoint);\n\n /**\n * {\n * className: ['cfstyles-123', 'cfstyles-456'],\n * styleSheet: `\n * @media (max-width: 1024px) {\n * .cfstyles-123 { color: red; }\n * }\n * @media (max-width: 768px) {\n * .cfstyles-456 { color: blue; }\n * }\n * `\n * }\n */\n const mediaQuery = convertResolvedDesignValuesToMediaQuery(styleSheetData);\n\n return {\n styleProps,\n mediaQuery,\n customDesignProps,\n contentProps,\n };\n};\n"],"names":[],"mappings":";;;AAcA,MAAM,oBAAoB,GAAG,CAAC,QAAgB,KAAI;IAChD,OAAO,QAAQ,KAAK,sBAAsB,IAAI,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7F,CAAC,CAAC;AAEF;;;;;;;;;;AAUG;MACU,mBAAmB,GAAG,CAAC,EAClC,cAAc,EACd,mBAAmB,EACnB,IAAI,EACJ,kCAAkC,EAClC,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,GAsBpB,KAAI;IACH,MAAM,UAAU,GAAsD,EAAE,CAAC;IACzE,MAAM,iBAAiB,GAAmC,EAAE,CAAC;IAC7D,MAAM,YAAY,GAAwB,EAAE,CAAC;AAE7C,IAAA,KAAK,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE;QACtF,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC/C,QAAA,IAAI,CAAC,aAAa;YAAE,SAAS;AAE7B,QAAA,QAAQ,aAAa,CAAC,IAAI;YACxB,KAAK,aAAa,EAAE;AAClB,gBAAA,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE;;AAEhC,oBAAA,UAAU,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,kBAAkB,CAAC;iBACzD;qBAAM;;AAEL,oBAAA,iBAAiB,CAAC,QAAQ,CAAC,GA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AAC,QAAQ,CAAC,GAAG,YAAY,CAAC;iBACvC;gBACD,MAAM;aACP;AACD,YAAA,KAAK,gBAAgB;;;;AAInB,gBAAA,YAAY,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,YAAY,CAAC;gBACrD,MAAM;SAGT;KACF;AAED;;;;;;;;;;;;;;;;;;;;;AAqBE;IACF,MAAM,6BAA6B,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAErE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,KAAI;AACxC,QAAA,KAAK,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE;AACtE,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;AACtB,gBAAA,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;aACxB;YAED,GAAG,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;SACrC;AAED,QAAA,OAAO,GAAG,CAAC;KACZ,EAAE,EAAE,CAAC,CAAC;AAEP;;;;;;;;;;;;;AAaG;AACH,IAAA,MAAM,cAAc,GAAG,kCAAkC,CAAC,6BAA6B,CAAC,CAAC;AAEzF;;;;;;;;;;;;AAYG;AACH,IAAA,MAAM,UAAU,GAAG,uCAAuC,CAAC,cAAc,CAAC,CAAC;IAE3E,OAAO;QACL,UAAU;QACV,UAAU;QACV,iBAAiB;QACjB,YAAY;KACb,CAAC;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experiences-sdk-react",
|
|
3
|
-
"version": "1.30.5-prerelease-
|
|
3
|
+
"version": "1.30.5-prerelease-20250207T1706-1350c89.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/src/index.d.ts",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"depcruise": "depcruise src"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@contentful/experiences-components-react": "1.30.5-prerelease-
|
|
45
|
-
"@contentful/experiences-core": "1.30.5-prerelease-
|
|
46
|
-
"@contentful/experiences-validators": "1.30.5-prerelease-
|
|
47
|
-
"@contentful/experiences-visual-editor-react": "1.30.5-prerelease-
|
|
44
|
+
"@contentful/experiences-components-react": "1.30.5-prerelease-20250207T1706-1350c89.0",
|
|
45
|
+
"@contentful/experiences-core": "1.30.5-prerelease-20250207T1706-1350c89.0",
|
|
46
|
+
"@contentful/experiences-validators": "1.30.5-prerelease-20250207T1706-1350c89.0",
|
|
47
|
+
"@contentful/experiences-visual-editor-react": "1.30.5-prerelease-20250207T1706-1350c89.0",
|
|
48
48
|
"@contentful/rich-text-types": "^17.0.0",
|
|
49
49
|
"classnames": "^2.3.2",
|
|
50
50
|
"csstype": "^3.1.2",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"dist",
|
|
103
103
|
"package.json"
|
|
104
104
|
],
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "50e358e850c25ab69036efa2f5ac04f1eb7a4d34"
|
|
106
106
|
}
|