@stencil/angular-output-target
Version:
Angular output target for @stencil/core components.
44 lines (43 loc) • 2.8 kB
TypeScript
import type { ComponentCompilerEvent, ComponentCompilerProperty } from '@stencil/core/internal';
import type { ComponentInputProperty, OutputType } from './types';
/**
* The transform function to reference in generated code, exported from
* `angular-component-lib/boolean-attribute`.
*/
export declare const INPUT_TRANSFORM_FUNCTION = "nullableBooleanAttribute";
/**
* What a wrapper needs to write its inputs as attributes during server rendering.
*/
export interface SsrInputs {
/** Inputs whose attribute isn't the dash-cased prop name, mapped to that attribute. */
attributes: Record<string, string>;
/** Inputs whose every value goes through `ssrProp()`: no attribute, or not a primitive type. */
refs: string[];
}
/**
* Creates an Angular component declaration from formatted Stencil compiler metadata.
*
* @param tagName The tag name of the component.
* @param inputs The inputs of the Stencil component (e.g. [{name: 'myInput', required: true]).
* @param methods The methods of the Stencil component. (e.g. ['myMethod']).
* @param includeImportCustomElements Whether to define the component as a custom element.
* @param standalone Whether to define the component as a standalone component.
* @param inlineComponentProps List of properties that should be inlined into the component definition.
* @param events The events of the Stencil component for generating outputs.
* @param ssr When set, the wrapper writes its inputs as attributes during server rendering.
* `attributes` maps the inputs whose attribute isn't the dash-cased prop name to that attribute,
* and `refs` lists the inputs whose every value goes through `ssrProp()`.
* @returns The component declaration as a string.
*/
export declare const createAngularComponentDefinition: (tagName: string, inputs: readonly ComponentInputProperty[], methods: readonly string[], includeImportCustomElements?: boolean, standalone?: boolean, inlineComponentProps?: readonly ComponentCompilerProperty[], events?: readonly ComponentCompilerEvent[], ssr?: SsrInputs) => string;
/**
* Creates the component interface type definition.
* @param outputType The output type.
* @param tagNameAsPascal The tag name as PascalCase.
* @param events The events to generate the interface properties for.
* @param componentCorePackage The component core package.
* @param customElementsDir The custom elements directory.
* @param typesModule The module every component type is imported from (Stencil v5 only).
* @returns The component interface type definition as a string.
*/
export declare const createComponentTypeDefinition: (outputType: OutputType, tagNameAsPascal: string, events: readonly ComponentCompilerEvent[], componentCorePackage: string, customElementsDir?: string, typesModule?: string) => string;