Comparing version 4.0.0 to 4.0.2
@@ -6,4 +6,2 @@ export type ForgoRef<T> = { | ||
children?: ForgoNode | ForgoNode[]; | ||
}; | ||
export type ForgoDOMElementProps = { | ||
xmlns?: string; | ||
@@ -14,6 +12,5 @@ ref?: ForgoRef<Element>; | ||
}; | ||
} & ForgoElementProps; | ||
export type ForgoComponentProps = ForgoElementProps; | ||
export type ForgoComponentCtor<Props extends object = object> = (props: Props & ForgoComponentProps) => ForgoComponent<Props>; | ||
export type ForgoNewComponentCtor<Props extends object = object> = (props: Props & ForgoComponentProps) => Component<Props>; | ||
}; | ||
export type ForgoComponentCtor<Props extends object = object> = (props: Props & ForgoElementProps) => ForgoComponent<Props>; | ||
export type ForgoNewComponentCtor<Props extends object = object> = (props: Props & ForgoElementProps) => Component<Props>; | ||
export type ForgoElementArg = { | ||
@@ -24,12 +21,13 @@ node?: ChildNode; | ||
export type ForgoKeyType = string | number; | ||
export type ForgoElementBase<TProps extends ForgoElementProps> = { | ||
export type ForgoDOMElement<Props extends object> = { | ||
key?: ForgoKeyType; | ||
props: TProps; | ||
props: Props & ForgoElementProps; | ||
__is_forgo_element__: true; | ||
}; | ||
export type ForgoDOMElement<TProps extends ForgoDOMElementProps> = ForgoElementBase<TProps> & { | ||
type: string; | ||
}; | ||
export type ForgoComponentElement<TProps extends ForgoComponentProps> = ForgoElementBase<TProps> & { | ||
type: ForgoNewComponentCtor<TProps>; | ||
export type ForgoComponentElement<Props extends object> = { | ||
key?: ForgoKeyType; | ||
props: Props & ForgoElementProps; | ||
__is_forgo_element__: true; | ||
type: ForgoNewComponentCtor<Props>; | ||
}; | ||
@@ -43,3 +41,3 @@ export type ForgoFragment = { | ||
}; | ||
export type ForgoElement<TProps extends ForgoDOMElementProps> = ForgoDOMElement<TProps> | ForgoComponentElement<TProps>; | ||
export type ForgoElement<Props extends object> = ForgoDOMElement<Props> | ForgoComponentElement<Props>; | ||
export type ForgoNonEmptyPrimitiveNode = string | number | boolean | object | bigint | null | undefined; | ||
@@ -52,7 +50,7 @@ export type ForgoPrimitiveNode = ForgoNonEmptyPrimitiveNode | null | undefined; | ||
export type ForgoNode = ForgoPrimitiveNode | ForgoElement<any> | ForgoFragment; | ||
export type ComponentState<TProps extends object> = { | ||
export type ComponentState<Props extends object = object> = { | ||
key?: string | number; | ||
ctor: ForgoNewComponentCtor<TProps> | ForgoComponentCtor<TProps>; | ||
component: Component<TProps>; | ||
props: TProps; | ||
ctor: ForgoNewComponentCtor<Props> | ForgoComponentCtor<Props>; | ||
component: Component<Props>; | ||
props: Props & ForgoElementProps; | ||
nodes: ChildNode[]; | ||
@@ -138,5 +136,5 @@ isMounted: boolean; | ||
export declare const Fragment: unique symbol; | ||
export interface ForgoComponentMethods<Props extends ForgoComponentProps> { | ||
render: (props: Props & ForgoComponentProps, component: Component<Props>) => ForgoNode | ForgoNode[]; | ||
error?: (props: Props & ForgoComponentProps, error: unknown, component: Component<Props>) => ForgoNode; | ||
export interface ForgoComponentMethods<Props extends object> { | ||
render: (props: Props & ForgoElementProps, component: Component<Props>) => ForgoNode | ForgoNode[]; | ||
error?: (props: Props & ForgoElementProps, error: unknown, component: Component<Props>) => ForgoNode; | ||
} | ||
@@ -157,9 +155,9 @@ /** | ||
interface ComponentEventListeners<Props extends object> extends ComponentEventListenerBase { | ||
mount: Array<(props: Props & ForgoComponentProps, component: Component<Props>) => any>; | ||
remount: Array<(props: Props & ForgoComponentProps, component: Component<Props>) => any>; | ||
unmount: Array<(props: Props & ForgoComponentProps, component: Component<Props>) => any>; | ||
afterRender: Array<(props: Props & ForgoComponentProps, previousNode: ChildNode | undefined, component: Component<Props>) => any>; | ||
shouldUpdate: Array<(newProps: Props & ForgoComponentProps, oldProps: Props & ForgoComponentProps, component: Component<Props>) => boolean>; | ||
mount: Array<(props: Props & ForgoElementProps, component: Component<Props>) => any>; | ||
remount: Array<(props: Props & ForgoElementProps, component: Component<Props>) => any>; | ||
unmount: Array<(props: Props & ForgoElementProps, component: Component<Props>) => any>; | ||
afterRender: Array<(props: Props & ForgoElementProps, previousNode: ChildNode | undefined, component: Component<Props>) => any>; | ||
shouldUpdate: Array<(newProps: Props & ForgoElementProps, oldProps: Props & ForgoElementProps, component: Component<Props>) => boolean>; | ||
} | ||
interface ComponentInternal<Props extends object> { | ||
interface ComponentInternal<Props extends object = object> { | ||
unmounted: boolean; | ||
@@ -171,7 +169,7 @@ registeredMethods: ForgoComponentMethods<Props>; | ||
declare const lifecycleEmitters: { | ||
mount<Props extends object>(component: Component<Props>, props: Props): void; | ||
remount<Props_1 extends object>(component: Component<Props_1>, props: Props_1): void; | ||
unmount<Props_2 extends object>(component: Component<Props_2>, props: Props_2): void; | ||
shouldUpdate<Props_3 extends object>(component: Component<Props_3>, newProps: Props_3, oldProps: Props_3): boolean; | ||
afterRender<Props_4 extends object>(component: Component<Props_4>, props: Props_4, previousNode: ChildNode | undefined): void; | ||
mount<Props extends object = object>(component: Component<Props>, props: Props & ForgoElementProps): void; | ||
remount<Props_1 extends object = object>(component: Component<Props_1>, props: Props_1 & ForgoElementProps): void; | ||
unmount<Props_2 extends object = object>(component: Component<Props_2>, props: Props_2 & ForgoElementProps): void; | ||
shouldUpdate<Props_3 extends object = object>(component: Component<Props_3>, newProps: Props_3 & ForgoElementProps, oldProps: Props_3 & ForgoElementProps): boolean; | ||
afterRender<Props_4 extends object = object>(component: Component<Props_4>, props: Props_4 & ForgoElementProps, previousNode: ChildNode | undefined): void; | ||
}; | ||
@@ -202,7 +200,7 @@ /** | ||
*/ | ||
export declare function createElement<TProps extends ForgoElementProps & { | ||
export declare function createElement<Props extends object & { | ||
key?: any; | ||
}>(type: string | ForgoNewComponentCtor<TProps> | ForgoComponentCtor<TProps>, props: TProps, ...args: any[]): { | ||
type: string | ForgoNewComponentCtor<TProps> | ForgoComponentCtor<TProps>; | ||
props: TProps; | ||
}>(type: string | ForgoNewComponentCtor<Props> | ForgoComponentCtor<Props>, props: Props & ForgoElementProps, ...args: any[]): { | ||
type: string | ForgoNewComponentCtor<Props> | ForgoComponentCtor<Props>; | ||
props: Props & ForgoElementProps; | ||
key: any; | ||
@@ -245,10 +243,10 @@ __is_forgo_element__: boolean; | ||
*/ | ||
export type ForgoComponent<TProps extends ForgoComponentProps> = { | ||
render: (props: TProps, args: ForgoRenderArgs) => ForgoNode | ForgoNode[]; | ||
afterRender?: (props: TProps, args: ForgoAfterRenderArgs) => void; | ||
error?: (props: TProps, args: ForgoErrorArgs) => ForgoNode; | ||
mount?: (props: TProps, args: ForgoRenderArgs) => void; | ||
remount?: (props: TProps, args: ForgoRenderArgs) => void; | ||
unmount?: (props: TProps, args: ForgoRenderArgs) => void; | ||
shouldUpdate?: (newProps: TProps, oldProps: TProps) => boolean; | ||
export type ForgoComponent<Props extends object = object> = { | ||
render: (props: Props & ForgoElementProps, args: ForgoRenderArgs) => ForgoNode | ForgoNode[]; | ||
afterRender?: (props: Props & ForgoElementProps, args: ForgoAfterRenderArgs) => void; | ||
error?: (props: Props & ForgoElementProps, args: ForgoErrorArgs) => ForgoNode; | ||
mount?: (props: Props & ForgoElementProps, args: ForgoRenderArgs) => void; | ||
remount?: (props: Props & ForgoElementProps, args: ForgoRenderArgs) => void; | ||
unmount?: (props: Props & ForgoElementProps, args: ForgoRenderArgs) => void; | ||
shouldUpdate?: (newProps: Props & ForgoElementProps, oldProps: Props & ForgoElementProps) => boolean; | ||
__forgo?: { | ||
@@ -268,3 +266,3 @@ unmounted?: boolean; | ||
}; | ||
export declare const legacyComponentSyntaxCompat: <Props extends object>(legacyComponent: ForgoComponent<Props>) => Component<Props>; | ||
export declare const legacyComponentSyntaxCompat: <Props extends object = object>(legacyComponent: ForgoComponent<Props & ForgoElementProps>) => Component<Props>; | ||
export * as JSX from "./jsxTypes.js"; | ||
@@ -271,0 +269,0 @@ import * as JSXTypes from "./jsxTypes.js"; |
@@ -1,2 +0,2 @@ | ||
import type { ForgoDOMElementProps } from "./index.js"; | ||
import type { ForgoElementProps } from "./index.js"; | ||
type Defaultize<Props, Defaults> = Props extends any ? Partial<Pick<Props, Extract<keyof Props, keyof Defaults>>> & Pick<Props, Exclude<keyof Props, keyof Defaults>> : never; | ||
@@ -303,3 +303,3 @@ export type LibraryManagedAttributes<Component, Props> = Component extends { | ||
export type WheelEventHandler<Target extends EventTarget> = EventHandler<TargetedWheelEvent<Target>>; | ||
export interface DOMAttributes<Target extends EventTarget> extends ForgoDOMElementProps { | ||
export interface DOMAttributes<Target extends EventTarget> extends ForgoElementProps { | ||
onload?: GenericEventHandler<Target>; | ||
@@ -306,0 +306,0 @@ onerror?: GenericEventHandler<Target>; |
{ | ||
"name": "forgo", | ||
"version": "4.0.0", | ||
"version": "4.0.2", | ||
"main": "./dist/forgo.min.js", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -1,2 +0,2 @@ | ||
import type { ForgoDOMElementProps } from "./index.js"; | ||
import type { ForgoElementProps } from "./index.js"; | ||
@@ -423,3 +423,3 @@ /* JSX Definitions */ | ||
export interface DOMAttributes<Target extends EventTarget> | ||
extends ForgoDOMElementProps { | ||
extends ForgoElementProps { | ||
// Image Events | ||
@@ -426,0 +426,0 @@ onload?: GenericEventHandler<Target>; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
292412
14
3632