@teleporthq/teleport-plugin-stencil-base-component
Advanced tools
Comparing version 0.10.2 to 0.10.4
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -37,3 +38,2 @@ }); | ||
}; | ||
var _this = this; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -47,3 +47,3 @@ var utils_1 = require("./utils"); | ||
var _a = config || {}, _b = _a.componentChunkName, componentChunkName = _b === void 0 ? constants_1.DEFAULT_COMPONENT_CHUNK_NAME : _b, _c = _a.componentDecoratorChunkName, componentDecoratorChunkName = _c === void 0 ? constants_1.DEFAULT_COMPONENT_DECORATOR_CHUNK_NAME : _c, _d = _a.importChunkName, importChunkName = _d === void 0 ? constants_1.DEFAULT_IMPORT_CHUNK_NAME : _d; | ||
var stencilComponentPlugin = function (structure) { return __awaiter(_this, void 0, void 0, function () { | ||
var stencilComponentPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () { | ||
var uidl, dependencies, _a, stateDefinitions, _b, propDefinitions, nodesLookup, jsxParams, jsxOptions, jsxTagStructure, titleAST, componentName, exportAST, params, decoratorAST; | ||
@@ -78,2 +78,3 @@ return __generator(this, function (_c) { | ||
customElementTag: function (name) { return teleport_shared_1.UIDLUtils.createWebComponentFriendlyName(name); }, | ||
domHTMLInjection: function (content) { return utils_1.createDOMInjectionNode(content); }, | ||
}; | ||
@@ -80,0 +81,0 @@ jsxTagStructure = teleport_plugin_common_1.createJSXSyntax(uidl.node, jsxParams, jsxOptions); |
import * as types from '@babel/types'; | ||
import { UIDLStateDefinition, UIDLPropDefinition } from '@teleporthq/teleport-types'; | ||
export declare const createClassDeclaration: (name: string, propDefinitions: Record<string, UIDLPropDefinition>, stateDefinitions: Record<string, UIDLStateDefinition>, jsxTagTree: types.JSXElement, t?: typeof types) => types.ExportNamedDeclaration; | ||
export declare const createDOMInjectionNode: (content: string, t?: typeof types) => types.JSXElement; |
"use strict"; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
@@ -20,3 +27,3 @@ if (mod && mod.__esModule) return mod; | ||
}); | ||
var classBody = t.classBody(propDeclaration.concat(stateDeclaration, [ | ||
var classBody = t.classBody(__spreadArrays(propDeclaration, stateDeclaration, [ | ||
types.classMethod('method', t.identifier('render'), [], t.blockStatement([t.returnStatement(jsxTagTree)])), | ||
@@ -27,2 +34,6 @@ ])); | ||
}; | ||
exports.createDOMInjectionNode = function (content, t) { | ||
if (t === void 0) { t = types; } | ||
return t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier('span'), [t.jsxAttribute(t.jsxIdentifier('innerHTML'), t.stringLiteral(content))], true), null, [], true); | ||
}; | ||
//# sourceMappingURL=utils.js.map |
@@ -1,2 +0,2 @@ | ||
import { createClassDeclaration } from './utils'; | ||
import { createClassDeclaration, createDOMInjectionNode } from './utils'; | ||
import { UIDLUtils } from '@teleporthq/teleport-shared'; | ||
@@ -39,2 +39,3 @@ import { createJSXSyntax, ASTBuilders, ASTUtils, } from '@teleporthq/teleport-plugin-common'; | ||
customElementTag: (name) => UIDLUtils.createWebComponentFriendlyName(name), | ||
domHTMLInjection: (content) => createDOMInjectionNode(content), | ||
}; | ||
@@ -41,0 +42,0 @@ const jsxTagStructure = createJSXSyntax(uidl.node, jsxParams, jsxOptions); |
import * as types from '@babel/types'; | ||
import { UIDLStateDefinition, UIDLPropDefinition } from '@teleporthq/teleport-types'; | ||
export declare const createClassDeclaration: (name: string, propDefinitions: Record<string, UIDLPropDefinition>, stateDefinitions: Record<string, UIDLStateDefinition>, jsxTagTree: types.JSXElement, t?: typeof types) => types.ExportNamedDeclaration; | ||
export declare const createDOMInjectionNode: (content: string, t?: typeof types) => types.JSXElement; |
@@ -14,2 +14,5 @@ import * as types from '@babel/types'; | ||
}; | ||
export const createDOMInjectionNode = (content, t = types) => { | ||
return t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier('span'), [t.jsxAttribute(t.jsxIdentifier('innerHTML'), t.stringLiteral(content))], true), null, [], true); | ||
}; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@teleporthq/teleport-plugin-stencil-base-component", | ||
"version": "0.10.2", | ||
"version": "0.10.4", | ||
"description": "A plugin for handling the skeleton/baseline of a Stencil component", | ||
@@ -30,7 +30,7 @@ "author": "teleportHQ", | ||
"@babel/types": "^7.5.5", | ||
"@teleporthq/teleport-plugin-common": "^0.10.2", | ||
"@teleporthq/teleport-shared": "^0.10.1", | ||
"@teleporthq/teleport-types": "^0.10.1" | ||
"@teleporthq/teleport-plugin-common": "^0.10.4", | ||
"@teleporthq/teleport-shared": "^0.10.4", | ||
"@teleporthq/teleport-types": "^0.10.4" | ||
}, | ||
"gitHead": "91d75226d1fada0ef0ab2b61a7974475ba214fb1" | ||
"gitHead": "b5f838aac54b6af2c6bed73e4044ead5b747ecf4" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { createClassDeclaration } from './utils' | ||
import { createClassDeclaration, createDOMInjectionNode } from './utils' | ||
import { UIDLUtils } from '@teleporthq/teleport-shared' | ||
@@ -74,2 +74,3 @@ import { | ||
customElementTag: (name: string) => UIDLUtils.createWebComponentFriendlyName(name), | ||
domHTMLInjection: (content: string) => createDOMInjectionNode(content), | ||
} | ||
@@ -76,0 +77,0 @@ |
@@ -45,1 +45,14 @@ import * as types from '@babel/types' | ||
} | ||
export const createDOMInjectionNode = (content: string, t = types) => { | ||
return t.jsxElement( | ||
t.jsxOpeningElement( | ||
t.jsxIdentifier('span'), | ||
[t.jsxAttribute(t.jsxIdentifier('innerHTML'), t.stringLiteral(content))], | ||
true | ||
), | ||
null, | ||
[], | ||
true | ||
) | ||
} |
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
567
279663