@teleporthq/teleport-shared
Advanced tools
Comparing version
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.capitalize = capitalize; | ||
var dashCaseToUpperCamelCase = function (str) { return exports.capitalize(exports.dashCaseToCamelCase(str)); }; | ||
var dashCaseToUpperCamelCase = function (str) { return (0, exports.capitalize)((0, exports.dashCaseToCamelCase)(str)); }; | ||
exports.dashCaseToUpperCamelCase = dashCaseToUpperCamelCase; | ||
@@ -47,3 +47,3 @@ var removeIllegalCharacters = function (str) { | ||
// add indent to all the other lines | ||
return respaced.replace(/\n/g, "\n" + spaces); | ||
return respaced.replace(/\n/g, "\n".concat(spaces)); | ||
}; | ||
@@ -77,5 +77,5 @@ exports.addSpacesToEachLine = addSpacesToEachLine; | ||
var generateCSSVariableName = function (name) { | ||
return name.startsWith('--') ? exports.camelCaseToDashCase(name) : exports.camelCaseToDashCase("--" + name); | ||
return name.startsWith('--') ? (0, exports.camelCaseToDashCase)(name) : (0, exports.camelCaseToDashCase)("--".concat(name)); | ||
}; | ||
exports.generateCSSVariableName = generateCSSVariableName; | ||
//# sourceMappingURL=string-utils.js.map |
@@ -14,7 +14,7 @@ "use strict"; | ||
var createWebComponentFriendlyName = function (componentName) { | ||
var dashCaseName = string_utils_1.camelCaseToDashCase(componentName); | ||
var dashCaseName = (0, string_utils_1.camelCaseToDashCase)(componentName); | ||
if (dashCaseName.includes('-')) { | ||
return dashCaseName; | ||
} | ||
return "app-" + dashCaseName; | ||
return "app-".concat(dashCaseName); | ||
}; | ||
@@ -25,17 +25,17 @@ exports.createWebComponentFriendlyName = createWebComponentFriendlyName; | ||
var defaultComponentName = 'AppComponent'; | ||
var friendlyName = string_utils_1.removeIllegalCharacters(uidl.name) || defaultComponentName; | ||
var friendlyName = (0, string_utils_1.removeIllegalCharacters)(uidl.name) || defaultComponentName; | ||
if (!uidl.outputOptions.fileName) { | ||
uidl.outputOptions.fileName = string_utils_1.camelCaseToDashCase(friendlyName); | ||
uidl.outputOptions.fileName = (0, string_utils_1.camelCaseToDashCase)(friendlyName); | ||
} | ||
if (!uidl.outputOptions.componentClassName) { | ||
uidl.outputOptions.componentClassName = string_utils_1.dashCaseToUpperCamelCase(friendlyName); | ||
uidl.outputOptions.componentClassName = (0, string_utils_1.dashCaseToUpperCamelCase)(friendlyName); | ||
} | ||
// failsafe for invalid UIDL samples with illegal characters as element names | ||
// when used in projects, resolveLocalDependencies should handle this | ||
exports.traverseElements(uidl.node, function (element) { | ||
(0, exports.traverseElements)(uidl.node, function (element) { | ||
if (element.dependency) { | ||
element.semanticType = string_utils_1.dashCaseToUpperCamelCase(string_utils_1.removeIllegalCharacters(element.semanticType) || defaultComponentName); | ||
element.semanticType = (0, string_utils_1.dashCaseToUpperCamelCase)((0, string_utils_1.removeIllegalCharacters)(element.semanticType) || defaultComponentName); | ||
} | ||
else { | ||
element.semanticType = string_utils_1.removeIllegalCharacters(element.semanticType); | ||
element.semanticType = (0, string_utils_1.removeIllegalCharacters)(element.semanticType); | ||
} | ||
@@ -48,7 +48,7 @@ }); | ||
? component.outputOptions.fileName | ||
: string_utils_1.camelCaseToDashCase(exports.getComponentClassName(component)); | ||
: (0, string_utils_1.camelCaseToDashCase)((0, exports.getComponentClassName)(component)); | ||
}; | ||
exports.getComponentFileName = getComponentFileName; | ||
var getStyleFileName = function (component) { | ||
var componentFileName = exports.getComponentFileName(component); | ||
var componentFileName = (0, exports.getComponentFileName)(component); | ||
// If component meta style file name is not set, we default to the component file name | ||
@@ -61,3 +61,3 @@ return component.outputOptions && component.outputOptions.styleFileName | ||
var getTemplateFileName = function (component) { | ||
var componentFileName = exports.getComponentFileName(component); | ||
var componentFileName = (0, exports.getComponentFileName)(component); | ||
// If component meta style file name is not set, we default to the component file name | ||
@@ -104,3 +104,3 @@ return component.outputOptions && component.outputOptions.templateFileName | ||
} | ||
return prefix + "/" + originalString; | ||
return "".concat(prefix, "/").concat(originalString); | ||
}; | ||
@@ -122,3 +122,3 @@ exports.prefixAssetsPath = prefixAssetsPath; | ||
Object.keys(attrs_1).forEach(function (attrKey) { | ||
exports.traverseNodes(attrs_1[attrKey], fn, node); | ||
(0, exports.traverseNodes)(attrs_1[attrKey], fn, node); | ||
}); | ||
@@ -137,7 +137,7 @@ } | ||
if (((_a = abilities === null || abilities === void 0 ? void 0 : abilities.link) === null || _a === void 0 ? void 0 : _a.type) === 'url') { | ||
exports.traverseNodes((_c = (_b = abilities === null || abilities === void 0 ? void 0 : abilities.link) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.url, fn, node); | ||
(0, exports.traverseNodes)((_c = (_b = abilities === null || abilities === void 0 ? void 0 : abilities.link) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c.url, fn, node); | ||
} | ||
if (children) { | ||
children.forEach(function (child) { | ||
exports.traverseNodes(child, fn, node); | ||
(0, exports.traverseNodes)(child, fn, node); | ||
}); | ||
@@ -147,12 +147,12 @@ } | ||
case 'repeat': | ||
exports.traverseNodes(node.content.node, fn, node); | ||
exports.traverseNodes(node.content.dataSource, fn, node); | ||
(0, exports.traverseNodes)(node.content.node, fn, node); | ||
(0, exports.traverseNodes)(node.content.dataSource, fn, node); | ||
break; | ||
case 'conditional': | ||
exports.traverseNodes(node.content.node, fn, node); | ||
exports.traverseNodes(node.content.reference, fn, node); | ||
(0, exports.traverseNodes)(node.content.node, fn, node); | ||
(0, exports.traverseNodes)(node.content.reference, fn, node); | ||
break; | ||
case 'slot': | ||
if (node.content.fallback) { | ||
exports.traverseNodes(node.content.fallback, fn, node); | ||
(0, exports.traverseNodes)(node.content.fallback, fn, node); | ||
} | ||
@@ -167,3 +167,3 @@ break; | ||
default: | ||
throw new Error("traverseNodes was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("traverseNodes was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -188,3 +188,3 @@ }; | ||
node.content.children.forEach(function (child) { | ||
exports.traverseElements(child, fn); | ||
(0, exports.traverseElements)(child, fn); | ||
}); | ||
@@ -194,10 +194,10 @@ } | ||
case 'repeat': | ||
exports.traverseElements(node.content.node, fn); | ||
(0, exports.traverseElements)(node.content.node, fn); | ||
break; | ||
case 'conditional': | ||
exports.traverseElements(node.content.node, fn); | ||
(0, exports.traverseElements)(node.content.node, fn); | ||
break; | ||
case 'slot': | ||
if (node.content.fallback) { | ||
exports.traverseElements(node.content.fallback, fn); | ||
(0, exports.traverseElements)(node.content.fallback, fn); | ||
} | ||
@@ -210,3 +210,3 @@ break; | ||
default: | ||
throw new Error("traverseElements was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("traverseElements was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -220,3 +220,3 @@ }; | ||
node.content.children.forEach(function (child) { | ||
exports.traverseRepeats(child, fn); | ||
(0, exports.traverseRepeats)(child, fn); | ||
}); | ||
@@ -227,10 +227,10 @@ } | ||
fn(node.content); | ||
exports.traverseRepeats(node.content.node, fn); | ||
(0, exports.traverseRepeats)(node.content.node, fn); | ||
break; | ||
case 'conditional': | ||
exports.traverseRepeats(node.content.node, fn); | ||
(0, exports.traverseRepeats)(node.content.node, fn); | ||
break; | ||
case 'slot': | ||
if (node.content.fallback) { | ||
exports.traverseRepeats(node.content.fallback, fn); | ||
(0, exports.traverseRepeats)(node.content.fallback, fn); | ||
} | ||
@@ -243,3 +243,3 @@ break; | ||
default: | ||
throw new Error("traverseRepeats was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("traverseRepeats was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -265,3 +265,3 @@ }; | ||
default: | ||
throw new Error("splitDynamicAndStaticStyles encountered an unknown style definition " + JSON.stringify(styleValue, null, 2)); | ||
throw new Error("splitDynamicAndStaticStyles encountered an unknown style definition ".concat(JSON.stringify(styleValue, null, 2))); | ||
} | ||
@@ -283,3 +283,3 @@ }, responsePayload); | ||
default: | ||
throw new Error("cleanupDynamicStyles encountered an unknown style definition " + JSON.stringify(styleValue, null, 2)); | ||
throw new Error("cleanupDynamicStyles encountered an unknown style definition ".concat(JSON.stringify(styleValue, null, 2))); | ||
} | ||
@@ -305,3 +305,3 @@ }, {}); | ||
default: | ||
throw new Error("transformDynamicStyles encountered an unknown style definition " + JSON.stringify(styleValue, null, 2)); | ||
throw new Error("transformDynamicStyles encountered an unknown style definition ".concat(JSON.stringify(styleValue, null, 2))); | ||
} | ||
@@ -355,3 +355,3 @@ }, {}); | ||
if (['string', 'number'].indexOf(entityType) !== -1) { | ||
acc[key] = exports.transformStringAssignmentToJson(styleContentAtKey); | ||
acc[key] = (0, exports.transformStringAssignmentToJson)(styleContentAtKey); | ||
return acc; | ||
@@ -368,3 +368,3 @@ } | ||
} | ||
throw new Error("transformStylesAssignmentsToJson encountered a style value that is not supported " + JSON.stringify(styleContentAtKey, null, 2)); | ||
throw new Error("transformStylesAssignmentsToJson encountered a style value that is not supported ".concat(JSON.stringify(styleContentAtKey, null, 2))); | ||
}, newStyleObject); | ||
@@ -380,3 +380,3 @@ return newStyleObject; | ||
if (['string', 'number'].indexOf(entityType) !== -1) { | ||
acc[key] = exports.transformStringAssignmentToJson(attributeContent); | ||
acc[key] = (0, exports.transformStringAssignmentToJson)(attributeContent); | ||
return acc; | ||
@@ -391,5 +391,5 @@ } | ||
} | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported " + JSON.stringify(attributeContent, null, 2)); | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported ".concat(JSON.stringify(attributeContent, null, 2))); | ||
} | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported " + JSON.stringify(attributeContent, null, 2)); | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported ".concat(JSON.stringify(attributeContent, null, 2))); | ||
}, newStyleObject); | ||
@@ -410,5 +410,5 @@ return newStyleObject; | ||
var childNode = node.content.node; | ||
return exports.findFirstElementNode(childNode); | ||
return (0, exports.findFirstElementNode)(childNode); | ||
default: | ||
throw new Error("Invalid node type '" + node + "'"); | ||
throw new Error("Invalid node type '".concat(node, "'")); | ||
} | ||
@@ -424,14 +424,14 @@ }; | ||
// call function recursively for remaining children | ||
node.content.children.forEach(function (child) { return exports.removeChildNodes(child, criteria); }); | ||
node.content.children.forEach(function (child) { return (0, exports.removeChildNodes)(child, criteria); }); | ||
} | ||
break; | ||
case 'repeat': | ||
exports.removeChildNodes(node.content.node, criteria); | ||
(0, exports.removeChildNodes)(node.content.node, criteria); | ||
break; | ||
case 'conditional': | ||
exports.removeChildNodes(node.content.node, criteria); | ||
(0, exports.removeChildNodes)(node.content.node, criteria); | ||
break; | ||
case 'slot': | ||
if (node.content.fallback) { | ||
exports.removeChildNodes(node.content.fallback, criteria); | ||
(0, exports.removeChildNodes)(node.content.fallback, criteria); | ||
} | ||
@@ -444,3 +444,3 @@ break; | ||
default: | ||
throw new Error("removeChildNodes was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("removeChildNodes was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -447,0 +447,0 @@ }; |
@@ -37,3 +37,3 @@ export var camelCaseToDashCase = function (str) { | ||
// add indent to all the other lines | ||
return respaced.replace(/\n/g, "\n" + spaces); | ||
return respaced.replace(/\n/g, "\n".concat(spaces)); | ||
}; | ||
@@ -63,4 +63,4 @@ export var removeLastEmptyLine = function (str) { | ||
export var generateCSSVariableName = function (name) { | ||
return name.startsWith('--') ? camelCaseToDashCase(name) : camelCaseToDashCase("--" + name); | ||
return name.startsWith('--') ? camelCaseToDashCase(name) : camelCaseToDashCase("--".concat(name)); | ||
}; | ||
//# sourceMappingURL=string-utils.js.map |
@@ -14,3 +14,3 @@ import { ASSETS_IDENTIFIER } from '../constants'; | ||
} | ||
return "app-" + dashCaseName; | ||
return "app-".concat(dashCaseName); | ||
}; | ||
@@ -89,3 +89,3 @@ export var setFriendlyOutputOptions = function (uidl) { | ||
} | ||
return prefix + "/" + originalString; | ||
return "".concat(prefix, "/").concat(originalString); | ||
}; | ||
@@ -147,3 +147,3 @@ // Clones existing objects while keeping the type cast | ||
default: | ||
throw new Error("traverseNodes was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("traverseNodes was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -187,3 +187,3 @@ }; | ||
default: | ||
throw new Error("traverseElements was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("traverseElements was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -217,3 +217,3 @@ }; | ||
default: | ||
throw new Error("traverseRepeats was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("traverseRepeats was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -238,3 +238,3 @@ }; | ||
default: | ||
throw new Error("splitDynamicAndStaticStyles encountered an unknown style definition " + JSON.stringify(styleValue, null, 2)); | ||
throw new Error("splitDynamicAndStaticStyles encountered an unknown style definition ".concat(JSON.stringify(styleValue, null, 2))); | ||
} | ||
@@ -255,3 +255,3 @@ }, responsePayload); | ||
default: | ||
throw new Error("cleanupDynamicStyles encountered an unknown style definition " + JSON.stringify(styleValue, null, 2)); | ||
throw new Error("cleanupDynamicStyles encountered an unknown style definition ".concat(JSON.stringify(styleValue, null, 2))); | ||
} | ||
@@ -276,3 +276,3 @@ }, {}); | ||
default: | ||
throw new Error("transformDynamicStyles encountered an unknown style definition " + JSON.stringify(styleValue, null, 2)); | ||
throw new Error("transformDynamicStyles encountered an unknown style definition ".concat(JSON.stringify(styleValue, null, 2))); | ||
} | ||
@@ -336,3 +336,3 @@ }, {}); | ||
} | ||
throw new Error("transformStylesAssignmentsToJson encountered a style value that is not supported " + JSON.stringify(styleContentAtKey, null, 2)); | ||
throw new Error("transformStylesAssignmentsToJson encountered a style value that is not supported ".concat(JSON.stringify(styleContentAtKey, null, 2))); | ||
}, newStyleObject); | ||
@@ -357,5 +357,5 @@ return newStyleObject; | ||
} | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported " + JSON.stringify(attributeContent, null, 2)); | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported ".concat(JSON.stringify(attributeContent, null, 2))); | ||
} | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported " + JSON.stringify(attributeContent, null, 2)); | ||
throw new Error("transformAttributesAssignmentsToJson encountered a style value that is not supported ".concat(JSON.stringify(attributeContent, null, 2))); | ||
}, newStyleObject); | ||
@@ -377,3 +377,3 @@ return newStyleObject; | ||
default: | ||
throw new Error("Invalid node type '" + node + "'"); | ||
throw new Error("Invalid node type '".concat(node, "'")); | ||
} | ||
@@ -407,3 +407,3 @@ }; | ||
default: | ||
throw new Error("removeChildNodes was given an unsupported node type " + JSON.stringify(node, null, 2)); | ||
throw new Error("removeChildNodes was given an unsupported node type ".concat(JSON.stringify(node, null, 2))); | ||
} | ||
@@ -410,0 +410,0 @@ }; |
{ | ||
"name": "@teleporthq/teleport-shared", | ||
"version": "0.19.17", | ||
"version": "0.19.19", | ||
"description": "A utility belt for the entire teleportHQ ecosystem", | ||
@@ -28,7 +28,7 @@ "author": "teleportHQ", | ||
"@babel/types": "^7.5.5", | ||
"@teleporthq/teleport-types": "^0.19.17", | ||
"@teleporthq/teleport-types": "^0.19.19", | ||
"jss": "^10.0.0", | ||
"jss-preset-default": "^10.0.0" | ||
}, | ||
"gitHead": "4af7375f20235273eeabb48ef109cab2a02ddceb" | ||
"gitHead": "154a51920ecfcdec93d08b9db2911a2969b61d5c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
160010
0.57%2388
0.17%