@stencil/angular-output-target 0.6.1-dev.11662151255.17ea4066 → 0.6.1-dev.11662577182.1c45c8de
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.
- package/dist/generate-angular-component.js +11 -9
- package/dist/index.cjs.js +16 -10
- package/dist/index.js +16 -10
- package/dist/output-angular.js +5 -1
- package/package.json +2 -2
|
@@ -41,8 +41,8 @@ export const createAngularComponentDefinition = (tagName, inputs, outputs, metho
|
|
|
41
41
|
const output = `@ProxyCmp({${proxyCmpOptions.join(',')}\n})
|
|
42
42
|
@Component({
|
|
43
43
|
selector: '${tagName}',
|
|
44
|
-
template: '<ng-content></ng-content>',
|
|
45
44
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
|
+
template: '<ng-content></ng-content>',
|
|
46
46
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
47
47
|
inputs: [${formattedInputs}],
|
|
48
48
|
})
|
|
@@ -105,20 +105,22 @@ const createDocComment = (doc) => {
|
|
|
105
105
|
* @returns The component interface type definition as a string.
|
|
106
106
|
*/
|
|
107
107
|
export const createComponentTypeDefinition = (tagNameAsPascal, events, componentCorePackage, includeImportCustomElements = false, customElementsDir) => {
|
|
108
|
-
const
|
|
108
|
+
const publicEvents = events.filter(ev => !ev.internal);
|
|
109
|
+
const eventTypeImports = createComponentEventTypeImports(tagNameAsPascal, publicEvents, {
|
|
109
110
|
componentCorePackage,
|
|
110
111
|
includeImportCustomElements,
|
|
111
112
|
customElementsDir,
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
export interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {
|
|
115
|
-
${events
|
|
113
|
+
});
|
|
114
|
+
const eventTypes = publicEvents
|
|
116
115
|
.map((event) => {
|
|
117
116
|
const comment = createDocComment(event.docs);
|
|
118
117
|
return `${comment.length > 0 ? ` ${comment}` : ''}
|
|
119
118
|
${event.name}: EventEmitter<CustomEvent<${formatOutputType(tagNameAsPascal, event)}>>;`;
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
}
|
|
119
|
+
});
|
|
120
|
+
const interfaceDeclaration = `export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {`;
|
|
121
|
+
const typeDefinition = (eventTypeImports.length > 0 ? `${eventTypeImports + '\n\n'}` : '')
|
|
122
|
+
+ `${interfaceDeclaration}${eventTypes.length === 0 ? '}' : `
|
|
123
|
+
${eventTypes.join('\n')}
|
|
124
|
+
}`}`;
|
|
123
125
|
return typeDefinition;
|
|
124
126
|
};
|
package/dist/index.cjs.js
CHANGED
|
@@ -172,8 +172,8 @@ const createAngularComponentDefinition = (tagName, inputs, outputs, methods, inc
|
|
|
172
172
|
const output = `@ProxyCmp({${proxyCmpOptions.join(',')}\n})
|
|
173
173
|
@Component({
|
|
174
174
|
selector: '${tagName}',
|
|
175
|
-
template: '<ng-content></ng-content>',
|
|
176
175
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
176
|
+
template: '<ng-content></ng-content>',
|
|
177
177
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
178
178
|
inputs: [${formattedInputs}],
|
|
179
179
|
})
|
|
@@ -236,21 +236,23 @@ const createDocComment = (doc) => {
|
|
|
236
236
|
* @returns The component interface type definition as a string.
|
|
237
237
|
*/
|
|
238
238
|
const createComponentTypeDefinition = (tagNameAsPascal, events, componentCorePackage, includeImportCustomElements = false, customElementsDir) => {
|
|
239
|
-
const
|
|
239
|
+
const publicEvents = events.filter(ev => !ev.internal);
|
|
240
|
+
const eventTypeImports = createComponentEventTypeImports(tagNameAsPascal, publicEvents, {
|
|
240
241
|
componentCorePackage,
|
|
241
242
|
includeImportCustomElements,
|
|
242
243
|
customElementsDir,
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
export interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {
|
|
246
|
-
${events
|
|
244
|
+
});
|
|
245
|
+
const eventTypes = publicEvents
|
|
247
246
|
.map((event) => {
|
|
248
247
|
const comment = createDocComment(event.docs);
|
|
249
248
|
return `${comment.length > 0 ? ` ${comment}` : ''}
|
|
250
249
|
${event.name}: EventEmitter<CustomEvent<${formatOutputType(tagNameAsPascal, event)}>>;`;
|
|
251
|
-
})
|
|
252
|
-
|
|
253
|
-
}
|
|
250
|
+
});
|
|
251
|
+
const interfaceDeclaration = `export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {`;
|
|
252
|
+
const typeDefinition = (eventTypeImports.length > 0 ? `${eventTypeImports + '\n\n'}` : '')
|
|
253
|
+
+ `${interfaceDeclaration}${eventTypes.length === 0 ? '}' : `
|
|
254
|
+
${eventTypes.join('\n')}
|
|
255
|
+
}`}`;
|
|
254
256
|
return typeDefinition;
|
|
255
257
|
};
|
|
256
258
|
|
|
@@ -472,7 +474,11 @@ ${createImportStatement(componentLibImports, './angular-component-lib/utils')}\n
|
|
|
472
474
|
const componentDefinition = createAngularComponentDefinition(cmpMeta.tagName, inputs, outputs, methods, includeImportCustomElements);
|
|
473
475
|
const moduleDefinition = generateAngularModuleForComponent(cmpMeta.tagName);
|
|
474
476
|
const componentTypeDefinition = createComponentTypeDefinition(tagNameAsPascal, cmpMeta.events, componentCorePackage, includeImportCustomElements, customElementsDir);
|
|
475
|
-
proxyFileOutput.push(componentDefinition, '\n'
|
|
477
|
+
proxyFileOutput.push(componentDefinition, '\n');
|
|
478
|
+
if (createSingleComponentAngularModules) {
|
|
479
|
+
proxyFileOutput.push(moduleDefinition, '\n');
|
|
480
|
+
}
|
|
481
|
+
proxyFileOutput.push(componentTypeDefinition, '\n');
|
|
476
482
|
}
|
|
477
483
|
const final = [imports, typeImports, sourceImports, ...proxyFileOutput];
|
|
478
484
|
return final.join('\n') + '\n';
|
package/dist/index.js
CHANGED
|
@@ -164,8 +164,8 @@ const createAngularComponentDefinition = (tagName, inputs, outputs, methods, inc
|
|
|
164
164
|
const output = `@ProxyCmp({${proxyCmpOptions.join(',')}\n})
|
|
165
165
|
@Component({
|
|
166
166
|
selector: '${tagName}',
|
|
167
|
-
template: '<ng-content></ng-content>',
|
|
168
167
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
168
|
+
template: '<ng-content></ng-content>',
|
|
169
169
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
170
170
|
inputs: [${formattedInputs}],
|
|
171
171
|
})
|
|
@@ -228,21 +228,23 @@ const createDocComment = (doc) => {
|
|
|
228
228
|
* @returns The component interface type definition as a string.
|
|
229
229
|
*/
|
|
230
230
|
const createComponentTypeDefinition = (tagNameAsPascal, events, componentCorePackage, includeImportCustomElements = false, customElementsDir) => {
|
|
231
|
-
const
|
|
231
|
+
const publicEvents = events.filter(ev => !ev.internal);
|
|
232
|
+
const eventTypeImports = createComponentEventTypeImports(tagNameAsPascal, publicEvents, {
|
|
232
233
|
componentCorePackage,
|
|
233
234
|
includeImportCustomElements,
|
|
234
235
|
customElementsDir,
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
export interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {
|
|
238
|
-
${events
|
|
236
|
+
});
|
|
237
|
+
const eventTypes = publicEvents
|
|
239
238
|
.map((event) => {
|
|
240
239
|
const comment = createDocComment(event.docs);
|
|
241
240
|
return `${comment.length > 0 ? ` ${comment}` : ''}
|
|
242
241
|
${event.name}: EventEmitter<CustomEvent<${formatOutputType(tagNameAsPascal, event)}>>;`;
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
}
|
|
242
|
+
});
|
|
243
|
+
const interfaceDeclaration = `export declare interface ${tagNameAsPascal} extends Components.${tagNameAsPascal} {`;
|
|
244
|
+
const typeDefinition = (eventTypeImports.length > 0 ? `${eventTypeImports + '\n\n'}` : '')
|
|
245
|
+
+ `${interfaceDeclaration}${eventTypes.length === 0 ? '}' : `
|
|
246
|
+
${eventTypes.join('\n')}
|
|
247
|
+
}`}`;
|
|
246
248
|
return typeDefinition;
|
|
247
249
|
};
|
|
248
250
|
|
|
@@ -464,7 +466,11 @@ ${createImportStatement(componentLibImports, './angular-component-lib/utils')}\n
|
|
|
464
466
|
const componentDefinition = createAngularComponentDefinition(cmpMeta.tagName, inputs, outputs, methods, includeImportCustomElements);
|
|
465
467
|
const moduleDefinition = generateAngularModuleForComponent(cmpMeta.tagName);
|
|
466
468
|
const componentTypeDefinition = createComponentTypeDefinition(tagNameAsPascal, cmpMeta.events, componentCorePackage, includeImportCustomElements, customElementsDir);
|
|
467
|
-
proxyFileOutput.push(componentDefinition, '\n'
|
|
469
|
+
proxyFileOutput.push(componentDefinition, '\n');
|
|
470
|
+
if (createSingleComponentAngularModules) {
|
|
471
|
+
proxyFileOutput.push(moduleDefinition, '\n');
|
|
472
|
+
}
|
|
473
|
+
proxyFileOutput.push(componentTypeDefinition, '\n');
|
|
468
474
|
}
|
|
469
475
|
const final = [imports, typeImports, sourceImports, ...proxyFileOutput];
|
|
470
476
|
return final.join('\n') + '\n';
|
package/dist/output-angular.js
CHANGED
|
@@ -130,7 +130,11 @@ ${createImportStatement(componentLibImports, './angular-component-lib/utils')}\n
|
|
|
130
130
|
const componentDefinition = createAngularComponentDefinition(cmpMeta.tagName, inputs, outputs, methods, includeImportCustomElements);
|
|
131
131
|
const moduleDefinition = generateAngularModuleForComponent(cmpMeta.tagName);
|
|
132
132
|
const componentTypeDefinition = createComponentTypeDefinition(tagNameAsPascal, cmpMeta.events, componentCorePackage, includeImportCustomElements, customElementsDir);
|
|
133
|
-
proxyFileOutput.push(componentDefinition, '\n'
|
|
133
|
+
proxyFileOutput.push(componentDefinition, '\n');
|
|
134
|
+
if (createSingleComponentAngularModules) {
|
|
135
|
+
proxyFileOutput.push(moduleDefinition, '\n');
|
|
136
|
+
}
|
|
137
|
+
proxyFileOutput.push(componentTypeDefinition, '\n');
|
|
134
138
|
}
|
|
135
139
|
const final = [imports, typeImports, sourceImports, ...proxyFileOutput];
|
|
136
140
|
return final.join('\n') + '\n';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.6.1-dev.
|
|
3
|
+
"version": "0.6.1-dev.11662577182.1c45c8de",
|
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
],
|
|
59
59
|
"testURL": "http://localhost"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c45c8deb595afb1d5321159783c838fb7131f087"
|
|
62
62
|
}
|