Skip to content

Commit

Permalink
[create-pull-request] update tsc build dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
JackNoordhuis authored Sep 13, 2023
1 parent 85a8bc7 commit 173a3db
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export { type KnownClassConstructor, type KnownConstructor, type AlpineComponentConstructor, type AlpineDataContext, type AlpineData, AlpineComponent } from './src/Component';
export { type ComponentList, ComponentStore, transformToAlpineData, makeAlpineConstructor } from './src/Store';
export * as Globals from './src/Global';
export { AlpineComponents, componentsPlugin } from './src/Plugin';
import { componentsPlugin } from './src/Plugin';
export default componentsPlugin;
7 changes: 7 additions & 0 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/Component.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export type KnownClassConstructor<T extends AlpineComponent> = new (...args: any[]) => T;
export type KnownGenericConstructor<T> = (...args: any[]) => T;
export type KnownConstructor<T> = KnownGenericConstructor<T> | KnownClassConstructor<T>;
export type AlpineComponentConstructor = (...args: any[]) => any;
export declare interface AlpineDataContext {
init?(): void;
[stateKey: string]: any;
}
export declare type AlpineData = AlpineDataContext | string | number | boolean;
export declare abstract class AlpineComponent<T = object> implements AlpineDataContext {
$data: T;
$el: HTMLElement;
$refs: Record<string, HTMLElement>;
$store: AlpineData;
$dispatch: (event: string, data?: any) => void;
$id: (name: string, key?: number | string) => string;
$nextTick: (callback?: () => void) => Promise<void>;
$watch: <K extends keyof T | string, V extends (K extends keyof T ? T[K] : any)>(property: K, callback: (newValue: V, oldValue: V) => void) => void;
}
7 changes: 7 additions & 0 deletions src/Component.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/Global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Alpine as AlpineType } from 'alpinejs';
import type { ComponentStore } from "./Store";
import type { AlpineComponentConstructor } from "./Component";
export declare interface AlpineComponentMixins {
Components: ComponentStore;
component: (name: string) => AlpineComponentConstructor;
}
export declare type AlpineWithComponents = AlpineType & AlpineComponentMixins;
export declare type Alpine = AlpineType | AlpineWithComponents;
declare global {
interface Window {
Alpine: Alpine;
AlpineComponents: ComponentStore;
}
}
2 changes: 2 additions & 0 deletions src/Global.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/Plugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type * as Globals from './Global';
import { type ComponentList } from "./Store";
export declare namespace AlpineComponents {
interface Options {
components: ComponentList;
startAlpine: boolean;
logErrors: boolean;
}
const defaultOptions: Options;
function bootstrap(options?: Partial<Options>, alpine?: Globals.Alpine): void;
}
export declare function componentsPlugin(alpine: Globals.Alpine): void;
36 changes: 36 additions & 0 deletions src/Plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions src/Store.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type * as Impl from "./Component";
import type * as Globals from './Global';
import { AlpineComponent } from "./Component";
export type ComponentList = {
[name: string]: Impl.KnownConstructor<any>;
};
export declare class ComponentStore {
private alpine;
private logErrors;
private initialized;
private components;
constructor(alpine: Globals.Alpine, components?: ComponentList, logErrors?: boolean);
private init;
component(name: string): Impl.AlpineComponentConstructor;
registerAll(components: ComponentList): void;
register<T>(name: string, component: Impl.KnownConstructor<T>): void;
register<T extends Impl.AlpineComponent>(component: Impl.KnownClassConstructor<T>, name?: string): void;
private registerConstructorAsAlpineData;
private static getObjectData;
private static getClassData;
private logRegisterFailure;
}
export declare function transformToAlpineData<T extends AlpineComponent>(instance: T): object;
export declare function makeAlpineConstructor<T extends AlpineComponent>(component: Impl.KnownClassConstructor<T>): Impl.AlpineComponentConstructor;
Loading

0 comments on commit 173a3db

Please sign in to comment.