@stencil/angular-output-target 0.0.1-dev.11724437043.1612ee70 → 0.0.1-dev.11727116314.1857d8ca

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.
@@ -149,8 +149,8 @@ export const createComponentTypeDefinition = (outputType, tagNameAsPascal, event
149
149
  const eventTypes = publicEvents.map((event) => {
150
150
  const comment = createDocComment(event.docs);
151
151
  let eventName = event.name;
152
- if (event.name.includes('-')) {
153
- // If an event name includes a dash, we need to wrap it in quotes.
152
+ if (/[-/]/.test(event.name)) {
153
+ // If an event name includes a dash or a forward slash, we need to wrap it in quotes.
154
154
  // https://github.com/ionic-team/stencil-ds-output-targets/issues/212
155
155
  eventName = `'${event.name}'`;
156
156
  }
@@ -1,8 +1,8 @@
1
- import type { OutputTargetAngular } from './types';
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 intialized at this step. Notify the developer');
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
@@ -294,8 +294,8 @@ const createComponentTypeDefinition = (outputType, tagNameAsPascal, events, comp
294
294
  const eventTypes = publicEvents.map((event) => {
295
295
  const comment = createDocComment(event.docs);
296
296
  let eventName = event.name;
297
- if (event.name.includes('-')) {
298
- // If an event name includes a dash, we need to wrap it in quotes.
297
+ if (/[-/]/.test(event.name)) {
298
+ // If an event name includes a dash or a forward slash, we need to wrap it in quotes.
299
299
  // https://github.com/ionic-team/stencil-ds-output-targets/issues/212
300
300
  eventName = `'${event.name}'`;
301
301
  }
@@ -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 intialized at this step. Notify the developer');
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
@@ -286,8 +286,8 @@ const createComponentTypeDefinition = (outputType, tagNameAsPascal, events, comp
286
286
  const eventTypes = publicEvents.map((event) => {
287
287
  const comment = createDocComment(event.docs);
288
288
  let eventName = event.name;
289
- if (event.name.includes('-')) {
290
- // If an event name includes a dash, we need to wrap it in quotes.
289
+ if (/[-/]/.test(event.name)) {
290
+ // If an event name includes a dash or a forward slash, we need to wrap it in quotes.
291
291
  // https://github.com/ionic-team/stencil-ds-output-targets/issues/212
292
292
  eventName = `'${event.name}'`;
293
293
  }
@@ -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 intialized at this step. Notify the developer');
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.11724437043.1612ee70",
3
+ "version": "0.0.1-dev.11727116314.1857d8ca",
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": "612ee706d141dd58ae9a6bcc1a029df6ee919c8a"
67
+ "gitHead": "857d8ca5cbf5bc2da386b4d264df36bd996603c5"
68
68
  }
@@ -15,7 +15,7 @@ import { ValueAccessor } from './value-accessor';
15
15
  useExisting: BooleanValueAccessor,
16
16
  multi: true
17
17
  }
18
- ]
18
+ ]<VALUE_ACCESSOR_STANDALONE>
19
19
  })
20
20
  export class BooleanValueAccessor extends ValueAccessor {
21
21
  constructor(el: ElementRef) {
@@ -15,7 +15,7 @@ import { ValueAccessor } from './value-accessor';
15
15
  useExisting: NumericValueAccessor,
16
16
  multi: true
17
17
  }
18
- ]
18
+ ]<VALUE_ACCESSOR_STANDALONE>
19
19
  })
20
20
  export class NumericValueAccessor extends ValueAccessor {
21
21
  constructor(el: ElementRef) {
@@ -15,7 +15,7 @@ import { ValueAccessor } from './value-accessor';
15
15
  useExisting: RadioValueAccessor,
16
16
  multi: true
17
17
  }
18
- ]
18
+ ]<VALUE_ACCESSOR_STANDALONE>
19
19
  })
20
20
  export class RadioValueAccessor extends ValueAccessor {
21
21
  constructor(el: ElementRef) {
@@ -15,7 +15,7 @@ import { ValueAccessor } from './value-accessor';
15
15
  useExisting: SelectValueAccessor,
16
16
  multi: true
17
17
  }
18
- ]
18
+ ]<VALUE_ACCESSOR_STANDALONE>
19
19
  })
20
20
  export class SelectValueAccessor extends ValueAccessor {
21
21
  constructor(el: ElementRef) {
@@ -15,7 +15,7 @@ import { ValueAccessor } from './value-accessor';
15
15
  useExisting: TextValueAccessor,
16
16
  multi: true
17
17
  }
18
- ]
18
+ ]<VALUE_ACCESSOR_STANDALONE>
19
19
  })
20
20
  export class TextValueAccessor extends ValueAccessor {
21
21
  constructor(el: ElementRef) {