Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ce-la-react

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ce-la-react - npm Package Compare versions

Comparing version 0.0.0 to 0.1.0

README.md

36

dist/ce-la-react.d.ts

@@ -27,4 +27,4 @@ /**

export type WebComponentProps<I extends HTMLElement> = React.DetailedHTMLProps<React.HTMLAttributes<I>, I> & ElementProps<I>;
type ElementProps<I> = Partial<Omit<I, keyof HTMLElement>>;
type ComponentProps<I, E extends EventNames> = Omit<React.HTMLAttributes<I>, keyof E | keyof ElementProps<I>> & EventListeners<E> & ElementProps<I>;
export type ElementProps<I> = Partial<Omit<I, keyof HTMLElement | 'connectedCallback' | 'disconnectedCallback' | 'attributeChangedCallback' | 'adoptedCallback'>>;
export type ComponentProps<I, E extends EventNames> = Omit<React.HTMLAttributes<I>, keyof E | keyof ElementProps<I>> & EventListeners<E> & ElementProps<I>;
/**

@@ -68,2 +68,4 @@ * Type used to cast an event name with an event type when providing the

}
export declare function defaultToAttributeName(propName: string): string;
export declare function defaultToAttributeValue(propValue: unknown): unknown;
export interface Options<I extends HTMLElement, E extends EventNames> extends Partial<AttributeOptions> {

@@ -76,3 +78,33 @@ react: TReact;

}
/**
* Creates a React component for a custom element. Properties are distinguished
* from attributes automatically, and events can be configured so they are added
* to the custom element as event listeners.
*
* @param options An options bag containing the parameters needed to generate a
* wrapped web component.
*
* @param options.react The React module, typically imported from the `react`
* npm package.
* @param options.tagName The custom element tag name registered via
* `customElements.define`.
* @param options.elementClass The custom element class registered via
* `customElements.define`.
* @param options.events An object listing events to which the component can
* listen. The object keys are the event property names passed in via React
* props and the object values are the names of the corresponding events
* generated by the custom element. For example, given `{onactivate:
* 'activate'}` an event function may be passed via the component's `onactivate`
* prop and will be called when the custom element fires its `activate` event.
* @param options.displayName A React component display name, used in debugging
* messages. Default value is inferred from the name of custom element class
* registered via `customElements.define`.
* @param options.toAttributeName A function that converts a React prop name to
* a custom element attribute name. Default value is a function that converts
* prop names to lower case.
* @param options.toAttributeValue A function that converts a React prop value to
* a custom element attribute value. Default value is a function that converts
* boolean prop values to empty strings and all other primitive values to strings.
*/
export declare function createComponent<I extends HTMLElement, E extends EventNames>({ react: React, tagName, elementClass, events, displayName, toAttributeName, toAttributeValue, }: Options<I, E>): React.ForwardRefExoticComponent<React.PropsWithoutRef<ComponentProps<I, E>> & React.RefAttributes<I>>;
export {};

4

dist/ce-la-react.js

@@ -134,3 +134,5 @@ /**

export {
createComponent
createComponent,
defaultToAttributeName,
defaultToAttributeValue
};
{
"name": "ce-la-react",
"version": "0.0.0",
"version": "0.1.0",
"type": "module",

@@ -5,0 +5,0 @@ "description": "Create a React component from a custom element.",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc