@stencil/angular-output-target 0.3.0 → 0.4.0-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,11 +43,13 @@ export const defineCustomElement = (tagName: string, customElement: any) => {
43
43
  }
44
44
 
45
45
  // tslint:disable-next-line: only-arrow-functions
46
- export function ProxyCmp(opts: { tagName: string, customElement?: any, inputs?: any; methods?: any }) {
46
+ export function ProxyCmp(opts: { defineCustomElementFn?: () => void, inputs?: any; methods?: any }) {
47
47
  const decorator = function (cls: any) {
48
- const { tagName, customElement, inputs, methods } = opts;
48
+ const { defineCustomElementFn, inputs, methods } = opts;
49
49
 
50
- defineCustomElement(tagName, customElement);
50
+ if (defineCustomElementFn !== undefined) {
51
+ defineCustomElementFn();
52
+ }
51
53
 
52
54
  if (inputs) {
53
55
  proxyInputs(cls, inputs);
@@ -91,8 +91,7 @@ function getProxyCmp(tagName, includeCustomElement, inputs, methods) {
91
91
  const hasInputs = inputs.length > 0;
92
92
  const hasMethods = methods.length > 0;
93
93
  const proxMeta = [
94
- `tagName: \'${tagName}\'`,
95
- `customElement: ${includeCustomElement ? dashToPascalCase(tagName) + 'Cmp' : 'undefined'}`
94
+ `defineCustomElementFn: ${includeCustomElement ? 'define' + dashToPascalCase(tagName) : 'undefined'}`
96
95
  ];
97
96
  if (hasInputs)
98
97
  proxMeta.push(`inputs: ['${inputs.join(`', '`)}']`);
package/dist/index.cjs.js CHANGED
@@ -177,8 +177,7 @@ function getProxyCmp(tagName, includeCustomElement, inputs, methods) {
177
177
  const hasInputs = inputs.length > 0;
178
178
  const hasMethods = methods.length > 0;
179
179
  const proxMeta = [
180
- `tagName: \'${tagName}\'`,
181
- `customElement: ${includeCustomElement ? dashToPascalCase(tagName) + 'Cmp' : 'undefined'}`
180
+ `defineCustomElementFn: ${includeCustomElement ? 'define' + dashToPascalCase(tagName) : 'undefined'}`
182
181
  ];
183
182
  if (hasInputs)
184
183
  proxMeta.push(`inputs: ['${inputs.join(`', '`)}']`);
@@ -325,7 +324,7 @@ import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';\n`;
325
324
  if (outputTarget.includeImportCustomElements && outputTarget.componentCorePackage !== undefined) {
326
325
  const cmpImports = components.map(component => {
327
326
  const pascalImport = dashToPascalCase(component.tagName);
328
- return `import { ${pascalImport} as ${pascalImport}Cmp } from '${normalizePath(outputTarget.componentCorePackage)}/${outputTarget.customElementsDir ||
327
+ return `import { defineCustomElement as define${pascalImport} } from '${normalizePath(outputTarget.componentCorePackage)}/${outputTarget.customElementsDir ||
329
328
  'components'}/${component.tagName}.js';`;
330
329
  });
331
330
  sourceImports = cmpImports.join('\n');
package/dist/index.js CHANGED
@@ -169,8 +169,7 @@ function getProxyCmp(tagName, includeCustomElement, inputs, methods) {
169
169
  const hasInputs = inputs.length > 0;
170
170
  const hasMethods = methods.length > 0;
171
171
  const proxMeta = [
172
- `tagName: \'${tagName}\'`,
173
- `customElement: ${includeCustomElement ? dashToPascalCase(tagName) + 'Cmp' : 'undefined'}`
172
+ `defineCustomElementFn: ${includeCustomElement ? 'define' + dashToPascalCase(tagName) : 'undefined'}`
174
173
  ];
175
174
  if (hasInputs)
176
175
  proxMeta.push(`inputs: ['${inputs.join(`', '`)}']`);
@@ -317,7 +316,7 @@ import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';\n`;
317
316
  if (outputTarget.includeImportCustomElements && outputTarget.componentCorePackage !== undefined) {
318
317
  const cmpImports = components.map(component => {
319
318
  const pascalImport = dashToPascalCase(component.tagName);
320
- return `import { ${pascalImport} as ${pascalImport}Cmp } from '${normalizePath(outputTarget.componentCorePackage)}/${outputTarget.customElementsDir ||
319
+ return `import { defineCustomElement as define${pascalImport} } from '${normalizePath(outputTarget.componentCorePackage)}/${outputTarget.customElementsDir ||
321
320
  'components'}/${component.tagName}.js';`;
322
321
  });
323
322
  sourceImports = cmpImports.join('\n');
@@ -63,7 +63,7 @@ import { ProxyCmp, proxyOutputs } from './angular-component-lib/utils';\n`;
63
63
  if (outputTarget.includeImportCustomElements && outputTarget.componentCorePackage !== undefined) {
64
64
  const cmpImports = components.map(component => {
65
65
  const pascalImport = dashToPascalCase(component.tagName);
66
- return `import { ${pascalImport} as ${pascalImport}Cmp } from '${normalizePath(outputTarget.componentCorePackage)}/${outputTarget.customElementsDir ||
66
+ return `import { defineCustomElement as define${pascalImport} } from '${normalizePath(outputTarget.componentCorePackage)}/${outputTarget.customElementsDir ||
67
67
  'components'}/${component.tagName}.js';`;
68
68
  });
69
69
  sourceImports = cmpImports.join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/angular-output-target",
3
- "version": "0.3.0",
3
+ "version": "0.4.0-3",
4
4
  "description": "Angular output target for @stencil/core components.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -37,6 +37,9 @@
37
37
  "@angular/core": "8.2.14",
38
38
  "@angular/forms": "8.2.14"
39
39
  },
40
+ "peerDependencies": {
41
+ "@stencil/core": "^2.9.0"
42
+ },
40
43
  "jest": {
41
44
  "transform": {
42
45
  "^.+\\.(js|ts|tsx)$": "<rootDir>/test/jest.preprocessor.js"