@stencil/react-output-target
Advanced tools
Comparing version 0.1.0-2 to 0.1.0
@@ -160,9 +160,14 @@ 'use strict'; | ||
* to use in their applications. | ||
* @param cmpMeta: Meta data for a single Web Component | ||
* @param includeCustomElement: If `true`, the Web Component instance | ||
* will be passed in to createReactComponent to be registered | ||
* with the Custom Elements Registry. | ||
* @returns An array where each entry is a string version | ||
* of the React component definition. | ||
*/ | ||
function createComponentDefinition(cmpMeta, includeCustomElement = false) { | ||
const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName); | ||
const importAs = (includeCustomElement) ? tagNameAsPascal + 'Cmp' : undefined; | ||
let template = `export const ${tagNameAsPascal} = /*@__PURE__*/createReactComponent<${IMPORT_TYPES}.${tagNameAsPascal}, HTML${tagNameAsPascal}Element>('${cmpMeta.tagName}'`; | ||
if (importAs) { | ||
template += `, ${importAs}`; | ||
if (includeCustomElement) { | ||
template += `, undefined, undefined, ${tagNameAsPascal}Cmp`; | ||
} | ||
@@ -169,0 +174,0 @@ template += `);`; |
@@ -151,9 +151,14 @@ import path from 'path'; | ||
* to use in their applications. | ||
* @param cmpMeta: Meta data for a single Web Component | ||
* @param includeCustomElement: If `true`, the Web Component instance | ||
* will be passed in to createReactComponent to be registered | ||
* with the Custom Elements Registry. | ||
* @returns An array where each entry is a string version | ||
* of the React component definition. | ||
*/ | ||
function createComponentDefinition(cmpMeta, includeCustomElement = false) { | ||
const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName); | ||
const importAs = (includeCustomElement) ? tagNameAsPascal + 'Cmp' : undefined; | ||
let template = `export const ${tagNameAsPascal} = /*@__PURE__*/createReactComponent<${IMPORT_TYPES}.${tagNameAsPascal}, HTML${tagNameAsPascal}Element>('${cmpMeta.tagName}'`; | ||
if (importAs) { | ||
template += `, ${importAs}`; | ||
if (includeCustomElement) { | ||
template += `, undefined, undefined, ${tagNameAsPascal}Cmp`; | ||
} | ||
@@ -160,0 +165,0 @@ template += `);`; |
@@ -8,2 +8,8 @@ import type { OutputTargetReact, PackageJSON } from './types'; | ||
* to use in their applications. | ||
* @param cmpMeta: Meta data for a single Web Component | ||
* @param includeCustomElement: If `true`, the Web Component instance | ||
* will be passed in to createReactComponent to be registered | ||
* with the Custom Elements Registry. | ||
* @returns An array where each entry is a string version | ||
* of the React component definition. | ||
*/ | ||
@@ -10,0 +16,0 @@ export declare function createComponentDefinition(cmpMeta: ComponentCompilerMeta, includeCustomElement?: boolean): string[]; |
@@ -73,9 +73,14 @@ import path from 'path'; | ||
* to use in their applications. | ||
* @param cmpMeta: Meta data for a single Web Component | ||
* @param includeCustomElement: If `true`, the Web Component instance | ||
* will be passed in to createReactComponent to be registered | ||
* with the Custom Elements Registry. | ||
* @returns An array where each entry is a string version | ||
* of the React component definition. | ||
*/ | ||
export function createComponentDefinition(cmpMeta, includeCustomElement = false) { | ||
const tagNameAsPascal = dashToPascalCase(cmpMeta.tagName); | ||
const importAs = (includeCustomElement) ? tagNameAsPascal + 'Cmp' : undefined; | ||
let template = `export const ${tagNameAsPascal} = /*@__PURE__*/createReactComponent<${IMPORT_TYPES}.${tagNameAsPascal}, HTML${tagNameAsPascal}Element>('${cmpMeta.tagName}'`; | ||
if (importAs) { | ||
template += `, ${importAs}`; | ||
if (includeCustomElement) { | ||
template += `, undefined, undefined, ${tagNameAsPascal}Cmp`; | ||
} | ||
@@ -82,0 +87,0 @@ template += `);`; |
{ | ||
"name": "@stencil/react-output-target", | ||
"version": "0.1.0-2", | ||
"version": "0.1.0", | ||
"description": "React output target for @stencil/core components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
Sorry, the diff of this file is not supported yet
53145
1179