Separate out into files
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import type {
|
||||
NativePresentationDefinition,
|
||||
NativePresentationName,
|
||||
} from "../types";
|
||||
|
||||
export function definePresentation(definition: NativePresentationDefinition) {
|
||||
return definition;
|
||||
}
|
||||
|
||||
const builtins: NativePresentationDefinition[] = [
|
||||
{ name: "push", axis: "x" },
|
||||
{ name: "reveal", axis: "x" },
|
||||
{ name: "slide", axis: "x" },
|
||||
{ name: "fade", axis: "x" },
|
||||
{ name: "modal", axis: "y" },
|
||||
{ name: "sheet", axis: "y" },
|
||||
{ name: "none", axis: "x" },
|
||||
];
|
||||
|
||||
export class PresentationRegistry {
|
||||
private readonly definitions = new Map<
|
||||
NativePresentationName,
|
||||
NativePresentationDefinition
|
||||
>();
|
||||
|
||||
constructor(custom: NativePresentationDefinition[] = []) {
|
||||
for (const definition of [...builtins, ...custom])
|
||||
this.register(definition);
|
||||
}
|
||||
|
||||
register(definition: NativePresentationDefinition) {
|
||||
this.definitions.set(definition.name, definition);
|
||||
}
|
||||
|
||||
get(name: NativePresentationName) {
|
||||
return this.definitions.get(name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user