2018-08-05 18:19:48 +02:00
|
|
|
import Pattern from "./pattern";
|
|
|
|
import Point from "./point";
|
|
|
|
import Path from "./path";
|
|
|
|
import Snippet from "./snippet";
|
2018-07-23 11:44:34 +00:00
|
|
|
import * as utils from "./utils";
|
2018-07-23 11:12:06 +00:00
|
|
|
|
2018-07-23 14:16:39 +00:00
|
|
|
import { version } from "../package.json";
|
|
|
|
|
2019-02-09 13:45:10 +01:00
|
|
|
const create = function(config, plugins = false) {
|
|
|
|
const pattern = function(settings) {
|
2019-02-10 14:40:37 +01:00
|
|
|
Pattern.call(this, config);
|
2019-02-09 13:45:10 +01:00
|
|
|
if (Array.isArray(plugins)) for (let plugin of plugins) this.use(plugin);
|
|
|
|
if (plugins) this.use(plugins);
|
|
|
|
this.apply(settings);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Set up inheritance
|
2019-02-10 14:40:37 +01:00
|
|
|
pattern.prototype = Object.create(Pattern.prototype);
|
2019-02-09 13:45:10 +01:00
|
|
|
pattern.prototype.constructor = pattern;
|
|
|
|
|
|
|
|
return pattern;
|
|
|
|
};
|
|
|
|
|
2018-07-23 11:12:06 +00:00
|
|
|
export default {
|
2018-07-23 14:16:39 +00:00
|
|
|
version: version,
|
2018-08-05 18:19:48 +02:00
|
|
|
Pattern,
|
|
|
|
Point,
|
|
|
|
Path,
|
|
|
|
Snippet,
|
2018-07-26 13:43:12 +00:00
|
|
|
utils,
|
|
|
|
patterns: {},
|
2019-02-09 13:45:10 +01:00
|
|
|
plugins: {},
|
|
|
|
create
|
2018-07-23 11:44:34 +00:00
|
|
|
};
|