@stencil/angular-output-target 0.0.1-dev.11724437043.1612ee70 → 0.0.1-dev.11725543716.1fa90560
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-value-accessors.d.ts +2 -2
- package/dist/generate-value-accessors.js +7 -4
- package/dist/index.cjs.js +6 -4
- package/dist/index.js +6 -4
- package/package.json +2 -2
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { OutputTargetAngular, OutputType } from './types';
|
|
2
2
|
import type { CompilerCtx, ComponentCompilerMeta, Config } from '@stencil/core/internal';
|
|
3
3
|
export interface ValueAccessor {
|
|
4
4
|
elementSelectors: string[];
|
|
5
5
|
eventTargets: [string, string][];
|
|
6
6
|
}
|
|
7
7
|
export default function generateValueAccessors(compilerCtx: CompilerCtx, components: ComponentCompilerMeta[], outputTarget: OutputTargetAngular, config: Config): Promise<void>;
|
|
8
|
-
export declare function createValueAccessor(srcFileContents: string, valueAccessor: ValueAccessor): string;
|
|
8
|
+
export declare function createValueAccessor(srcFileContents: string, valueAccessor: ValueAccessor, outputType?: OutputType): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EOL } from 'os';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { OutputTypes } from './utils';
|
|
3
4
|
export default async function generateValueAccessors(compilerCtx, components, outputTarget, config) {
|
|
4
5
|
if (!Array.isArray(outputTarget.valueAccessorConfigs) || outputTarget.valueAccessorConfigs.length === 0) {
|
|
5
6
|
return;
|
|
@@ -25,20 +26,21 @@ export default async function generateValueAccessors(compilerCtx, components, ou
|
|
|
25
26
|
const targetFilePath = path.join(targetDir, targetFileName);
|
|
26
27
|
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
27
28
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
28
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
29
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
29
30
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
30
31
|
}));
|
|
31
32
|
await copyResources(config, ['value-accessor.ts'], targetDir);
|
|
32
33
|
}
|
|
33
|
-
export function createValueAccessor(srcFileContents, valueAccessor) {
|
|
34
|
+
export function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
34
35
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
35
36
|
return srcFileContents
|
|
36
37
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
37
|
-
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
38
|
+
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
39
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
|
|
38
40
|
}
|
|
39
41
|
function copyResources(config, resourcesFilesToCopy, directory) {
|
|
40
42
|
if (!config.sys || !config.sys.copy) {
|
|
41
|
-
throw new Error('stencil is not properly
|
|
43
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
42
44
|
}
|
|
43
45
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
44
46
|
return {
|
|
@@ -53,4 +55,5 @@ function copyResources(config, resourcesFilesToCopy, directory) {
|
|
|
53
55
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
54
56
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
55
57
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
58
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
56
59
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
package/dist/index.cjs.js
CHANGED
|
@@ -357,20 +357,21 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
357
357
|
const targetFilePath = path__default["default"].join(targetDir, targetFileName);
|
|
358
358
|
const srcFilePath = path__default["default"].join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
359
359
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
360
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
360
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
361
361
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
362
362
|
}));
|
|
363
363
|
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
|
364
364
|
}
|
|
365
|
-
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
365
|
+
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
366
366
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
367
367
|
return srcFileContents
|
|
368
368
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
369
|
-
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`))
|
|
369
|
+
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${os.EOL}`))
|
|
370
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
|
|
370
371
|
}
|
|
371
372
|
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
372
373
|
if (!config.sys || !config.sys.copy) {
|
|
373
|
-
throw new Error('stencil is not properly
|
|
374
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
374
375
|
}
|
|
375
376
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
376
377
|
return {
|
|
@@ -385,6 +386,7 @@ function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
|
385
386
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
386
387
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
387
388
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
389
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
388
390
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
|
389
391
|
|
|
390
392
|
/**
|
package/dist/index.js
CHANGED
|
@@ -349,20 +349,21 @@ async function generateValueAccessors(compilerCtx, components, outputTarget, con
|
|
|
349
349
|
const targetFilePath = path.join(targetDir, targetFileName);
|
|
350
350
|
const srcFilePath = path.join(__dirname, '../resources/control-value-accessors/', targetFileName);
|
|
351
351
|
const srcFileContents = await compilerCtx.fs.readFile(srcFilePath);
|
|
352
|
-
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType]);
|
|
352
|
+
const finalText = createValueAccessor(srcFileContents, normalizedValueAccessors[valueAccessorType], outputTarget.outputType);
|
|
353
353
|
await compilerCtx.fs.writeFile(targetFilePath, finalText);
|
|
354
354
|
}));
|
|
355
355
|
await copyResources$1(config, ['value-accessor.ts'], targetDir);
|
|
356
356
|
}
|
|
357
|
-
function createValueAccessor(srcFileContents, valueAccessor) {
|
|
357
|
+
function createValueAccessor(srcFileContents, valueAccessor, outputType) {
|
|
358
358
|
const hostContents = valueAccessor.eventTargets.map((listItem) => VALUE_ACCESSOR_EVENTTARGETS.replace(VALUE_ACCESSOR_EVENT, listItem[0]).replace(VALUE_ACCESSOR_TARGETATTR, listItem[1]));
|
|
359
359
|
return srcFileContents
|
|
360
360
|
.replace(VALUE_ACCESSOR_SELECTORS, valueAccessor.elementSelectors.join(', '))
|
|
361
|
-
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
361
|
+
.replace(VALUE_ACCESSOR_EVENTTARGETS, hostContents.join(`,${EOL}`))
|
|
362
|
+
.replace(VALUE_ACCESSOR_STANDALONE, outputType && outputType === OutputTypes.Standalone ? ',standalone: true' : '');
|
|
362
363
|
}
|
|
363
364
|
function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
364
365
|
if (!config.sys || !config.sys.copy) {
|
|
365
|
-
throw new Error('stencil is not properly
|
|
366
|
+
throw new Error('stencil is not properly initialized at this step. Notify the developer');
|
|
366
367
|
}
|
|
367
368
|
const copyTasks = resourcesFilesToCopy.map((rf) => {
|
|
368
369
|
return {
|
|
@@ -377,6 +378,7 @@ function copyResources$1(config, resourcesFilesToCopy, directory) {
|
|
|
377
378
|
const VALUE_ACCESSOR_SELECTORS = `<VALUE_ACCESSOR_SELECTORS>`;
|
|
378
379
|
const VALUE_ACCESSOR_EVENT = `<VALUE_ACCESSOR_EVENT>`;
|
|
379
380
|
const VALUE_ACCESSOR_TARGETATTR = '<VALUE_ACCESSOR_TARGETATTR>';
|
|
381
|
+
const VALUE_ACCESSOR_STANDALONE = '<VALUE_ACCESSOR_STANDALONE>';
|
|
380
382
|
const VALUE_ACCESSOR_EVENTTARGETS = ` '(<VALUE_ACCESSOR_EVENT>)': 'handleChangeEvent($event.target.<VALUE_ACCESSOR_TARGETATTR>)'`;
|
|
381
383
|
|
|
382
384
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/angular-output-target",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.11725543716.1fa90560",
|
|
4
4
|
"description": "Angular output target for @stencil/core components.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
],
|
|
65
65
|
"testURL": "http://localhost"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "fa90560e48946ff872ee54461813e5df8b4b2026"
|
|
68
68
|
}
|