@utrecht/web-component-library-stencil
Version:
Stencil component library bundle for the Municipality of Utrecht based on the NL Design System architecture
46 lines (41 loc) • 2.42 kB
TypeScript
/**
* Get the base path to where the assets can be found. Use "setAssetPath(path)"
* if the path needs to be customized.
*/
export declare const getAssetPath: (path: string) => string;
/**
* Used to manually set the base path where assets can be found.
* If the script is used as "module", it's recommended to use "import.meta.url",
* such as "setAssetPath(import.meta.url)". Other options include
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
* But do note that this configuration depends on how your script is bundled, or lack of
* bundling, and where your assets can be loaded from. Additionally custom bundling
* will have to ensure the static assets are copied to its build directory.
*/
export declare const setAssetPath: (path: string) => void;
/**
* Used to specify a nonce value that corresponds with an application's CSP.
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
* Alternatively, the nonce value can be set on a meta tag in the DOM head
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
* will result in the same behavior.
*/
export declare const setNonce: (nonce: string) => void
export interface SetPlatformOptions {
raf?: (c: FrameRequestCallback) => number;
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
}
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
/**
* Utility to define all custom elements within this package using the tag name provided in the component's source.
* When defining each custom element, it will also check it's safe to define by:
*
* 1. Ensuring the "customElements" registry is available in the global context (window).
* 2. Ensuring that the component tag name is not already defined.
*
* Use the standard [customElements.define()](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define)
* method instead to define custom elements individually, or to provide a different tag name.
*/
export declare const defineCustomElements: (opts?: any) => void;