@stencil/angular-output-target
- Version 1.5.2
- Published
- 213 kB
- No dependencies
- MIT license
Install
npm i @stencil/angular-output-targetyarn add @stencil/angular-output-targetpnpm add @stencil/angular-output-targetOverview
Angular output target for @stencil/core components.
Index
Functions
function angularOutputTarget
angularOutputTarget: (outputTarget: OutputTargetAngular) => OutputTargetCustom;Interfaces
interface OutputTargetAngular
interface OutputTargetAngular {}property booleanAttributes
booleanAttributes?: boolean;When
true, boolean properties are declared with an Angular input transform so they can be set using attribute presence syntax:<!-- with booleanAttributes enabled --><my-component disabled></my-component><!-- otherwise the value has to be bound explicitly --><my-component [disabled]="true"></my-component>Without a transform Angular resolves the bare attribute to the empty string and reports
Type 'string' is not assignable to type 'boolean'understrictTemplates.Compile-time checking of these bindings also requires
inlineProperties. Without it the generated wrappers declare no typed members for their inputs, so Angular never checks them and there is no error for the transform to resolve.The transform still runs either way, because Angular applies it from the component definition's input map rather than from a declared class member. Enabling this on its own therefore moves boolean coercion from Stencil to the transform with nothing checking what callers pass, so prefer enabling
inlinePropertiesalongside it.The transform coerces strings the same way Angular's
booleanAttributedoes, but passesnullandundefinedthrough instead of coercing them tofalse. Refer tonullableBooleanAttribute.Properties are only transformed when Stencil reports their type as exactly
boolean. Virtual properties, properties declared asany, and types that unionbooleanwith something else (such asboolean | 'auto', reported asany) get no transform, and the property receives the attribute's empty string rather thantrue. Only the union case fails to compile; the other two are silent. Refer to the README for the differences.false
property componentCorePackage
componentCorePackage: string;The package name of the component library. This is used to generate the import statements.
property customElementsDir
customElementsDir?: string;property directivesArrayFile
directivesArrayFile?: string;Optional path to generate a file containing a
DIRECTIVESarray constant. This is primarily useful withoutputType: 'component'(lazy-loaded) where you want to declare all components in a shared NgModule:import { DIRECTIVES } from './directives';@NgModule({declarations: [...DIRECTIVES],exports: [...DIRECTIVES],})export class ComponentLibraryModule {}This option is less relevant for
outputType: 'scam'or'standalone'where consumers typically import individual component modules or standalone components directly.
property directivesProxyFile
directivesProxyFile: string;The path to the proxy file that will be generated. This can be an absolute path or a relative path from the root directory of the Stencil library.
property esModules
esModules?: boolean;If
true, the output target will generate a separate ES module for each Angular component wrapper. This enables better tree-shaking as bundlers can exclude unused components. This option only applies whenoutputTypeis'scam'or'standalone'(i.e., usingdist-custom-elements). false
property excludeComponents
excludeComponents?: string[];property inlineProperties
inlineProperties?: boolean;Experimental (!) When true, tries to inline the properties of components. This is required to enable Angular Language Service to type-check and show jsdocs when using the components in html-templates.
property outputType
outputType?: OutputType;The type of output that should be generated. -
component- Generate many component wrappers tied to a single Angular module (requiresdist, lazy/hydrated approach). -scam- Generate a Single Component Angular Module for each component (requiresdist-custom-elementsoutput). -standalone- (default) Generates standalone components (requiresdist-custom-elementsoutput).
property transformTag
transformTag?: boolean;Use
transformTagto generate a build-time script. This script patches Angular@Componentselectors in any installed Angular wrapper library enabling run-time tag transformation. Run the script as a postinstall script in your app.Setup: 1. Export
transformTagandsetTagTransformerfrom your component library:// src/index.tsexport { transformTag, setTagTransformer } from '@stencil/core';2. Add the patch script as a postinstall hook in your consuming app's package.json:
{"scripts": {"postinstall": "patch-transform-selectors \"(tag) => tag.startsWith('my-') ? `v1-${tag}` : tag\""}}3. Configure the transformer at runtime in your Angular app with the SAME transformer:
// main.tsimport { setTagTransformer } from 'component-library';setTagTransformer((tag) => tag.startsWith('my-') ? `v1-${tag}` : tag);Angular relies on a static selector string so the patch script is used to modify the installed Angular component library for transformed tags. For example, if
my-buttontransforms tov1-my-button, the selector will be patched fromselector: 'my-button'toselector: 'v1-my-button'.false
property valueAccessorConfigs
valueAccessorConfigs?: ValueAccessorConfig[];interface ValueAccessorConfig
interface ValueAccessorConfig {}property elementSelectors
elementSelectors: string | string[];property event
event: string;property targetAttr
targetAttr: string;property type
type: ValueAccessorTypes;Package Files (3)
Dependencies (0)
No dependencies.
Dev Dependencies (11)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@stencil/angular-output-target.
- Markdown[](https://www.jsdocs.io/package/@stencil/angular-output-target)
- HTML<a href="https://www.jsdocs.io/package/@stencil/angular-output-target"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1549 ms. - Missing or incorrect documentation? Open an issue for this package.
