/* Hyrrokkin - A visual modelling tool for constructing directed graphs.
Copyright (C) 2022-2026 Visual Topology Ltd
Licensed under the MIT License
*/
var hyrrokkin = hyrrokkin || {};
hyrrokkin.api_home_url = document.currentScript.src.split("/").slice(0,-1).join("/");
hyrrokkin.DesignerApi = class {
/**
* Create a hyrrokkin graphical editor
*/
constructor() {
this.system = new hyrrokkin.DesignerSystem();
}
/**
* Initialise hyrrokkin graphical editor
*
* @param {string} element_id - the name of the document element into which hyrrokkin will be loaded
* @param {Object} options - various options to customise hyrrokkin
* @param {Object} model - class instance implementing the hyrrokkin.ModelBase API
*/
async init(element_id, options, model) {
await this.system.init(element_id, options, model);
}
}
/**
* Asynchronous function to create a hyrrokkin graphical editor widget
*
* @param {string} element_id - the name of the document element into which hyrrokkin will be loaded
* @param {Object} options - various options to configure hyrrokkin
* @param {Object} model- model implementation
*/
hyrrokkin.start_designer = async function(element_id, options, model) {
if (options.debug_l10n) {
hyrrokkin.L10NBundle.debug = true;
}
hyrrokkin.$(element_id).setAttribute("class","hyrrokkin_design_container");
let designer_api = new hyrrokkin.DesignerApi();
await designer_api.init(element_id, options, model);
return designer_api;
}