@teleporthq/teleport-plugin-html-base-component
Advanced tools
Comparing version 0.20.6 to 0.21.0
@@ -51,2 +51,3 @@ "use strict"; | ||
exports.generateHtmlSynatx = void 0; | ||
// @ts-nocheck | ||
var teleport_types_1 = require("@teleporthq/teleport-types"); | ||
@@ -85,6 +86,6 @@ var teleport_plugin_common_1 = require("@teleporthq/teleport-plugin-common"); | ||
dependencies = structure.dependencies, chunks = structure.chunks, options = structure.options; | ||
if (!(dependency && (dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local')) return [3 /*break*/, 3]; | ||
if (!((dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local')) return [3 /*break*/, 3]; | ||
comp_1 = externals[elementType]; | ||
if (!comp_1) { | ||
throw new teleport_types_1.HTMLComponentGeneratorError("".concat(elementType, " is not found from the externals. \n\n Received externals ").concat(JSON.stringify(Object.keys(externals), null, 2))); | ||
throw new teleport_types_1.HTMLComponentGeneratorError("".concat(elementType, " is not found from the externals. \n\n Received ").concat(JSON.stringify(Object.keys(externals), null, 2))); | ||
} | ||
@@ -116,2 +117,3 @@ combinedProps_1 = __assign(__assign({}, propDefinitions), ((comp_1 === null || comp_1 === void 0 ? void 0 : comp_1.propDefinitions) || {})); | ||
cssPlugin = (0, teleport_plugin_css_1.createCSSPlugin)({ | ||
templateStyle: 'html', | ||
templateChunkName: 'html-template', | ||
@@ -121,5 +123,6 @@ declareDependency: 'import', | ||
chunkName: comp_1.name, | ||
staticPropReferences: true, | ||
}); | ||
return [4 /*yield*/, cssPlugin({ | ||
uidl: comp_1, | ||
uidl: __assign(__assign({}, comp_1), { propDefinitions: propsForInstance, stateDefinitions: statesForInstance }), | ||
chunks: [ | ||
@@ -182,16 +185,2 @@ { | ||
} | ||
if (refStyle.content.mapType === 'component-referenced' && | ||
refStyle.content.content.type === 'dynamic') { | ||
var dynamicVal = refStyle.content.content.content; | ||
if (dynamicVal.referenceType === 'prop') { | ||
node.content.referencedStyles[styleRef] = { | ||
type: 'style-map', | ||
content: { | ||
mapType: 'component-referenced', | ||
content: (0, teleport_uidl_builders_1.staticNode)(getValueFromReference(dynamicVal.id, propDefinitions)), | ||
}, | ||
}; | ||
return; | ||
} | ||
} | ||
}); | ||
@@ -198,0 +187,0 @@ } |
@@ -48,2 +48,3 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
// @ts-nocheck | ||
import { HTMLComponentGeneratorError, ChunkType, FileType, } from '@teleporthq/teleport-types'; | ||
@@ -81,6 +82,6 @@ import { HASTBuilders, HASTUtils } from '@teleporthq/teleport-plugin-common'; | ||
dependencies = structure.dependencies, chunks = structure.chunks, options = structure.options; | ||
if (!(dependency && (dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local')) return [3 /*break*/, 3]; | ||
if (!((dependency === null || dependency === void 0 ? void 0 : dependency.type) === 'local')) return [3 /*break*/, 3]; | ||
comp_1 = externals[elementType]; | ||
if (!comp_1) { | ||
throw new HTMLComponentGeneratorError("".concat(elementType, " is not found from the externals. \n\n Received externals ").concat(JSON.stringify(Object.keys(externals), null, 2))); | ||
throw new HTMLComponentGeneratorError("".concat(elementType, " is not found from the externals. \n\n Received ").concat(JSON.stringify(Object.keys(externals), null, 2))); | ||
} | ||
@@ -112,2 +113,3 @@ combinedProps_1 = __assign(__assign({}, propDefinitions), ((comp_1 === null || comp_1 === void 0 ? void 0 : comp_1.propDefinitions) || {})); | ||
cssPlugin = createCSSPlugin({ | ||
templateStyle: 'html', | ||
templateChunkName: 'html-template', | ||
@@ -117,5 +119,6 @@ declareDependency: 'import', | ||
chunkName: comp_1.name, | ||
staticPropReferences: true, | ||
}); | ||
return [4 /*yield*/, cssPlugin({ | ||
uidl: comp_1, | ||
uidl: __assign(__assign({}, comp_1), { propDefinitions: propsForInstance, stateDefinitions: statesForInstance }), | ||
chunks: [ | ||
@@ -178,16 +181,2 @@ { | ||
} | ||
if (refStyle.content.mapType === 'component-referenced' && | ||
refStyle.content.content.type === 'dynamic') { | ||
var dynamicVal = refStyle.content.content.content; | ||
if (dynamicVal.referenceType === 'prop') { | ||
node.content.referencedStyles[styleRef] = { | ||
type: 'style-map', | ||
content: { | ||
mapType: 'component-referenced', | ||
content: staticNode(getValueFromReference(dynamicVal.id, propDefinitions)), | ||
}, | ||
}; | ||
return; | ||
} | ||
} | ||
}); | ||
@@ -194,0 +183,0 @@ } |
{ | ||
"name": "@teleporthq/teleport-plugin-html-base-component", | ||
"version": "0.20.6", | ||
"version": "0.21.0", | ||
"description": "A plugin for handling the skeleton/baseline of a base html component", | ||
@@ -27,9 +27,9 @@ "author": "teleportHQ", | ||
"dependencies": { | ||
"@teleporthq/teleport-plugin-common": "^0.20.6", | ||
"@teleporthq/teleport-plugin-css": "^0.20.6", | ||
"@teleporthq/teleport-shared": "^0.20.3", | ||
"@teleporthq/teleport-types": "^0.20.3", | ||
"@teleporthq/teleport-uidl-builders": "^0.20.3" | ||
"@teleporthq/teleport-plugin-common": "^0.21.0", | ||
"@teleporthq/teleport-plugin-css": "^0.21.0", | ||
"@teleporthq/teleport-shared": "^0.21.0", | ||
"@teleporthq/teleport-types": "^0.21.0", | ||
"@teleporthq/teleport-uidl-builders": "^0.21.0" | ||
}, | ||
"gitHead": "71111c77c83c2b8794a8c1fa038a560653eea6c1" | ||
"gitHead": "dd790cfb393fbdb560646eded5a9d6111e43b6ad" | ||
} |
@@ -0,1 +1,2 @@ | ||
// @ts-nocheck | ||
import { | ||
@@ -22,3 +23,3 @@ UIDLNode, | ||
import { StringUtils } from '@teleporthq/teleport-shared' | ||
import { staticNode } from '@teleporthq/teleport-uidl-builders' | ||
import { element, staticNode } from '@teleporthq/teleport-uidl-builders' | ||
import { createCSSPlugin } from '@teleporthq/teleport-plugin-css' | ||
@@ -108,3 +109,3 @@ import { DEFAULT_COMPONENT_CHUNK_NAME } from './constants' | ||
if (dependency && dependency?.type === 'local') { | ||
if (dependency?.type === 'local') { | ||
const comp = externals[elementType] | ||
@@ -114,3 +115,3 @@ | ||
throw new HTMLComponentGeneratorError(`${elementType} is not found from the externals. \n | ||
Received externals ${JSON.stringify(Object.keys(externals), null, 2)}`) | ||
Received ${JSON.stringify(Object.keys(externals), null, 2)}`) | ||
} | ||
@@ -163,2 +164,3 @@ | ||
const cssPlugin = createCSSPlugin({ | ||
templateStyle: 'html', | ||
templateChunkName: 'html-template', | ||
@@ -168,6 +170,11 @@ declareDependency: 'import', | ||
chunkName: comp.name, | ||
staticPropReferences: true, | ||
}) | ||
const result = await cssPlugin({ | ||
uidl: comp, | ||
uidl: { | ||
...comp, | ||
propDefinitions: propsForInstance, | ||
stateDefinitions: statesForInstance, | ||
}, | ||
chunks: [ | ||
@@ -232,19 +239,2 @@ { | ||
} | ||
if ( | ||
refStyle.content.mapType === 'component-referenced' && | ||
refStyle.content.content.type === 'dynamic' | ||
) { | ||
const dynamicVal = refStyle.content.content.content | ||
if (dynamicVal.referenceType === 'prop') { | ||
node.content.referencedStyles[styleRef] = { | ||
type: 'style-map', | ||
content: { | ||
mapType: 'component-referenced', | ||
content: staticNode(getValueFromReference(dynamicVal.id, propDefinitions)), | ||
}, | ||
} | ||
return | ||
} | ||
} | ||
}) | ||
@@ -251,0 +241,0 @@ } |
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
119301
1214
+ Added@teleporthq/teleport-plugin-common@0.21.7(transitive)
+ Added@teleporthq/teleport-plugin-css@0.21.7(transitive)
+ Added@teleporthq/teleport-shared@0.21.7(transitive)
+ Added@teleporthq/teleport-types@0.21.7(transitive)
+ Added@teleporthq/teleport-uidl-builders@0.21.7(transitive)
- Removed@teleporthq/teleport-plugin-common@0.20.6(transitive)
- Removed@teleporthq/teleport-plugin-css@0.20.6(transitive)
- Removed@teleporthq/teleport-shared@0.20.3(transitive)
- Removed@teleporthq/teleport-types@0.20.3(transitive)
- Removed@teleporthq/teleport-uidl-builders@0.20.3(transitive)