🚧 WIP:Work on types and exports
This commit is contained in:
parent
145272c546
commit
c8d502c698
16 changed files with 312 additions and 95 deletions
|
@ -1,11 +1,29 @@
|
|||
import { PatternConfig } from './types'
|
||||
import { PatternConfig, PatternOption } from './types'
|
||||
import Part from './part'
|
||||
import Option from './option'
|
||||
|
||||
export default class Pattern {
|
||||
config: PatternConfig;
|
||||
parts: {[propName: string]: Part};
|
||||
options: {[propName: string]: Option};
|
||||
|
||||
constructor(config: PatternConfig) {
|
||||
this.config = config;
|
||||
|
||||
this.parts = {};
|
||||
for (let id of config.parts) {
|
||||
this.parts[id] = new Part(id);
|
||||
}
|
||||
|
||||
this.options = {};
|
||||
for (let conf of config.options) {
|
||||
this.options[conf.id] = new Option(conf);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
draft(config: object): void {
|
||||
throw Error('You have to implement the draft() method in your Pattern instance.');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue