@contentful/experiences-visual-editor-react 1.6.0 → 1.7.0-dev-20240604T1720-355786e.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 +19 -1
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +19 -1
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -911,13 +911,31 @@ const optionalBuiltInStyles = {
|
|
|
911
911
|
};
|
|
912
912
|
|
|
913
913
|
let designTokensRegistry = {};
|
|
914
|
+
// This function is used to ensure that the composite values are valid since composite values are optional.
|
|
915
|
+
// Therefore only border and in the future text related design tokens are/will be checked in this funciton.
|
|
916
|
+
// Ensuring values for simple key-value design tokens are not neccessary since they are required via typescript.
|
|
917
|
+
const ensureValidCompositeValues = (designTokenDefinition) => {
|
|
918
|
+
// TODO: add validation logic when text related design tokens are added
|
|
919
|
+
// Border validation
|
|
920
|
+
if (designTokenDefinition.border) {
|
|
921
|
+
for (const borderKey in designTokenDefinition.border) {
|
|
922
|
+
const borderValue = designTokenDefinition.border[borderKey];
|
|
923
|
+
designTokenDefinition.border[borderKey] = {
|
|
924
|
+
width: borderValue.width || '1px',
|
|
925
|
+
style: borderValue.style || 'solid',
|
|
926
|
+
color: borderValue.color || '#000000',
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
return designTokenDefinition;
|
|
931
|
+
};
|
|
914
932
|
/**
|
|
915
933
|
* Register design tokens styling
|
|
916
934
|
* @param designTokenDefinition - {[key:string]: Record<string, string>}
|
|
917
935
|
* @returns void
|
|
918
936
|
*/
|
|
919
937
|
const defineDesignTokens = (designTokenDefinition) => {
|
|
920
|
-
Object.assign(designTokensRegistry, designTokenDefinition);
|
|
938
|
+
Object.assign(designTokensRegistry, ensureValidCompositeValues(designTokenDefinition));
|
|
921
939
|
};
|
|
922
940
|
const templateStringRegex = /\${(.+?)}/g;
|
|
923
941
|
const getDesignTokenRegistration = (breakpointValue, variableName) => {
|