@stencil/angular-output-target 0.10.1 → 1.0.0
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/README.md +7 -0
- package/dist/generate-angular-component.js +7 -3
- package/dist/generate-value-accessors.js +2 -2
- package/dist/index.cjs.js +34 -23
- package/dist/index.js +11 -6
- package/dist/plugin.js +2 -1
- package/dist/types.d.ts +2 -2
- package/package.json +5 -4
- package/resources/control-value-accessors/boolean-value-accessor.ts +1 -1
- package/resources/control-value-accessors/number-value-accessor.ts +1 -1
- package/resources/control-value-accessors/radio-value-accessor.ts +1 -1
- package/resources/control-value-accessors/select-value-accessor.ts +1 -1
- package/resources/control-value-accessors/text-value-accessor.ts +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,13 @@ For a detailed guide on how to add the angular output target to a project, visit
|
|
|
14
14
|
npm install @stencil/angular-output-target
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## Angular Support
|
|
18
|
+
|
|
19
|
+
| **@stencil/angular-output-target** | **Angular** |
|
|
20
|
+
|------------------------------------|-----------------|
|
|
21
|
+
| 0.10.2 | v18.x and lower |
|
|
22
|
+
| 1.0.0 | v19.x and above |
|
|
23
|
+
|
|
17
24
|
## Usage
|
|
18
25
|
|
|
19
26
|
In your `stencil.config.ts` add the following configuration to the `outputTargets` section:
|
|
@@ -12,7 +12,7 @@ function createPropertyDeclaration(prop, type, inlinePropertyAsSetter = false) {
|
|
|
12
12
|
let eventName = prop.name;
|
|
13
13
|
if (/[-/]/.test(prop.name)) {
|
|
14
14
|
// If a member name includes a dash or a forward slash, we need to wrap it in quotes.
|
|
15
|
-
// https://github.com/
|
|
15
|
+
// https://github.com/stenciljs/output-targets/issues/212
|
|
16
16
|
eventName = `'${prop.name}'`;
|
|
17
17
|
}
|
|
18
18
|
if (inlinePropertyAsSetter) {
|
|
@@ -59,8 +59,8 @@ export const createAngularComponentDefinition = (tagName, inputs, outputs, metho
|
|
|
59
59
|
proxyCmpOptions.push(`\n methods: [${formattedMethods}]`);
|
|
60
60
|
}
|
|
61
61
|
let standaloneOption = '';
|
|
62
|
-
if (standalone
|
|
63
|
-
standaloneOption = `\n standalone:
|
|
62
|
+
if (!standalone) {
|
|
63
|
+
standaloneOption = `\n standalone: false`;
|
|
64
64
|
}
|
|
65
65
|
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`, true));
|
|
66
66
|
const propertiesDeclarationText = [`protected el: HTML${tagNameAsPascal}Element;`, ...propertyDeclarations].join('\n ');
|
|
@@ -139,6 +139,10 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
139
139
|
return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
|
|
140
140
|
}
|
|
141
141
|
return [p1, dst, p2].join('');
|
|
142
|
+
})
|
|
143
|
+
// Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`.
|
|
144
|
+
.replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => {
|
|
145
|
+
return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`;
|
|
142
146
|
}));
|
|
143
147
|
}, event.complexType.original
|
|
144
148
|
.replace(/\n/g, ' ')
|
|
@@ -36,7 +36,7 @@ export function createValueAccessor(srcFileContents, valueAccessor, outputType)
|
|
|
36
36
|
return srcFileContents
|
|
37
37
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
38
38
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
39
|
-
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType
|
|
39
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType !== OutputTypes.Standalone ? ',\nstandalone: false' : '');
|
|
40
40
|
}
|
|
41
41
|
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
42
42
|
if (!config.sys || !config.sys.copy) {
|
|
@@ -57,4 +57,4 @@ const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
|
57
57
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
58
58
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
59
59
|
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
60
|
-
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
60
|
+
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'`;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var path = require('path');
|
|
4
6
|
var os = require('os');
|
|
5
7
|
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
11
|
+
|
|
6
12
|
const OutputTypes = {
|
|
7
13
|
Component: 'component',
|
|
8
14
|
Scam: 'scam',
|
|
@@ -52,18 +58,18 @@ function normalizePath(str) {
|
|
|
52
58
|
return str;
|
|
53
59
|
}
|
|
54
60
|
function relativeImport(pathFrom, pathTo, ext) {
|
|
55
|
-
let relativePath =
|
|
61
|
+
let relativePath = path__default["default"].relative(path__default["default"].dirname(pathFrom), path__default["default"].dirname(pathTo));
|
|
56
62
|
if (relativePath === '') {
|
|
57
63
|
relativePath = '.';
|
|
58
64
|
}
|
|
59
65
|
else if (relativePath[0] !== '.') {
|
|
60
66
|
relativePath = './' + relativePath;
|
|
61
67
|
}
|
|
62
|
-
return normalizePath(`${relativePath}/${
|
|
68
|
+
return normalizePath(`${relativePath}/${path__default["default"].basename(pathTo, ext)}`);
|
|
63
69
|
}
|
|
64
70
|
async function readPackageJson(config, rootDir) {
|
|
65
71
|
var _a;
|
|
66
|
-
const pkgJsonPath =
|
|
72
|
+
const pkgJsonPath = path__default["default"].join(rootDir, 'package.json');
|
|
67
73
|
let pkgJson;
|
|
68
74
|
try {
|
|
69
75
|
pkgJson = (await ((_a = config.sys) === null || _a === void 0 ? void 0 : _a.readFile(pkgJsonPath, 'utf8')));
|
|
@@ -151,7 +157,7 @@ function createPropertyDeclaration(prop, type, inlinePropertyAsSetter = false) {
|
|
|
151
157
|
let eventName = prop.name;
|
|
152
158
|
if (/[-/]/.test(prop.name)) {
|
|
153
159
|
// If a member name includes a dash or a forward slash, we need to wrap it in quotes.
|
|
154
|
-
// https://github.com/
|
|
160
|
+
// https://github.com/stenciljs/output-targets/issues/212
|
|
155
161
|
eventName = `'${prop.name}'`;
|
|
156
162
|
}
|
|
157
163
|
if (inlinePropertyAsSetter) {
|
|
@@ -198,8 +204,8 @@ const createAngularComponentDefinition = (tagName, inputs, outputs, methods, inc
|
|
|
198
204
|
proxyCmpOptions.push(`\n methods: [${formattedMethods}]`);
|
|
199
205
|
}
|
|
200
206
|
let standaloneOption = '';
|
|
201
|
-
if (standalone
|
|
202
|
-
standaloneOption = `\n standalone:
|
|
207
|
+
if (!standalone) {
|
|
208
|
+
standaloneOption = `\n standalone: false`;
|
|
203
209
|
}
|
|
204
210
|
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`, true));
|
|
205
211
|
const propertiesDeclarationText = [`protected el: HTML${tagNameAsPascal}Element;`, ...propertyDeclarations].join('\n ');
|
|
@@ -278,6 +284,10 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
278
284
|
return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
|
|
279
285
|
}
|
|
280
286
|
return [p1, dst, p2].join('');
|
|
287
|
+
})
|
|
288
|
+
// Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`.
|
|
289
|
+
.replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => {
|
|
290
|
+
return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`;
|
|
281
291
|
}));
|
|
282
292
|
}, event.complexType.original
|
|
283
293
|
.replace(/\n/g, ' ')
|
|
@@ -348,7 +358,7 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
348
358
|
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
|
349
359
|
return;
|
|
350
360
|
}
|
|
351
|
-
const targetDir =
|
|
361
|
+
const targetDir = path__default["default"].dirname(outputTarget.directivesProxyFile);
|
|
352
362
|
const normalizedValueAccessors = outputTarget.valueAccessorConfigs.reduce((allAccessors, va) => {
|
|
353
363
|
const elementSelectors = Array.isArray(va.elementSelectors) ? va.elementSelectors : [va.elementSelectors];
|
|
354
364
|
const type = va.type;
|
|
@@ -366,8 +376,8 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
366
376
|
await Promise.all(Object.keys(normalizedValueAccessors).map(async (type) => {
|
|
367
377
|
const valueAccessorType = type; // Object.keys converts to string
|
|
368
378
|
const targetFileName = `${type}-value-accessor.ts`;
|
|
369
|
-
const targetFilePath =
|
|
370
|
-
const srcFilePath =
|
|
379
|
+
const targetFilePath = path__default["default"].join(targetDir, targetFileName);
|
|
380
|
+
const srcFilePath = path__default["default"].join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
371
381
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
372
382
|
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
373
383
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
@@ -379,7 +389,7 @@ function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
|
379
389
|
return srcFileContents
|
|
380
390
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
381
391
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`))
|
|
382
|
-
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType
|
|
392
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType !== OutputTypes.Standalone ? ',\nstandalone: false' : '');
|
|
383
393
|
}
|
|
384
394
|
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
385
395
|
if (!config.sys || !config.sys.copy) {
|
|
@@ -387,20 +397,20 @@ function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
|
387
397
|
}
|
|
388
398
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
389
399
|
return {
|
|
390
|
-
src:
|
|
391
|
-
dest:
|
|
400
|
+
src: path__default["default"].join(__dirname, '../resources/control-value-accessors/', rf),
|
|
401
|
+
dest: path__default["default"].join(directory, rf),
|
|
392
402
|
keepDirStructure: false,
|
|
393
403
|
warn: false,
|
|
394
404
|
ignore: [],
|
|
395
405
|
};
|
|
396
406
|
});
|
|
397
|
-
return config.sys.copy(copyTasks,
|
|
407
|
+
return config.sys.copy(copyTasks, path__default["default"].join(directory));
|
|
398
408
|
}
|
|
399
409
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
400
410
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
401
411
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
402
412
|
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
403
|
-
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
413
|
+
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'`;
|
|
404
414
|
|
|
405
415
|
/**
|
|
406
416
|
* Creates an Angular module declaration for a component wrapper.
|
|
@@ -438,8 +448,8 @@ async function copyResources(config, outputTarget) {
|
|
|
438
448
|
if (!config.sys || !config.sys.copy || !config.sys.glob) {
|
|
439
449
|
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
440
450
|
}
|
|
441
|
-
const srcDirectory =
|
|
442
|
-
const destDirectory =
|
|
451
|
+
const srcDirectory = path__default["default"].join(__dirname, '..', 'angular-component-lib');
|
|
452
|
+
const destDirectory = path__default["default"].join(path__default["default"].dirname(outputTarget.directivesProxyFile), 'angular-component-lib');
|
|
443
453
|
return config.sys.copy([
|
|
444
454
|
{
|
|
445
455
|
src: srcDirectory,
|
|
@@ -451,8 +461,8 @@ async function copyResources(config, outputTarget) {
|
|
|
451
461
|
], srcDirectory);
|
|
452
462
|
}
|
|
453
463
|
function generateProxies(components, pkgData, outputTarget, rootDir) {
|
|
454
|
-
const distTypesDir =
|
|
455
|
-
const dtsFilePath =
|
|
464
|
+
const distTypesDir = path__default["default"].dirname(pkgData.types);
|
|
465
|
+
const dtsFilePath = path__default["default"].join(rootDir, distTypesDir, GENERATED_DTS);
|
|
456
466
|
const { outputType } = outputTarget;
|
|
457
467
|
const componentsTypeFile = relativeImport(outputTarget.directivesProxyFile, dtsFilePath, '.d.ts');
|
|
458
468
|
const includeSingleComponentAngularModules = outputType === OutputTypes.Scam;
|
|
@@ -571,18 +581,19 @@ const angularOutputTarget = (outputTarget) => {
|
|
|
571
581
|
};
|
|
572
582
|
};
|
|
573
583
|
function normalizeOutputTarget(config, outputTarget) {
|
|
574
|
-
|
|
584
|
+
var _a, _b;
|
|
585
|
+
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: (_a = outputTarget.customElementsDir) !== null && _a !== void 0 ? _a : 'components', outputType: (_b = outputTarget.outputType) !== null && _b !== void 0 ? _b : OutputTypes.Standalone });
|
|
575
586
|
if (config.rootDir == null) {
|
|
576
587
|
throw new Error('rootDir is not set and it should be set by stencil itself');
|
|
577
588
|
}
|
|
578
589
|
if (outputTarget.directivesProxyFile == null) {
|
|
579
590
|
throw new Error('directivesProxyFile is required. Please set it in the Stencil config.');
|
|
580
591
|
}
|
|
581
|
-
if (outputTarget.directivesProxyFile && !
|
|
582
|
-
results.directivesProxyFile = normalizePath(
|
|
592
|
+
if (outputTarget.directivesProxyFile && !path__default["default"].isAbsolute(outputTarget.directivesProxyFile)) {
|
|
593
|
+
results.directivesProxyFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesProxyFile));
|
|
583
594
|
}
|
|
584
|
-
if (outputTarget.directivesArrayFile && !
|
|
585
|
-
results.directivesArrayFile = normalizePath(
|
|
595
|
+
if (outputTarget.directivesArrayFile && !path__default["default"].isAbsolute(outputTarget.directivesArrayFile)) {
|
|
596
|
+
results.directivesArrayFile = normalizePath(path__default["default"].join(config.rootDir, outputTarget.directivesArrayFile));
|
|
586
597
|
}
|
|
587
598
|
if (outputTarget.includeSingleComponentAngularModules !== undefined) {
|
|
588
599
|
throw new Error("The 'includeSingleComponentAngularModules' option has been removed. Please use 'outputType' instead.");
|
package/dist/index.js
CHANGED
|
@@ -149,7 +149,7 @@ function createPropertyDeclaration(prop, type, inlinePropertyAsSetter = false) {
|
|
|
149
149
|
let eventName = prop.name;
|
|
150
150
|
if (/[-/]/.test(prop.name)) {
|
|
151
151
|
// If a member name includes a dash or a forward slash, we need to wrap it in quotes.
|
|
152
|
-
// https://github.com/
|
|
152
|
+
// https://github.com/stenciljs/output-targets/issues/212
|
|
153
153
|
eventName = `'${prop.name}'`;
|
|
154
154
|
}
|
|
155
155
|
if (inlinePropertyAsSetter) {
|
|
@@ -196,8 +196,8 @@ const createAngularComponentDefinition = (tagName, inputs, outputs, methods, inc
|
|
|
196
196
|
proxyCmpOptions.push(`\n methods: [${formattedMethods}]`);
|
|
197
197
|
}
|
|
198
198
|
let standaloneOption = '';
|
|
199
|
-
if (standalone
|
|
200
|
-
standaloneOption = `\n standalone:
|
|
199
|
+
if (!standalone) {
|
|
200
|
+
standaloneOption = `\n standalone: false`;
|
|
201
201
|
}
|
|
202
202
|
const propertyDeclarations = inlineComponentProps.map((m) => createPropertyDeclaration(m, `Components.${tagNameAsPascal}['${m.name}']`, true));
|
|
203
203
|
const propertiesDeclarationText = [`protected el: HTML${tagNameAsPascal}Element;`, ...propertyDeclarations].join('\n ');
|
|
@@ -276,6 +276,10 @@ const formatOutputType = (componentClassName, event) => {
|
|
|
276
276
|
return [p1, `I${componentClassName}${v.substring(1, v.length - 1)}`, p2].join('');
|
|
277
277
|
}
|
|
278
278
|
return [p1, dst, p2].join('');
|
|
279
|
+
})
|
|
280
|
+
// Capture all instances that contain sub types, e.g. `IMyComponent.SomeMoreComplexType.SubType`.
|
|
281
|
+
.replace(new RegExp(`^${src}(\.\\w+)+$`, 'g'), (type) => {
|
|
282
|
+
return `I${componentClassName}${src}.${type.split('.').slice(1).join('.')}`;
|
|
279
283
|
}));
|
|
280
284
|
}, event.complexType.original
|
|
281
285
|
.replace(/\n/g, ' ')
|
|
@@ -377,7 +381,7 @@ function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
|
377
381
|
return srcFileContents
|
|
378
382
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
379
383
|
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
380
|
-
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType
|
|
384
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType !== OutputTypes.Standalone ? ',\nstandalone: false' : '');
|
|
381
385
|
}
|
|
382
386
|
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
383
387
|
if (!config.sys || !config.sys.copy) {
|
|
@@ -398,7 +402,7 @@ const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
|
398
402
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
399
403
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
400
404
|
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
401
|
-
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
405
|
+
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'`;
|
|
402
406
|
|
|
403
407
|
/**
|
|
404
408
|
* Creates an Angular module declaration for a component wrapper.
|
|
@@ -569,7 +573,8 @@ const angularOutputTarget = (outputTarget) => {
|
|
|
569
573
|
};
|
|
570
574
|
};
|
|
571
575
|
function normalizeOutputTarget(config, outputTarget) {
|
|
572
|
-
|
|
576
|
+
var _a, _b;
|
|
577
|
+
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: (_a = outputTarget.customElementsDir) !== null && _a !== void 0 ? _a : 'components', outputType: (_b = outputTarget.outputType) !== null && _b !== void 0 ? _b : OutputTypes.Standalone });
|
|
573
578
|
if (config.rootDir == null) {
|
|
574
579
|
throw new Error('rootDir is not set and it should be set by stencil itself');
|
|
575
580
|
}
|
package/dist/plugin.js
CHANGED
|
@@ -17,7 +17,8 @@ export const angularOutputTarget = (outputTarget) => {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
export function normalizeOutputTarget(config, outputTarget) {
|
|
20
|
-
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const results = Object.assign(Object.assign({}, outputTarget), { excludeComponents: outputTarget.excludeComponents || [], valueAccessorConfigs: outputTarget.valueAccessorConfigs || [], customElementsDir: (_a = outputTarget.customElementsDir) !== null && _a !== void 0 ? _a : 'components', outputType: (_b = outputTarget.outputType) !== null && _b !== void 0 ? _b : OutputTypes.Standalone });
|
|
21
22
|
if (config.rootDir == null) {
|
|
22
23
|
throw new Error('rootDir is not set and it should be set by stencil itself');
|
|
23
24
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The type of output that can be generated with the Angular output target.
|
|
3
3
|
* - `component` - Generate many component wrappers tied to a single Angular module (lazy/hydrated approach).
|
|
4
4
|
* - `scam` - Generate a Single Component Angular Module for each component.
|
|
5
|
-
* - `standalone` -
|
|
5
|
+
* - `standalone` - Generates standalone components.
|
|
6
6
|
*/
|
|
7
7
|
export type OutputType = 'component' | 'scam' | 'standalone';
|
|
8
8
|
export interface OutputTargetAngular {
|
|
@@ -24,7 +24,7 @@ export interface OutputTargetAngular {
|
|
|
24
24
|
* The type of output that should be generated.
|
|
25
25
|
* - `component` - Generate many component wrappers tied to a single Angular module (lazy/hydrated approach).
|
|
26
26
|
* - `scam` - Generate a Single Component Angular Module for each component.
|
|
27
|
-
* - `standalone` -
|
|
27
|
+
* - `standalone` - (default) Generates standalone components.
|
|
28
28
|
*/
|
|
29
29
|
outputType?: OutputType;
|
|
30
30
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"prepublishOnly": "pnpm run build",
|
|
25
|
-
"prebuild": "rimraf ./dist
|
|
25
|
+
"prebuild": "rimraf ./dist",
|
|
26
26
|
"build": "tsc && pnpm run rollup",
|
|
27
27
|
"dev": "run-p dev:*",
|
|
28
28
|
"dev:build": "tsc --watch --preserveWatchOutput",
|
|
@@ -39,17 +39,18 @@
|
|
|
39
39
|
},
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/
|
|
42
|
+
"url": "git+https://github.com/stenciljs/output-targets.git"
|
|
43
43
|
},
|
|
44
44
|
"author": "Ionic Team",
|
|
45
45
|
"homepage": "https://stenciljs.com/",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"bugs": {
|
|
48
|
-
"url": "https://github.com/
|
|
48
|
+
"url": "https://github.com/stenciljs/output-targets/issues"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@angular/core": "8.2.14",
|
|
52
52
|
"@angular/forms": "8.2.14",
|
|
53
|
+
"@stencil/core": "4.32.0",
|
|
53
54
|
"@types/node": "^18.0.0",
|
|
54
55
|
"npm-run-all2": "^6.2.4",
|
|
55
56
|
"rimraf": "^5.0.0",
|
|
@@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor';
|
|
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
|
9
9
|
host: {
|
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'
|
|
11
11
|
},
|
|
12
12
|
providers: [
|
|
13
13
|
{
|
|
@@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor';
|
|
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
|
9
9
|
host: {
|
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'
|
|
11
11
|
},
|
|
12
12
|
providers: [
|
|
13
13
|
{
|
|
@@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor';
|
|
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
|
9
9
|
host: {
|
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'
|
|
11
11
|
},
|
|
12
12
|
providers: [
|
|
13
13
|
{
|
|
@@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor';
|
|
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
|
9
9
|
host: {
|
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'
|
|
11
11
|
},
|
|
12
12
|
providers: [
|
|
13
13
|
{
|
|
@@ -7,7 +7,7 @@ import { ValueAccessor } from './value-accessor';
|
|
|
7
7
|
/* tslint:disable-next-line:directive-selector */
|
|
8
8
|
selector: '<VALUE_ACCESSOR_SELECTORS>',
|
|
9
9
|
host: {
|
|
10
|
-
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target
|
|
10
|
+
'(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target?.["<VALUE_ACCESSOR_TARGETATTR>"])'
|
|
11
11
|
},
|
|
12
12
|
providers: [
|
|
13
13
|
{
|