@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/renderApp.js
CHANGED
|
@@ -42834,13 +42834,31 @@ const optionalBuiltInStyles = {
|
|
|
42834
42834
|
};
|
|
42835
42835
|
|
|
42836
42836
|
let designTokensRegistry = {};
|
|
42837
|
+
// This function is used to ensure that the composite values are valid since composite values are optional.
|
|
42838
|
+
// Therefore only border and in the future text related design tokens are/will be checked in this funciton.
|
|
42839
|
+
// Ensuring values for simple key-value design tokens are not neccessary since they are required via typescript.
|
|
42840
|
+
const ensureValidCompositeValues = (designTokenDefinition) => {
|
|
42841
|
+
// TODO: add validation logic when text related design tokens are added
|
|
42842
|
+
// Border validation
|
|
42843
|
+
if (designTokenDefinition.border) {
|
|
42844
|
+
for (const borderKey in designTokenDefinition.border) {
|
|
42845
|
+
const borderValue = designTokenDefinition.border[borderKey];
|
|
42846
|
+
designTokenDefinition.border[borderKey] = {
|
|
42847
|
+
width: borderValue.width || '1px',
|
|
42848
|
+
style: borderValue.style || 'solid',
|
|
42849
|
+
color: borderValue.color || '#000000',
|
|
42850
|
+
};
|
|
42851
|
+
}
|
|
42852
|
+
}
|
|
42853
|
+
return designTokenDefinition;
|
|
42854
|
+
};
|
|
42837
42855
|
/**
|
|
42838
42856
|
* Register design tokens styling
|
|
42839
42857
|
* @param designTokenDefinition - {[key:string]: Record<string, string>}
|
|
42840
42858
|
* @returns void
|
|
42841
42859
|
*/
|
|
42842
42860
|
const defineDesignTokens = (designTokenDefinition) => {
|
|
42843
|
-
Object.assign(designTokensRegistry, designTokenDefinition);
|
|
42861
|
+
Object.assign(designTokensRegistry, ensureValidCompositeValues(designTokenDefinition));
|
|
42844
42862
|
};
|
|
42845
42863
|
const templateStringRegex = /\${(.+?)}/g;
|
|
42846
42864
|
const getDesignTokenRegistration = (breakpointValue, variableName) => {
|