@teleporthq/teleport-uidl-validator
Advanced tools
Comparing version 0.44.0-alpha.0 to 0.45.1-alpha.0
import { Decoder } from '@mojotech/json-type-validation'; | ||
import { UIDLStaticValue, ReferenceType, UIDLDynamicReference, UIDLPropDefinition, UIDLStateDefinition, UIDLPageOptions, UIDLComponentOutputOptions, UIDLDependency, UIDLStyleDefinitions, UIDLStyleValue, UIDLAttributeValue, UIDLEventHandlerStatement, UIDLMailLinkNode, UIDLPhoneLinkNode, UIDLRawValue, UIDLElementStyleStates, UIDLStyleStateCondition, UIDLStyleMediaQueryScreenSizeCondition, UIDLStyleConditions, UIDLElementNodeProjectReferencedStyle, VUIDLComponentSEO, VUIDLGlobalAsset, UIDLExternalDependency, UIDLLocalDependency, UIDLPeerDependency, UIDLImportReference, UIDLStyleSetTokenReference, VUIDLStyleSetDefnition, VUIDLElement, VUIDLSlotNode, VUIDLConditionalNode, VUIDLRepeatNode, VUIDLElementNode, VUIDLNode, VUIDLElementNodeInlineReferencedStyle, VUIDLSectionLinkNode, VUIDLLinkNode, VUIDLURLLinkNode, VUIDLStyleSetConditions, VUIDLStyleSetMediaCondition, VUIDLStyleSetStateCondition, VUIDLDesignTokens, UIDLPropCallEvent, UIDLStateModifierEvent, UIDLScriptExternalAsset, UIDLScriptInlineAsset, VUIDLStyleInlineAsset, UIDLStyleExternalAsset, VUIDLFontAsset, UIDLCanonicalAsset, UIDLIconAsset, UIDLAssetBase, VUIDLElementNodeClassReferencedStyle, UIDLCompDynamicReference, UIDLComponentStyleReference, PagePaginationOptions, VCMSItemUIDLElementNode, VCMSListUIDLElementNode, UIDLInitialPathsData, UIDLInitialPropsData, UIDLExpressionValue, UIDLDynamicLinkNode, UIDLENVValue, UIDLPropValue, UIDLResourceItem, VUIDLNavLinkNode, VUIDLDateTimeNode, UIDLStateValue, UIDLResourceLink, UIDLLocalResource, UIDLExternalResource, VCMSListRepeaterElementNode, UIDLResourceMapper, UIDLInjectValue, VUIDLStateValueDetails, UIDLLocalFontAsset } from '@teleporthq/teleport-types'; | ||
import { UIDLStaticValue, ReferenceType, UIDLDynamicReference, UIDLPropDefinition, UIDLStateDefinition, UIDLPageOptions, UIDLComponentOutputOptions, UIDLDependency, UIDLStyleDefinitions, UIDLStyleValue, UIDLAttributeValue, UIDLEventHandlerStatement, UIDLMailLinkNode, UIDLPhoneLinkNode, UIDLRawValue, UIDLElementStyleStates, UIDLStyleStateCondition, UIDLStyleMediaQueryScreenSizeCondition, UIDLStyleConditions, UIDLElementNodeProjectReferencedStyle, VUIDLComponentSEO, VUIDLGlobalAsset, UIDLExternalDependency, UIDLLocalDependency, UIDLPeerDependency, UIDLImportReference, UIDLStyleSetTokenReference, VUIDLStyleSetDefnition, VUIDLElement, VUIDLSlotNode, VUIDLConditionalNode, VUIDLRepeatNode, VUIDLElementNode, VUIDLNode, VUIDLElementNodeInlineReferencedStyle, VUIDLSectionLinkNode, VUIDLLinkNode, VUIDLURLLinkNode, VUIDLStyleSetConditions, VUIDLStyleSetMediaCondition, VUIDLStyleSetStateCondition, VUIDLDesignTokens, UIDLPropCallEvent, UIDLStateModifierEvent, UIDLScriptExternalAsset, UIDLScriptInlineAsset, VUIDLStyleInlineAsset, UIDLStyleExternalAsset, VUIDLFontAsset, UIDLCanonicalAsset, UIDLIconAsset, UIDLAssetBase, VUIDLElementNodeClassReferencedStyle, UIDLCompDynamicReference, UIDLComponentStyleReference, PagePaginationOptions, VCMSItemUIDLElementNode, VCMSListUIDLElementNode, UIDLInitialPathsData, UIDLInitialPropsData, UIDLExpressionValue, UIDLDynamicLinkNode, UIDLENVValue, UIDLPropValue, UIDLResourceItem, VUIDLNavLinkNode, VUIDLDateTimeNode, UIDLStateValue, UIDLResourceLink, UIDLLocalResource, UIDLExternalResource, VCMSListRepeaterElementNode, UIDLResourceMapper, UIDLInjectValue, VUIDLStateValueDetails, VUIDLCMSMixedTypeNode, UIDLLocalFontAsset } from '@teleporthq/teleport-types'; | ||
export declare const referenceTypeDecoder: Decoder<ReferenceType>; | ||
@@ -79,3 +79,4 @@ export declare const dynamicValueDecoder: Decoder<UIDLDynamicReference>; | ||
export declare const cmsListRepeaterNodeDecoder: Decoder<VCMSListRepeaterElementNode>; | ||
export declare const cmsMixedTypeNodeDecoder: Decoder<VUIDLCMSMixedTypeNode>; | ||
export declare const uidlNodeDecoder: Decoder<VUIDLNode>; | ||
//# sourceMappingURL=utils.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dynamicLinkDecoder = exports.urlLinkNodeDecoder = exports.stateChangeEventDecoder = exports.propCallEventDecoder = exports.eventHandlerStatementDecoder = exports.styleDefinitionsDecoder = exports.styleValueDecoder = exports.uidlComponentStyleReference = exports.attributeValueDecoder = exports.importReferenceDecoder = exports.resourceMapperDecoder = exports.dependencyDecoder = exports.localDependencyDecoder = exports.externaldependencyDecoder = exports.peerDependencyDecoder = exports.outputOptionsDecoder = exports.pageOptionsDecoder = exports.stateDefinitionsDecoder = exports.pageOptionsPaginationDecoder = exports.propDefinitionsDecoder = exports.stateValueDetailsDecoder = exports.componentSeoDecoder = exports.iconAssetDecoder = exports.canonicalAssetDecoder = exports.localFontDecoder = exports.fontAssetDecoder = exports.externalStyleAssetDecoder = exports.inlineStyletAssetDecoder = exports.externalScriptAssetDecoder = exports.inlineScriptAssetDecoder = exports.baseAssetDecoder = exports.globalAssetsDecoder = exports.stateOrPropDefinitionDecoder = exports.styleSetDefinitionDecoder = exports.tokenReferenceDecoder = exports.projectStyleConditionsDecoder = exports.styleSetStateConditionDecoder = exports.styleSetMediaConditionDecoder = exports.injectValueDecoder = exports.initialPathsDecoder = exports.initialPropsDecoder = exports.resourceItemDecoder = exports.dyamicFunctionStateParam = exports.dyamicFunctionParam = exports.envValueDecoder = exports.rawValueDecoder = exports.staticValueDecoder = exports.expressionValueDecoder = exports.dynamicValueDecoder = exports.referenceTypeDecoder = void 0; | ||
exports.uidlNodeDecoder = exports.cmsListRepeaterNodeDecoder = exports.cmsListNodeDecoder = exports.cmsItemNodeDecoder = exports.uidlResourceLinkDecoder = exports.uidlExternalResourceDecoder = exports.uidlLocalResourcerDecpder = exports.dateTimeNodeDecoder = exports.elementNodeDecoder = exports.conditionalNodeDecoder = exports.repeatNodeDecoder = exports.slotNodeDecoder = exports.elementDecoder = exports.designTokensDecoder = exports.elementComponentReferencedStyle = exports.classDynamicReferenceDecoder = exports.elementInlineReferencedStyle = exports.elementProjectReferencedStyle = exports.styleConditionsDecoder = exports.elementStyleWithMediaConditionDecoder = exports.elementStyleWithStateConditionDecoder = exports.elementStateDecoder = exports.uidlLinkNodeDecoder = exports.phoneLinkNodeDecoder = exports.uidlMailLinkNodeDecoder = exports.navLinkNodeDecoder = exports.sectionLinkNodeDecoder = void 0; | ||
exports.uidlNodeDecoder = exports.cmsMixedTypeNodeDecoder = exports.cmsListRepeaterNodeDecoder = exports.cmsListNodeDecoder = exports.cmsItemNodeDecoder = exports.uidlResourceLinkDecoder = exports.uidlExternalResourceDecoder = exports.uidlLocalResourcerDecpder = exports.dateTimeNodeDecoder = exports.elementNodeDecoder = exports.conditionalNodeDecoder = exports.repeatNodeDecoder = exports.slotNodeDecoder = exports.elementDecoder = exports.designTokensDecoder = exports.elementComponentReferencedStyle = exports.classDynamicReferenceDecoder = exports.elementInlineReferencedStyle = exports.elementProjectReferencedStyle = exports.styleConditionsDecoder = exports.elementStyleWithMediaConditionDecoder = exports.elementStyleWithStateConditionDecoder = exports.elementStateDecoder = exports.uidlLinkNodeDecoder = exports.phoneLinkNodeDecoder = exports.uidlMailLinkNodeDecoder = exports.navLinkNodeDecoder = exports.sectionLinkNodeDecoder = void 0; | ||
var json_type_validation_1 = require("@mojotech/json-type-validation"); | ||
@@ -490,3 +490,18 @@ var custom_combinators_1 = require("./custom-combinators"); | ||
}); | ||
exports.uidlNodeDecoder = (0, json_type_validation_1.union)(exports.elementNodeDecoder, exports.cmsItemNodeDecoder, exports.cmsListNodeDecoder, exports.cmsListRepeaterNodeDecoder, exports.dynamicValueDecoder, exports.rawValueDecoder, exports.conditionalNodeDecoder, (0, json_type_validation_1.union)(exports.staticValueDecoder, exports.repeatNodeDecoder, exports.slotNodeDecoder, exports.expressionValueDecoder, (0, json_type_validation_1.string)())); | ||
exports.cmsMixedTypeNodeDecoder = (0, json_type_validation_1.object)({ | ||
type: (0, json_type_validation_1.constant)('cms-mixed-type'), | ||
content: (0, json_type_validation_1.object)({ | ||
elementType: (0, json_type_validation_1.string)(), | ||
name: (0, json_type_validation_1.withDefault)('cms-mixed-type', (0, json_type_validation_1.string)()), | ||
attrs: (0, json_type_validation_1.withDefault)({}, (0, json_type_validation_1.lazy)(function () { return (0, json_type_validation_1.dict)((0, json_type_validation_1.union)(exports.attributeValueDecoder, (0, json_type_validation_1.string)(), (0, json_type_validation_1.number)())); })), | ||
renderPropIdentifier: (0, json_type_validation_1.string)(), | ||
nodes: (0, json_type_validation_1.object)({ | ||
fallback: (0, json_type_validation_1.optional)((0, json_type_validation_1.lazy)(function () { return exports.elementNodeDecoder; })), | ||
error: (0, json_type_validation_1.optional)((0, json_type_validation_1.lazy)(function () { return exports.elementNodeDecoder; })), | ||
}), | ||
dependency: (0, json_type_validation_1.optional)((0, json_type_validation_1.lazy)(function () { return exports.dependencyDecoder; })), | ||
mappings: (0, json_type_validation_1.withDefault)({}, (0, json_type_validation_1.dict)((0, json_type_validation_1.lazy)(function () { return exports.elementNodeDecoder; }))), | ||
}), | ||
}); | ||
exports.uidlNodeDecoder = (0, json_type_validation_1.union)(exports.elementNodeDecoder, exports.dynamicValueDecoder, exports.rawValueDecoder, exports.conditionalNodeDecoder, (0, json_type_validation_1.union)(exports.staticValueDecoder, exports.repeatNodeDecoder, exports.slotNodeDecoder, exports.expressionValueDecoder, (0, json_type_validation_1.string)()), (0, json_type_validation_1.union)(exports.cmsItemNodeDecoder, exports.cmsListNodeDecoder, exports.cmsListRepeaterNodeDecoder, exports.cmsMixedTypeNodeDecoder)); | ||
//# sourceMappingURL=utils.js.map |
@@ -94,3 +94,3 @@ "use strict"; | ||
case 'cms-item': | ||
case 'cms-list': | ||
case 'cms-list': { | ||
var _c = node.content, initialData = _c.initialData, _d = _c.nodes, success = _d.success, error = _d.error, loading = _d.loading, resource = _c.resource; | ||
@@ -125,3 +125,4 @@ if (initialData) { | ||
return node; | ||
case 'cms-list-repeater': | ||
} | ||
case 'cms-list-repeater': { | ||
var _e = node.content.nodes, list = _e.list, empty = _e.empty; | ||
@@ -137,2 +138,20 @@ if (list) { | ||
return node; | ||
} | ||
case 'cms-mixed-type': { | ||
var _f = node.content, _g = _f.nodes, fallback = _g.fallback, error = _g.error, dependency = _f.dependency, attrs = _f.attrs; | ||
if (attrs) { | ||
; | ||
node.content.attrs = | ||
teleport_shared_1.UIDLUtils.transformAttributesAssignmentsToJson(attrs, dependency && (dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local'); | ||
} | ||
if (fallback) { | ||
; | ||
node.content.nodes.fallback = parseComponentNode(fallback, component); | ||
} | ||
if (error) { | ||
; | ||
node.content.nodes.error = parseComponentNode(error, component); | ||
} | ||
return node; | ||
} | ||
case 'element': | ||
@@ -185,3 +204,3 @@ var elementContent = node.content; | ||
if ((_b = elementContent === null || elementContent === void 0 ? void 0 : elementContent.abilities) === null || _b === void 0 ? void 0 : _b.hasOwnProperty('link')) { | ||
var _f = elementContent.abilities.link, content = _f.content, type = _f.type; | ||
var _h = elementContent.abilities.link, content = _h.content, type = _h.type; | ||
if (type === 'navlink' && typeof content.routeName === 'string') { | ||
@@ -188,0 +207,0 @@ var route = { |
import { Decoder } from '@mojotech/json-type-validation'; | ||
import { UIDLStaticValue, ReferenceType, UIDLDynamicReference, UIDLPropDefinition, UIDLStateDefinition, UIDLPageOptions, UIDLComponentOutputOptions, UIDLDependency, UIDLStyleDefinitions, UIDLStyleValue, UIDLAttributeValue, UIDLEventHandlerStatement, UIDLMailLinkNode, UIDLPhoneLinkNode, UIDLRawValue, UIDLElementStyleStates, UIDLStyleStateCondition, UIDLStyleMediaQueryScreenSizeCondition, UIDLStyleConditions, UIDLElementNodeProjectReferencedStyle, VUIDLComponentSEO, VUIDLGlobalAsset, UIDLExternalDependency, UIDLLocalDependency, UIDLPeerDependency, UIDLImportReference, UIDLStyleSetTokenReference, VUIDLStyleSetDefnition, VUIDLElement, VUIDLSlotNode, VUIDLConditionalNode, VUIDLRepeatNode, VUIDLElementNode, VUIDLNode, VUIDLElementNodeInlineReferencedStyle, VUIDLSectionLinkNode, VUIDLLinkNode, VUIDLURLLinkNode, VUIDLStyleSetConditions, VUIDLStyleSetMediaCondition, VUIDLStyleSetStateCondition, VUIDLDesignTokens, UIDLPropCallEvent, UIDLStateModifierEvent, UIDLScriptExternalAsset, UIDLScriptInlineAsset, VUIDLStyleInlineAsset, UIDLStyleExternalAsset, VUIDLFontAsset, UIDLCanonicalAsset, UIDLIconAsset, UIDLAssetBase, VUIDLElementNodeClassReferencedStyle, UIDLCompDynamicReference, UIDLComponentStyleReference, PagePaginationOptions, VCMSItemUIDLElementNode, VCMSListUIDLElementNode, UIDLInitialPathsData, UIDLInitialPropsData, UIDLExpressionValue, UIDLDynamicLinkNode, UIDLENVValue, UIDLPropValue, UIDLResourceItem, VUIDLNavLinkNode, VUIDLDateTimeNode, UIDLStateValue, UIDLResourceLink, UIDLLocalResource, UIDLExternalResource, VCMSListRepeaterElementNode, UIDLResourceMapper, UIDLInjectValue, VUIDLStateValueDetails, UIDLLocalFontAsset } from '@teleporthq/teleport-types'; | ||
import { UIDLStaticValue, ReferenceType, UIDLDynamicReference, UIDLPropDefinition, UIDLStateDefinition, UIDLPageOptions, UIDLComponentOutputOptions, UIDLDependency, UIDLStyleDefinitions, UIDLStyleValue, UIDLAttributeValue, UIDLEventHandlerStatement, UIDLMailLinkNode, UIDLPhoneLinkNode, UIDLRawValue, UIDLElementStyleStates, UIDLStyleStateCondition, UIDLStyleMediaQueryScreenSizeCondition, UIDLStyleConditions, UIDLElementNodeProjectReferencedStyle, VUIDLComponentSEO, VUIDLGlobalAsset, UIDLExternalDependency, UIDLLocalDependency, UIDLPeerDependency, UIDLImportReference, UIDLStyleSetTokenReference, VUIDLStyleSetDefnition, VUIDLElement, VUIDLSlotNode, VUIDLConditionalNode, VUIDLRepeatNode, VUIDLElementNode, VUIDLNode, VUIDLElementNodeInlineReferencedStyle, VUIDLSectionLinkNode, VUIDLLinkNode, VUIDLURLLinkNode, VUIDLStyleSetConditions, VUIDLStyleSetMediaCondition, VUIDLStyleSetStateCondition, VUIDLDesignTokens, UIDLPropCallEvent, UIDLStateModifierEvent, UIDLScriptExternalAsset, UIDLScriptInlineAsset, VUIDLStyleInlineAsset, UIDLStyleExternalAsset, VUIDLFontAsset, UIDLCanonicalAsset, UIDLIconAsset, UIDLAssetBase, VUIDLElementNodeClassReferencedStyle, UIDLCompDynamicReference, UIDLComponentStyleReference, PagePaginationOptions, VCMSItemUIDLElementNode, VCMSListUIDLElementNode, UIDLInitialPathsData, UIDLInitialPropsData, UIDLExpressionValue, UIDLDynamicLinkNode, UIDLENVValue, UIDLPropValue, UIDLResourceItem, VUIDLNavLinkNode, VUIDLDateTimeNode, UIDLStateValue, UIDLResourceLink, UIDLLocalResource, UIDLExternalResource, VCMSListRepeaterElementNode, UIDLResourceMapper, UIDLInjectValue, VUIDLStateValueDetails, VUIDLCMSMixedTypeNode, UIDLLocalFontAsset } from '@teleporthq/teleport-types'; | ||
export declare const referenceTypeDecoder: Decoder<ReferenceType>; | ||
@@ -79,3 +79,4 @@ export declare const dynamicValueDecoder: Decoder<UIDLDynamicReference>; | ||
export declare const cmsListRepeaterNodeDecoder: Decoder<VCMSListRepeaterElementNode>; | ||
export declare const cmsMixedTypeNodeDecoder: Decoder<VUIDLCMSMixedTypeNode>; | ||
export declare const uidlNodeDecoder: Decoder<VUIDLNode>; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -486,3 +486,18 @@ import { object, string, dict, constant, number, optional, union, boolean, array, lazy, oneOf, intersection, withDefault, anyJson, } from '@mojotech/json-type-validation'; | ||
}); | ||
export var uidlNodeDecoder = union(elementNodeDecoder, cmsItemNodeDecoder, cmsListNodeDecoder, cmsListRepeaterNodeDecoder, dynamicValueDecoder, rawValueDecoder, conditionalNodeDecoder, union(staticValueDecoder, repeatNodeDecoder, slotNodeDecoder, expressionValueDecoder, string())); | ||
export var cmsMixedTypeNodeDecoder = object({ | ||
type: constant('cms-mixed-type'), | ||
content: object({ | ||
elementType: string(), | ||
name: withDefault('cms-mixed-type', string()), | ||
attrs: withDefault({}, lazy(function () { return dict(union(attributeValueDecoder, string(), number())); })), | ||
renderPropIdentifier: string(), | ||
nodes: object({ | ||
fallback: optional(lazy(function () { return elementNodeDecoder; })), | ||
error: optional(lazy(function () { return elementNodeDecoder; })), | ||
}), | ||
dependency: optional(lazy(function () { return dependencyDecoder; })), | ||
mappings: withDefault({}, dict(lazy(function () { return elementNodeDecoder; }))), | ||
}), | ||
}); | ||
export var uidlNodeDecoder = union(elementNodeDecoder, dynamicValueDecoder, rawValueDecoder, conditionalNodeDecoder, union(staticValueDecoder, repeatNodeDecoder, slotNodeDecoder, expressionValueDecoder, string()), union(cmsItemNodeDecoder, cmsListNodeDecoder, cmsListRepeaterNodeDecoder, cmsMixedTypeNodeDecoder)); | ||
//# sourceMappingURL=utils.js.map |
@@ -89,3 +89,3 @@ var __assign = (this && this.__assign) || function () { | ||
case 'cms-item': | ||
case 'cms-list': | ||
case 'cms-list': { | ||
var _c = node.content, initialData = _c.initialData, _d = _c.nodes, success = _d.success, error = _d.error, loading = _d.loading, resource = _c.resource; | ||
@@ -120,3 +120,4 @@ if (initialData) { | ||
return node; | ||
case 'cms-list-repeater': | ||
} | ||
case 'cms-list-repeater': { | ||
var _e = node.content.nodes, list = _e.list, empty = _e.empty; | ||
@@ -132,2 +133,20 @@ if (list) { | ||
return node; | ||
} | ||
case 'cms-mixed-type': { | ||
var _f = node.content, _g = _f.nodes, fallback = _g.fallback, error = _g.error, dependency = _f.dependency, attrs = _f.attrs; | ||
if (attrs) { | ||
; | ||
node.content.attrs = | ||
UIDLUtils.transformAttributesAssignmentsToJson(attrs, dependency && (dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local'); | ||
} | ||
if (fallback) { | ||
; | ||
node.content.nodes.fallback = parseComponentNode(fallback, component); | ||
} | ||
if (error) { | ||
; | ||
node.content.nodes.error = parseComponentNode(error, component); | ||
} | ||
return node; | ||
} | ||
case 'element': | ||
@@ -180,3 +199,3 @@ var elementContent = node.content; | ||
if ((_b = elementContent === null || elementContent === void 0 ? void 0 : elementContent.abilities) === null || _b === void 0 ? void 0 : _b.hasOwnProperty('link')) { | ||
var _f = elementContent.abilities.link, content = _f.content, type = _f.type; | ||
var _h = elementContent.abilities.link, content = _h.content, type = _h.type; | ||
if (type === 'navlink' && typeof content.routeName === 'string') { | ||
@@ -183,0 +202,0 @@ var route = { |
{ | ||
"name": "@teleporthq/teleport-uidl-validator", | ||
"version": "0.44.0-alpha.0", | ||
"version": "0.45.1-alpha.0", | ||
"description": "A module that offers validation and parsing for non-standard UIDL structures", | ||
@@ -28,6 +28,6 @@ "author": "teleportHQ", | ||
"@mojotech/json-type-validation": "^3.1.0", | ||
"@teleporthq/teleport-shared": "^0.44.0-alpha.0", | ||
"@teleporthq/teleport-types": "^0.44.0-alpha.0" | ||
"@teleporthq/teleport-shared": "^0.45.1-alpha.0", | ||
"@teleporthq/teleport-types": "^0.45.1-alpha.0" | ||
}, | ||
"gitHead": "45837677d7dc78f2557c5af83deb519bd33b36c6" | ||
"gitHead": "9dcc55b9c3a2ee0a23fa0133c722fe3600dddb2e" | ||
} |
@@ -94,2 +94,3 @@ import { | ||
VUIDLStateValueDetails, | ||
VUIDLCMSMixedTypeNode, | ||
UIDLLocalFontAsset, | ||
@@ -842,11 +843,28 @@ } from '@teleporthq/teleport-types' | ||
export const cmsMixedTypeNodeDecoder: Decoder<VUIDLCMSMixedTypeNode> = object({ | ||
type: constant('cms-mixed-type'), | ||
content: object({ | ||
elementType: string(), | ||
name: withDefault('cms-mixed-type', string()), | ||
attrs: withDefault( | ||
{}, | ||
lazy(() => dict(union(attributeValueDecoder, string(), number()))) | ||
), | ||
renderPropIdentifier: string(), | ||
nodes: object({ | ||
fallback: optional(lazy(() => elementNodeDecoder)), | ||
error: optional(lazy(() => elementNodeDecoder)), | ||
}), | ||
dependency: optional(lazy(() => dependencyDecoder)), | ||
mappings: withDefault({}, dict(lazy(() => elementNodeDecoder))), | ||
}), | ||
}) | ||
export const uidlNodeDecoder: Decoder<VUIDLNode> = union( | ||
elementNodeDecoder, | ||
cmsItemNodeDecoder, | ||
cmsListNodeDecoder, | ||
cmsListRepeaterNodeDecoder, | ||
dynamicValueDecoder, | ||
rawValueDecoder, | ||
conditionalNodeDecoder, | ||
union(staticValueDecoder, repeatNodeDecoder, slotNodeDecoder, expressionValueDecoder, string()) | ||
union(staticValueDecoder, repeatNodeDecoder, slotNodeDecoder, expressionValueDecoder, string()), | ||
union(cmsItemNodeDecoder, cmsListNodeDecoder, cmsListRepeaterNodeDecoder, cmsMixedTypeNodeDecoder) | ||
) |
@@ -29,2 +29,3 @@ import { StringUtils, UIDLUtils } from '@teleporthq/teleport-shared' | ||
UIDLEventHandlerStatement, | ||
UIDLCMSMixedTypeNode, | ||
} from '@teleporthq/teleport-types' | ||
@@ -152,3 +153,3 @@ | ||
case 'cms-item': | ||
case 'cms-list': | ||
case 'cms-list': { | ||
const { | ||
@@ -200,4 +201,5 @@ initialData, | ||
return node as unknown as UIDLNode | ||
case 'cms-list-repeater': | ||
return node as unknown as UIDLCMSListNode | UIDLCMSItemNode | ||
} | ||
case 'cms-list-repeater': { | ||
const { | ||
@@ -221,3 +223,35 @@ nodes: { list, empty }, | ||
return node as unknown as UIDLNode | ||
return node as unknown as UIDLCMSListRepeaterNode | ||
} | ||
case 'cms-mixed-type': { | ||
const { | ||
nodes: { fallback, error }, | ||
dependency, | ||
attrs, | ||
} = (node as unknown as UIDLCMSMixedTypeNode).content | ||
if (attrs) { | ||
;(node.content as UIDLCMSMixedTypeNode['content']).attrs = | ||
UIDLUtils.transformAttributesAssignmentsToJson( | ||
attrs as Record<string, unknown>, | ||
dependency && (dependency as UIDLDependency)?.type === 'local' | ||
) | ||
} | ||
if (fallback) { | ||
;(node as unknown as UIDLCMSMixedTypeNode).content.nodes.fallback = parseComponentNode( | ||
fallback as unknown as Record<string, unknown>, | ||
component | ||
) as UIDLElementNode | ||
} | ||
if (error) { | ||
;(node as unknown as UIDLCMSMixedTypeNode).content.nodes.error = parseComponentNode( | ||
error as unknown as Record<string, unknown>, | ||
component | ||
) as UIDLElementNode | ||
} | ||
return node as unknown as UIDLCMSMixedTypeNode | ||
} | ||
case 'element': | ||
@@ -224,0 +258,0 @@ const elementContent = node.content as Record<string, unknown> |
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
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
529008
8441
+ Added@teleporthq/teleport-shared@0.45.1-alpha.0(transitive)
+ Added@teleporthq/teleport-types@0.45.1-alpha.0(transitive)
- Removed@teleporthq/teleport-shared@0.44.0-alpha.0(transitive)
- Removed@teleporthq/teleport-types@0.44.0-alpha.0(transitive)