var __asyncValues = (this && this.__asyncValues) || function (o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; var l2_html; (function (l2_html) { class _100529_mls_attr_Base extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100529_mls_attr_Base = _100529_mls_attr_Base; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_MenuPages extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_api_MenuPages._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_api_MenuPages = _100529_api_MenuPages; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_configServices extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_api_configServices._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_api_configServices = _100529_api_configServices; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_configServices2 extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_api_configServices2._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_api_configServices2 = _100529_api_configServices2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_dsList extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_api_dsList._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_api_dsList = _100529_api_dsList; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_jsdoc extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } l2_html._100529_api_jsdoc = _100529_api_jsdoc; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_serviceList extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_api_serviceList._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_api_serviceList = _100529_api_serviceList; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_service_select_project extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_api_service_select_project._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_api_service_select_project = _100529_api_service_select_project; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_api_service_widgets extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_api_service_widgets._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_api_service_widgets = _100529_api_service_widgets; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_apiteste extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_apiteste._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100529_apiteste = _100529_apiteste; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_button extends l2_html.Base { constructor() { super(...arguments); this.innerHTML = new l2_fieldTypes.Input(this, { name: 'innerHTML', desc: 'innerHTML', type: 'text', helper: '_100131_helper_TextHTML', helperOptions: 'innerHTML', group: 'principal', }); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'Type the text', type: 'text', group: 'advanced', }); this.value = new l2_fieldTypes.Input(this, { name: 'value', desc: 'value for field', type: 'text' }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'value for field', type: 'text', elType: 'attr' }); this.onClick = new l2_fieldTypes.Input(this, { desc: 'function for on click, ex: MyFunc()', type: 'text', group: 'advanced', elType: 'attr' }); this.type = new l2_fieldTypes.EnumList(this, { group: 'optional', name: 'type', desc: 'Specifies the type of button', help: 'https://www.w3schools.com/tags/tag_button.asp', list: ['', 'button', 'reset', 'submit'], }); } render() { super.createEL('button-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_button._SearchDetails = { desc: 'Button HTML', section: l2_html.PCategories.Form, group: 'button', tags: ['button', 'elFlowContent', 'elPhrasingContent', 'elInteractiveContent'], childrenTags: ['!elInteractiveContent', 'elPhrasingContent'], examples: [ '{ "innerHTML": "Example of button" }' ] }; l2_html._100529_button = _100529_button; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_config_driver_collab extends mls.stor.others.DriverIOBase { constructor() { super(); this.shortName = 'collab'; this.project = 100529; this.driverVersion = '1.0.0.0'; this.getHistory = (file) => new Promise((resolve) => resolve([])); this.getHistoryContent = (file, ref) => new Promise((resolve) => resolve('')); this.getContents = (project, fileInfos) => new Promise((resolve, reject) => { try { resolve(this.getContents2(fileInfos, [])); } catch (e) { reject(new Error(e.message)); } }); this.setContents = (project, fileInfos, comments) => new Promise((resolve, reject) => { try { resolve(this.setContents2(fileInfos, comments)); } catch (e) { reject(new Error(e.message)); } }); this.setContent = (fileInfo, content, comments) => new Promise((resolve, reject) => { if (fileInfo.status === 'deleted') { resolve(false); } else if (['changed', 'new', 'nochange'].includes(fileInfo.status)) { this.save(fileInfo, content, comments).then((ret) => { resolve(ret); }).catch((erro) => reject(erro)); } else if (fileInfo.status === 'renamed') { resolve(false); } else reject(new Error('Status invalid')); }); if (mls.istrace) console.info('collabDriver: ' + this.driverVersion); } ; loadFilesInfo(project) { return new Promise((resolve, reject) => { try { const sett = mls.l5.getProjectSettings(project); const projectDriver = sett.projectDriver || 'mls'; const projectURL = sett.projectURL || ''; mls.stor.projects[project] = { project, projectDriver, projectURL, }; this.getFilesRepo(project).then((ret) => { resolve(ret); }).catch((erro) => reject(erro)); } catch (e) { reject(new Error(e.message)); } }); } async setContents2(fileInfos, comments) { if (fileInfos.length <= 0) return true; const cont = fileInfos[0].status === 'deleted' ? 'deleted' : await this.verifyAndGetContent(fileInfos[0]); if (!cont) throw new Error(`Nof found content:${fileInfos[0].shortName}.${fileInfos[0].extension}`); const r = await this.setContent(fileInfos[0], cont, comments); if (!r) throw new Error(`Erro on save file:${fileInfos[0].shortName}.${fileInfos[0].extension}`); if (fileInfos[0].onAction) { await fileInfos[0].onAction('aftersave'); } let ret = true; if (fileInfos.length >= 1) { fileInfos.splice(0, 1); ret = await this.setContents2(fileInfos, comments); } return ret; } async verifyAndGetContent(fileInfo) { const oldV = fileInfo.inLocalStorage; fileInfo.inLocalStorage = true; if (fileInfo.getValueInfo) { const cont = (await fileInfo.getValueInfo()).content; fileInfo.inLocalStorage = oldV; return cont; } const cont = await fileInfo.getContent(); fileInfo.inLocalStorage = oldV; return cont; } save(fileInfo, content, comments) { return new Promise(async (resolve, reject) => { const aux = fileInfo.folder === '' || fileInfo.folder.endsWith('/') ? '' : '/'; const ext = fileInfo.extension.startsWith('.') ? fileInfo.extension : '.' + fileInfo.extension; let fileName = fileInfo.folder.replace(/\\/g, '/') + aux + fileInfo.shortName + ext; const msg = comments === null || comments === '' ? 'Save mls file:' + fileName : comments; let cont = content; this.saveFileIO(fileInfo.project, fileInfo.level, fileName, cont, fileInfo.status).then(async (ret) => { if (!ret) { reject(new Error('Error save:' + fileName)); return; } fileInfo.versionRef = ''; await mls.stor.cache.setContent(fileInfo, cont); resolve(true); }).catch((erro) => { reject(erro); }); }); } async getContents2(fileInfos, father) { if (fileInfos.length <= 0) return father; const r = await this.getContent(fileInfos[0]); father.push({ fileInfo: fileInfos[0], content: r }); if (fileInfos.length >= 1) { fileInfos.splice(0, 1); father = await this.getContents2(fileInfos, father); } return father; } getContent(fileInfo) { return new Promise(async (resolve, reject) => { try { const aux = fileInfo.folder === '' || fileInfo.folder.endsWith('/') ? '' : '/'; const ext = fileInfo.extension ? fileInfo.extension : '.ts'; const fileName = fileInfo.folder.replace(/\\/g, '/') + aux + fileInfo.shortName + ext; const ret = await this.getContentIO(fileInfo.project, fileInfo.level, fileName); resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } getFilesRepo(project) { return new Promise(async (resolve, reject) => { try { const oril2 = await this.getFilesIO(project, 2); const oril3 = await this.getFilesIO(project, 3); const oril4 = await this.getFilesIO(project, 4); const arrl2 = this.createObj(oril2, 2); const arrl3 = this.createObj(oril3, 3); const arrl4 = this.createObj(oril4, 4); resolve([...arrl2, ...arrl3, ...arrl4]); } catch (e) { reject(e.message); } }); } createObj(arr, level) { const ret = []; let ext = ''; switch (level) { case 2: ext = '.ts'; break; case 3: ext = ''; break; case 4: ext = '.html'; break; default: ext = ''; } if (!ext && level !== 3) return []; arr.forEach((i) => { const obj = { ShortPath: `l${level}/${i.replace('/', '')}${ext}`, versionRef: '', Length: 1, LastModified: '', }; ret.push(obj); }); return ret; } saveFileIO(project, level, path, content, status) { return new Promise(async (resolve, reject) => { try { let ret = false; const objt = { project: project, module: `l${level}`, path: path, str: content, strJ: '', strC: '' }; const api = status === 'new' ? 'put' : 'post'; const data = await this.myFetchPost(api, objt); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (!data.ret) { resolve(false); return; } ret = !!data.ret; resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } getContentIO(project, level, path) { return new Promise(async (resolve, reject) => { try { let ret = ''; const q = `get?project=${project}&module=l${level}&path=${path}`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (!data.ret) { resolve(''); return; } ret = data.ret; resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } getFilesIO(project, level) { return new Promise(async (resolve, reject) => { try { let ret = []; const q = `list?project=${project}&module=l${level}`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (!data.ret) { resolve([]); return; } ret = data.ret; resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } myFetch(strParams) { return new Promise((resolve, reject) => { try { let status = 0; fetch('https://multilevelstudio.com/api/' + strParams, { method: 'GET', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, }).then((r) => { status = r.status; return r.json(); }).then((data) => { resolve({ status, ret: data }); }).catch((e) => reject(e)); } catch (er) { reject(er); } }); } myFetchPost(api, variables) { return new Promise((resolve, reject) => { mls.api.post('api/' + api, variables, !0, (event) => resolve({ status: 200, ret: event })); }); } } l2_html._100529_config_driver_collab = _100529_config_driver_collab; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_config_driver_github extends mls.stor.others.DriverIOBase { constructor() { super(); this.shortName = 'github'; this.project = 100529; this.driverVersion = '1.0.1.18'; this.getHistory = (file) => this.getHistory2(file); this.getHistoryContent = (file, ref) => this.getHistoryContent2(file, ref); this.getContents = (project, fileInfos) => new Promise((resolve, reject) => { try { resolve(this.getContents2(fileInfos, [])); } catch (e) { reject(new Error(e.message)); } }); this.setContents = (project, fileInfos, comments) => new Promise((resolve, reject) => { try { resolve(this.setContentsnew(fileInfos, comments)); } catch (e) { reject(new Error(e.message)); } }); this.setContent = (fileInfo, content, comments) => new Promise((resolve, reject) => { if (fileInfo.status === 'deleted') { this.remove(fileInfo, comments).then((ret) => { resolve(ret); }).catch((erro) => reject(erro)); } else if (['changed', 'new', 'nochange'].includes(fileInfo.status)) { this.save(fileInfo, content, comments).then((ret) => { resolve(ret); }).catch((erro) => reject(erro)); } else if (fileInfo.status === 'renamed') { this.rename(fileInfo, comments).then((ret) => { resolve(ret); }).catch((erro) => reject(erro)); } else reject(new Error('Status invalid')); }); if (mls.istrace) console.info('gitDriver: ' + this.driverVersion); } get mKey() { const _mKey = localStorage.getItem('keyGitHub'); if (!_mKey) throw new Error('Please configure your key git hub'); return _mKey; } loadFilesInfo(project) { return new Promise((resolve, reject) => { try { const sett = mls.l5.getProjectSettings(project); const projectDriver = sett.projectDriver || 'mls'; const projectURL = sett.projectURL || ''; mls.stor.projects[project] = { project, projectDriver, projectURL, }; this.getFilesRepo(project).then((ret) => { resolve(ret); }).catch((erro) => reject(erro)); } catch (e) { reject(new Error(e.message)); } }); } getHistoryContent2(file, ref) { return new Promise(async (resolve, reject) => { try { if (file.status === 'new') resolve(''); const ret = await this.getHistoryContentIO(file.project, ref); resolve(ret); } catch (e) { reject(e); } }); } getHistory2(file) { return new Promise(async (resolve, reject) => { try { if (file.status === 'new') resolve([]); const filename = file.shortName + (file.extension.startsWith('.') ? file.extension : '.' + file.extension); const oid = file.versionRef; const data = await this.getHistoryIO(file.project, file.level.toString(), filename, oid); if (data.length <= 0) resolve([]); const ret = []; data.forEach((i) => { const obj = { authorName: i.node.author.name, authorUrl: i.node.author.avatarUrl, data: i.node.authoredDate, ref: i.node.file.object.oid, message: i.node.message, additions: i.node.additions, deletions: i.node.deletions, }; ret.push(obj); }); resolve(ret); } catch (e) { reject(e); } }); } getFilesRepo(project) { return new Promise(async (resolve, reject) => { try { const data = await this.getFilesRepoIO(project); let ret = []; if (!data.data.repository.object) resolve(ret); if (data.data.repository.object.entries.length <= 0) resolve(ret); data.data.repository.object.entries.forEach((obj1) => { ret = this.auxLoadFilesInfo2Reenter(obj1, ret); }); resolve(ret); } catch (e) { reject(e); } }); } auxLoadFilesInfo2Reenter(obj, arr) { if (!obj.object || !obj.object.entries) return (arr); obj.object.entries.forEach((obj2) => { if (obj2.type === 'blob') { arr.push({ ShortPath: obj2.path, versionRef: obj2.oid, Length: obj2.size, }); } else { this.auxLoadFilesInfo2Reenter(obj2, arr); } }); return (arr); } async getContents2(fileInfos, father) { if (fileInfos.length <= 0) return father; const r = await this.getContent(fileInfos[0]); father.push({ fileInfo: fileInfos[0], content: r }); if (fileInfos.length >= 1) { fileInfos.splice(0, 1); father = await this.getContents2(fileInfos, father); } return father; } getContent(fileInfo) { return new Promise(async (resolve, reject) => { try { const aux = fileInfo.folder === '' || fileInfo.folder.endsWith('/') ? '' : '/'; const ext = fileInfo.extension ? fileInfo.extension : '.ts'; const fileName = `l${fileInfo.level}/` + fileInfo.folder.replace(/\\/g, '/') + aux + fileInfo.shortName + ext; const ret = await this.getFilesIO(fileInfo.project, fileName); resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } async setContentsnew(fileInfos, comments) { var e_1, _a, e_2, _b; if (fileInfos.length <= 0) return true; let ret = false; const add = []; const del = []; try { for (var fileInfos_1 = __asyncValues(fileInfos), fileInfos_1_1; fileInfos_1_1 = await fileInfos_1.next(), !fileInfos_1_1.done;) { const f = fileInfos_1_1.value; const aux = f.folder === '' || f.folder.endsWith('/') ? '' : '/'; const aux2 = f.extension.startsWith('.') ? '' : '.'; const path = `l${f.level}/` + f.folder.replace(/\\/g, '/') + aux + f.shortName + aux2 + f.extension; if (f.status === 'deleted') { del.push({ path }); } else if (['changed', 'new', 'nochange'].includes(f.status)) { let cont = await this.verifyAndGetContent(f); if (typeof cont !== 'string') { cont = await this.fileToBase64(cont); [, cont] = cont.split('base64,'); } else cont = btoa(cont); add.push({ path, content: cont }); } else if (f.status === 'renamed') { let cont = await this.verifyAndGetContent(f); const info = await f.getValueInfo(); const fileNameOld = `l${f.level}/` + f.folder.replace(/\\/g, '/') + aux + info.originalShortName + f.extension; if (typeof cont !== 'string') { cont = await this.fileToBase64(cont); [, cont] = cont.split('base64,'); } else cont = btoa(cont); add.push({ path, content: cont }); del.push({ path: fileNameOld }); } else throw new Error('Status invalid'); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (fileInfos_1_1 && !fileInfos_1_1.done && (_a = fileInfos_1.return)) await _a.call(fileInfos_1); } finally { if (e_1) throw e_1.error; } } ret = await this.saveMultipleFilesIO(fileInfos[0].project, add, del, comments); try { try { for (var fileInfos_2 = __asyncValues(fileInfos), fileInfos_2_1; fileInfos_2_1 = await fileInfos_2.next(), !fileInfos_2_1.done;) { const f = fileInfos_2_1.value; if (f.onAction) { await f.onAction('aftersave'); } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (fileInfos_2_1 && !fileInfos_2_1.done && (_b = fileInfos_2.return)) await _b.call(fileInfos_2); } finally { if (e_2) throw e_2.error; } } } catch (e) { console.info('Erro onAftersace:' + e.message); } return ret; } async setContents2(fileInfos, comments) { if (fileInfos.length <= 0) return true; const cont = fileInfos[0].status === 'deleted' ? 'deleted' : await this.verifyAndGetContent(fileInfos[0]); if (!cont) throw new Error(`Nof found content:${fileInfos[0].shortName}.${fileInfos[0].extension}`); const r = await this.setContent(fileInfos[0], cont, comments); if (!r) throw new Error(`Erro on save file:${fileInfos[0].shortName}.${fileInfos[0].extension}`); if (fileInfos[0].onAction) { await fileInfos[0].onAction('aftersave'); } let ret = true; if (fileInfos.length >= 1) { fileInfos.splice(0, 1); ret = await this.setContents2(fileInfos, comments); } return ret; } async verifyAndGetContent(fileInfo) { const oldV = fileInfo.inLocalStorage; fileInfo.inLocalStorage = true; if (fileInfo.getValueInfo) { const cont = (await fileInfo.getValueInfo()).content; fileInfo.inLocalStorage = oldV; return cont; } const cont = await fileInfo.getContent(); fileInfo.inLocalStorage = oldV; return cont; } remove(fileInfo, comments) { return new Promise((resolve, reject) => { const aux = fileInfo.folder === '' || fileInfo.folder.endsWith('/') ? '' : '/'; const aux2 = fileInfo.extension.startsWith('.') ? '' : '.'; const fileName = `l${fileInfo.level}/` + fileInfo.folder.replace(/\\/g, '/') + aux + fileInfo.shortName + aux2 + fileInfo.extension; const msg = comments === null || comments === '' ? 'Remove mls file:' + fileName : comments; this.removeFileIO(fileInfo.project, msg, fileName).then(async (ret) => { if (!ret) { reject(new Error('Error remove:' + fileName)); return; } resolve(true); }).catch((erro) => { reject(erro); }); }); } save(fileInfo, content, comments) { return new Promise(async (resolve, reject) => { const aux = fileInfo.folder === '' || fileInfo.folder.endsWith('/') ? '' : '/'; const ext = fileInfo.extension.startsWith('.') ? fileInfo.extension : '.' + fileInfo.extension; let fileName = `l${fileInfo.level}/` + fileInfo.folder.replace(/\\/g, '/') + aux + fileInfo.shortName + ext; const msg = comments === null || comments === '' ? 'Save mls file:' + fileName : comments; let needConvert = true; let cont = content; if (typeof cont !== 'string') { cont = await this.fileToBase64(content); [, cont] = cont.split('base64,'); needConvert = false; } this.saveFileIO(fileInfo.project, msg, fileName, cont, needConvert).then(async (ret) => { if (!ret) { reject(new Error('Error save:' + fileName)); return; } fileInfo.versionRef = ret; await mls.stor.cache.setContent(fileInfo, cont); resolve(true); }).catch((erro) => { reject(erro); }); }); } rename(fileInfo, comments) { return new Promise(async (resolve, reject) => { try { if (!fileInfo.getValueInfo) { reject(new Error('Erro rename not implemented: getValueInfo')); return; } const info = await fileInfo.getValueInfo(); const content = info ? info.content : undefined; if (!content) { reject(new Error('Erro rename file part 1')); return; } let needConvert = true; let cont = content; if (typeof cont !== 'string') { cont = await this.fileToBase64(content); [, cont] = cont.split('base64,'); needConvert = false; } const aux = fileInfo.folder === '' || fileInfo.folder.endsWith('/') ? '' : '/'; const ext = fileInfo.extension.startsWith('.') ? fileInfo.extension : '.' + fileInfo.extension; const fileName = `l${fileInfo.level}/` + fileInfo.folder.replace(/\\/g, '/') + aux + info.originalShortName + ext; const newFileName = `l${fileInfo.level}/` + fileInfo.folder.replace(/\\/g, '/') + aux + fileInfo.shortName + ext; const ret = await this.renameFileIO(fileInfo.project, comments, fileName, newFileName, cont, needConvert); resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } fileToBase64(file) { return new Promise((resolve, reject) => { if (!file) reject(new Error('File not exist')); const FR = new FileReader(); FR.addEventListener("load", (evt) => { resolve(evt.target.result); }); FR.readAsDataURL(file); }); } async afterUpdate(fileInfo) { const info = fileInfo.getValueInfo ? await fileInfo.getValueInfo() : undefined; const origemKey = info ? mls.stor.getKeyToFiles(info.originalProject, fileInfo.level, info.originalShortName, fileInfo.folder, fileInfo.extension) : undefined; if (fileInfo.status === 'deleted') { mls.l2.editor.remove({ project: fileInfo.project, shortName: fileInfo.shortName }); } else if (fileInfo.status === 'renamed' && info) { mls.l2.editor.remove({ project: info.originalProject, shortName: info.originalShortName }); } if (fileInfo.status === 'renamed' && origemKey && mls.stor.files[origemKey]) { await mls.stor.localStor.setContent(mls.stor.files[origemKey], { content: null }); } else { await mls.stor.localStor.setContent(fileInfo, { content: null }); } if (fileInfo.status === 'renamed' && origemKey && mls.stor.files[origemKey]) { delete mls.stor.files[origemKey]; } else if (fileInfo.status === 'deleted') { const mykey = mls.stor.getKeyToFiles(fileInfo.project, fileInfo.level, fileInfo.shortName, fileInfo.folder, fileInfo.extension); delete mls.stor.files[mykey]; } if (fileInfo && fileInfo.status !== 'deleted') { fileInfo.status = 'nochange'; } } getMyKeysBranch(project) { if (!mls.stor.projects[project]) throw new Error('Not found projectInfo:' + project); const { projectURL } = mls.stor.projects[project]; const info = projectURL.split('/'); return { branch: info[1], owner: info[2], repo: info[3] }; } getFilesRepoIO(project) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { const q = `query repository { repository(owner:"${info.owner}", name:"${info.repo}") { object(expression: "HEAD:") { # Top-level. ... on Tree { entries { name oid path type size ... on TreeEntry{ object{ # Top-level. ... on Tree { entries { name oid path type size ... on TreeEntry{ object{ # Top-level. ... on Tree { entries { name oid path size type ... on TreeEntry{ object{ # Top-level. ... on Tree { entries { name oid path size type ... on TreeEntry{ object{ # Top-level. ... on Tree { entries { name oid path size type ... on TreeEntry{ object{ # Top-level. ... on Tree { entries { name oid path size type ... on TreeEntry{ object{ # Top-level. ... on Tree { entries { name oid path size type } } } } } } } } } } } } } } } } } } } } } } } } } } } } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } resolve(data.ret); } catch (e) { reject(new Error(e.message)); } }); } getFilesIO(project, fileName) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { let ret = null; const q = `query { repository(owner:"${info.owner}", name:"${info.repo}") { object(expression: "HEAD:${fileName}") { ... on Blob { byteSize oid text } } } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } if (!data.ret.data.repository || !data.ret.data.repository.object) { reject(new Error('File not found:' + fileName)); return; } ret = data.ret.data.repository.object.text; resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } saveMultipleFilesIO(project, add, del, msg) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { const oid = await this.getOidLastCommitIO(project); const aAdd = []; const aDel = []; add.forEach((i) => { aAdd.push(`{path: "${i.path}", contents: "${i.content}"}`); }); del.forEach((i) => { aDel.push(`{path: "${i.path}"}`); }); const auxAdd = aAdd.length > 0 ? `additions: [ ${aAdd.join(', ')} ]` : ''; const auxDel = aDel.length > 0 ? `deletions: [ ${aDel.join(', ')} ]` : ''; if (auxAdd === '' && auxDel === '') { resolve(true); return; } const q = `mutation { createCommitOnBranch( input: { fileChanges: { ${auxAdd === '' ? '' : auxAdd + ', '} ${auxDel} }, branch: { repositoryNameWithOwner: "${info.owner}/${info.repo}", branchName: "${info.branch}" }, expectedHeadOid: "${oid}", message: {headline: "${msg}", body: "${msg}"} } ) { commit { abbreviatedOid } } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } const ret = data.ret.data && data.ret.data.createCommitOnBranch && data.ret.data.createCommitOnBranch.commit && data.ret.data.createCommitOnBranch.commit.abbreviatedOid; resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } saveFileIO(project, msg, filename, content, needConvert = true) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { const oid = await this.getOidLastCommitIO(project); const text = needConvert ? btoa(content) : content; const q = `mutation createCommitOnBranch { createCommitOnBranch(input: { branch: { repositoryNameWithOwner: "${info.owner}/${info.repo}", branchName: "${info.branch}" }, message: { headline: "${msg}" }, fileChanges: { additions: [ { path: "${filename}", contents: "${text}" } ] }, expectedHeadOid: "${oid}" }) { commit { url oid } } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } const ret = !data.ret.data || !data.ret.data.createCommitOnBranch || !data.ret.data.createCommitOnBranch.commit || !data.ret.data.createCommitOnBranch.commit.url || !data.ret.data.createCommitOnBranch.commit.oid; let retOid; if (!ret) retOid = data.ret.data.createCommitOnBranch.commit.oid; resolve(retOid); } catch (e) { reject(new Error(e.message)); } }); } removeFileIO(project, msg, filename) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { const oid = await this.getOidLastCommitIO(project); const q = ` mutation { createCommitOnBranch(input: { branch: { repositoryNameWithOwner: "${info.owner}/${info.repo}", branchName: "${info.branch}" }, message: { headline: "${msg}" }, fileChanges: { deletions: [ { path: "${filename}" } ] }, expectedHeadOid: "${oid}" }) { commit { url } } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } const ret = !data.ret.data || !data.ret.data.createCommitOnBranch || !data.ret.data.createCommitOnBranch.commit || !data.ret.data.createCommitOnBranch.commit.url; resolve(!ret); } catch (e) { reject(new Error(e.message)); } }); } renameFileIO(project, msg, fileName, newFileName, content, needConvert = true) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { const oid = await this.getOidLastCommitIO(project); const text = needConvert ? btoa(content) : content; const q = ` mutation { createCommitOnBranch(input: { branch: { repositoryNameWithOwner: "${info.owner}/${info.repo}", branchName: "${info.branch}" }, message: { headline: "${msg}" }, fileChanges: { deletions: [ { path: "${fileName}", } ], additions: [ { path: "${newFileName}", contents: "${text}" } ] }, expectedHeadOid: "${oid}" }) { commit { url } } } `; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } const ret = !data.ret.data || !data.ret.data.createCommitOnBranch || !data.ret.data.createCommitOnBranch.commit || !data.ret.data.createCommitOnBranch.commit.url; resolve(!ret); } catch (e) { reject(new Error(e.message)); } }); } getHistoryContentIO(project, oid) { const info = this.getMyKeysBranch(project); return new Promise((resolve, reject) => { const query = ` query { repository(owner:"${info.owner}", name: "${info.repo}") { object(oid: "${oid}") { ... on Blob { byteSize id oid text } } } }`; this.myFetch(query).then((data) => { try { if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } if (!data.ret || !data.ret.data.repository.object || !data.ret.data.repository.object.text) resolve(''); resolve(data.ret.data.repository.object.text); } catch (err) { reject(err); } }).catch((e) => { reject(e); }); }); } getHistoryIO(project, nivel, fileName, oid) { const info = this.getMyKeysBranch(project); return new Promise((resolve, reject) => { const query = ` query { repository(owner: "${info.owner}", name: "${info.repo}") { ref(qualifiedName: "main") { target { ... on Commit { history(first: 20, path:"l${nivel}/${fileName}", before:"${oid}") { pageInfo { hasNextPage endCursor } edges { node { additions deletions author{ avatarUrl name } authoredDate message file(path:"l${nivel}/${fileName}"){ object{ ... on Blob { oid } } } } } } } } } } }`; this.myFetch(query).then((data) => { try { if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } if (!data.ret || !data.ret.data.repository.ref || !data.ret.data.repository.ref.target || !data.ret.data.repository.ref.target.history.edges) resolve([]); resolve(data.ret.data.repository.ref.target.history.edges); } catch (err) { reject(err); } }).catch((e) => { reject(e); }); }); } getOidLastCommitIO(project) { const info = this.getMyKeysBranch(project); return new Promise((resolve, reject) => { const qLastCommit = `{ repository(owner:"${info.owner}", name:"${info.repo}") { defaultBranchRef { target { ... on Commit { history(first: 1) { nodes { oid } } } } } } }`; this.myFetch(qLastCommit).then((data) => { try { if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } if (!data.ret || !data.ret.data.repository.defaultBranchRef || !data.ret.data.repository.defaultBranchRef.target.history.nodes) resolve(''); const lastCommit = data.ret.data.repository.defaultBranchRef.target.history.nodes[0].oid; resolve(lastCommit); } catch (err) { reject(err); } }).catch((e) => { reject(e); }); }); } myFetch(query, variables) { return new Promise((resolve, reject) => { try { const body = { query }; if (variables) body.variables = variables; let status = 0; fetch('https://api.github.com/graphql', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: 'bearer ' + this.mKey }, body: JSON.stringify(body) }).then((r) => { status = r.status; return r.json(); }).then((data) => { resolve({ status, ret: data }); }).catch((e) => reject(e)); } catch (er) { reject(er); } }); } } l2_html._100529_config_driver_github = _100529_config_driver_github; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_config_driver_gitlab extends mls.stor.others.DriverIOBase { constructor() { super(); this.shortName = 'gitlab'; this.project = 100529; this.driverVersion = '1.0.0.0'; this.getHistory = (file) => this.getHistory2(file); this.getHistoryContent = (file, ref) => this.getHistoryContent2(file, ref); this.getContents = (project, fileInfos) => new Promise((resolve, reject) => { try { resolve(this.getContents2(fileInfos, [])); } catch (e) { reject(new Error(e.message)); } }); this.setContents = (project, fileInfos, comments) => new Promise((resolve, reject) => { try { resolve(this.setContentsnew(fileInfos, comments)); } catch (e) { reject(new Error(e.message)); } }); if (mls.istrace) console.info('gitlabDriver:' + this.driverVersion); } get mKey() { const _mKey = localStorage.getItem('keyGitLab'); if (!_mKey) throw new Error('Please configure your key gitlab'); return _mKey; } loadFilesInfo(project) { return new Promise((resolve, reject) => { try { const sett = mls.l5.getProjectSettings(project); const projectDriver = sett.projectDriver || 'mls'; const projectURL = sett.projectURL || ''; mls.stor.projects[project] = { project, projectDriver, projectURL, }; this.getFilesRepo(project).then((ret) => { resolve(ret); }).catch((erro) => reject(erro)); } catch (e) { reject(new Error(e.message)); } }); } getHistoryContent2(file, ref) { return new Promise(async (resolve, reject) => { try { if (file.status === 'new') resolve(''); let filename = file.shortName + (file.extension.startsWith('.') ? file.extension : '.' + file.extension); const idProject = await this.getIDProject(file.project); filename = filename.replace(/\//g, '%2F').replace(/\./g, '%2E'); const api = `projects/${idProject}/repository/files/${filename}/raw?ref=${ref}`; const ret = await this.myFetchGet(api); if (!ret.ret) resolve(''); else resolve(ret.ret); } catch (e) { reject(e); } }); } getHistory2(file) { return new Promise(async (resolve, reject) => { try { if (file.status === 'new') resolve([]); const filename = file.shortName + (file.extension.startsWith('.') ? file.extension : '.' + file.extension); const idProject = await this.getIDProject(file.project); const api = `projects/${idProject}/repository/commits?path=${filename}`; const data = await this.myFetchGet(api); if (data.ret.length <= 0) resolve([]); const ret = []; data.ret.forEach((i) => { const obj = { authorName: i.author_name, authorUrl: '', data: i.created_at, ref: i.id, message: i.message, additions: 0, deletions: 0, }; ret.push(obj); }); resolve(ret); } catch (e) { reject(e); } }); } getFilesRepo(project) { return new Promise(async (resolve, reject) => { try { const data = await this.getFilesRepoIO(project); let ret = []; if (!data.data.project || !data.data.project.repository || !data.data.project.repository.tree || !data.data.project.repository.tree.blobs || !data.data.project.repository.tree.blobs.nodes) resolve(ret); if (data.data.project.repository.tree.blobs.nodes.length <= 0) resolve(ret); data.data.project.repository.tree.blobs.nodes.forEach((obj1) => { const obj = { ShortPath: obj1.path, versionRef: obj1.sha, Length: 0, }; ret.push(obj); }); resolve(ret); } catch (e) { reject(e); } }); } async getContents2(fileInfos, father) { if (fileInfos.length <= 0) return father; const r = await this.getContent(fileInfos[0]); father.push({ fileInfo: fileInfos[0], content: r }); if (fileInfos.length >= 1) { fileInfos.splice(0, 1); father = await this.getContents2(fileInfos, father); } return father; } getContent(fileInfo) { return new Promise(async (resolve, reject) => { try { const aux = fileInfo.folder === '' || fileInfo.folder.endsWith('/') ? '' : '/'; const ext = fileInfo.extension ? fileInfo.extension : '.ts'; const fileName = `l${fileInfo.level}/` + fileInfo.folder.replace(/\\/g, '/') + aux + fileInfo.shortName + ext; const ret = await this.getFilesIO(fileInfo.project, fileName); resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } async setContentsnew(fileInfos, comments) { var e_3, _a, e_4, _b; if (fileInfos.length <= 0) return true; let ret = false; const act = []; try { for (var fileInfos_3 = __asyncValues(fileInfos), fileInfos_3_1; fileInfos_3_1 = await fileInfos_3.next(), !fileInfos_3_1.done;) { const f = fileInfos_3_1.value; const aux = f.folder === '' || f.folder.endsWith('/') ? '' : '/'; const aux2 = f.extension.startsWith('.') ? '' : '.'; const path = `l${f.level}/` + f.folder.replace(/\\/g, '/') + aux + f.shortName + aux2 + f.extension; if (f.status === 'deleted') { act.push({ action: 'DELETE', path: path, content: '', needEncoding: false }); } else if (['new'].includes(f.status)) { let cont = await this.verifyAndGetContent(f); let end = false; if (typeof cont !== 'string') { cont = await this.fileToBase64(cont); [, cont] = cont.split('base64,'); end = true; } act.push({ action: 'CREATE', path: path, content: cont.replace(/(?:\r\n|\r|\n)/g, '\\n'), needEncoding: end }); } else if (['changed', 'nochange'].includes(f.status)) { let cont = await this.verifyAndGetContent(f); let end = false; if (typeof cont !== 'string') { cont = await this.fileToBase64(cont); [, cont] = cont.split('base64,'); end = true; } act.push({ action: 'UPDATE', path: path, content: cont.replace(/(?:\r\n|\r|\n)/g, '\\n'), needEncoding: end }); } else if (f.status === 'renamed') { let cont = await this.verifyAndGetContent(f); const info = await f.getValueInfo(); const fileNameOld = `l${f.level}/` + f.folder.replace(/\\/g, '/') + aux + info.originalShortName + f.extension; let end = false; if (typeof cont !== 'string') { cont = await this.fileToBase64(cont); [, cont] = cont.split('base64,'); end = true; } else cont = btoa(cont); act.push({ action: 'CREATE', path: path, content: cont.replace(/(?:\r\n|\r|\n)/g, '\\n'), needEncoding: end }); act.push({ action: 'DELETE', path: fileNameOld, content: '', needEncoding: false }); } else throw new Error('Status invalid'); } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (fileInfos_3_1 && !fileInfos_3_1.done && (_a = fileInfos_3.return)) await _a.call(fileInfos_3); } finally { if (e_3) throw e_3.error; } } ret = await this.saveMultipleFilesIO(fileInfos[0].project, act, comments); try { try { for (var fileInfos_4 = __asyncValues(fileInfos), fileInfos_4_1; fileInfos_4_1 = await fileInfos_4.next(), !fileInfos_4_1.done;) { const f = fileInfos_4_1.value; if (f.onAction) { await f.onAction('aftersave'); } } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (fileInfos_4_1 && !fileInfos_4_1.done && (_b = fileInfos_4.return)) await _b.call(fileInfos_4); } finally { if (e_4) throw e_4.error; } } } catch (e) { console.info('Erro onAftersace:' + e.message); } return ret; } async verifyAndGetContent(fileInfo) { const oldV = fileInfo.inLocalStorage; fileInfo.inLocalStorage = true; if (fileInfo.getValueInfo) { const cont = (await fileInfo.getValueInfo()).content; fileInfo.inLocalStorage = oldV; return cont; } const cont = await fileInfo.getContent(); fileInfo.inLocalStorage = oldV; return cont; } fileToBase64(file) { return new Promise((resolve, reject) => { if (!file) reject(new Error('File not exist')); const FR = new FileReader(); FR.addEventListener("load", (evt) => { resolve(evt.target.result); }); FR.readAsDataURL(file); }); } getMyKeysBranch(project) { if (!mls.stor.projects[project]) throw new Error('Not found projectInfo:' + project); const { projectURL } = mls.stor.projects[project]; const info = projectURL.split('/'); return { branch: info[1], owner: info[2], repo: info[3] }; } getFilesRepoIO(project) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { const q = `query { project(fullPath: "${info.owner}/${info.repo}") { repository { tree(ref: "${info.branch}", recursive: true){ blobs{ nodes { name type path sha } } } } } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors && data.ret.errors.length > 0) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } resolve(data.ret); } catch (e) { reject(new Error(e.message)); } }); } getFilesIO(project, fileName) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { let ret = null; const q = `query { project(fullPath: "${info.owner}/${info.repo}") { repository { blobs(ref:"${info.branch}", paths: ["${fileName}"]) { nodes { rawBlob } } } } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors && data.ret.errors.length > 0) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } if (!data.ret.data.project || !data.ret.data.project.repository || !data.ret.data.project.repository.blobs || !data.ret.data.project.repository.blobs.nodes || !data.ret.data.project.repository.blobs.nodes[0]) { reject(new Error('File not found:' + fileName)); return; } ret = data.ret.data.project.repository.blobs.nodes[0].rawBlob; resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } saveMultipleFilesIO(project, action, msg) { const info = this.getMyKeysBranch(project); return new Promise(async (resolve, reject) => { try { const aAct = []; action.forEach((i) => { const end = i.needEncoding ? ',encoding:BASE64' : ''; aAct.push(`{action: ${i.action}, filePath: "${i.path}", content:"${i.content.replace(/\"/g, '\\"')}" ${end}}`); }); const auxAct = aAct.length > 0 ? `actions: [ ${aAct.join(', ')} ]` : ''; if (auxAct === '') throw new Error('Erro building mutation save'); const q = `mutation { commitCreate(input: { projectPath: "${info.owner}/${info.repo}", branch: "${info.branch}", message: "${msg}", ${auxAct} }) { commit { title authorName message } errors } }`; const data = await this.myFetch(q); if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors && data.ret.errors.length > 0) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } const ret = data.ret.data && data.ret.data.commitCreate && data.ret.data.commitCreate.commit && data.ret.data.commitCreate.commit.authorName; resolve(ret); } catch (e) { reject(new Error(e.message)); } }); } getIDProject(project) { const info = this.getMyKeysBranch(project); return new Promise((resolve, reject) => { const query = ` query { project(fullPath: "${info.owner}/${info.repo}") { id } } `; this.myFetch(query).then((data) => { try { if (data.status !== 200) { reject(new Error('Erro status: ' + data.status + '; ' + data.ret.message)); return; } if (data.ret.errors) { reject(new Error('Erro' + data.ret.errors[0].message)); return; } if (!data.ret || !data.ret.data.project || !data.ret.data.project.id) resolve(''); const k = data.ret.data.project.id.split('/'); if (k.length <= 0) resolve(''); else resolve(k[k.length - 1]); } catch (err) { reject(err); } }).catch((e) => { reject(e); }); }); } myFetch(query, variables) { return new Promise((resolve, reject) => { try { const body = { query }; if (variables) body.variables = variables; let status = 0; fetch('https://gitlab.com/api/graphql', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: 'bearer ' + this.mKey }, body: JSON.stringify(body) }).then((r) => { status = r.status; return r.json(); }).then((data) => { resolve({ status, ret: data }); }).catch((e) => reject(e)); } catch (er) { reject(er); } }); } myFetchGet(api) { return new Promise((resolve, reject) => { try { let status = 0; fetch('https://gitlab.com/api/v4/' + api, { method: 'Get', headers: { 'Content-Type': 'application/json', Accept: 'application/json', Authorization: 'bearer ' + this.mKey } }).then((r) => { status = r.status; return r.json(); }).then((data) => { resolve({ status, ret: data }); }).catch((e) => reject(e)); } catch (er) { reject(er); } }); } } l2_html._100529_config_driver_gitlab = _100529_config_driver_gitlab; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_config_ds_default extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100529_config_ds_default = _100529_config_ds_default; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_css_base extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100529_css_base = _100529_css_base; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_editorQuillDocs extends l2_html.Base { constructor() { super(...arguments); this.opened = new l2_fieldTypes.Boolean(this, { desc: 'editor enabled', group: 'principal', elType: 'attr' }); this.value = new l2_fieldTypes.Input(this, { desc: 'editor enabled', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-docs-editor-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_editorQuillDocs._SearchDetails = { section: l2_html.PCategories.layout, desc: 'editor quill', tags: ['elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_editorQuillDocs = _100529_editorQuillDocs; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_boolean extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-boolean-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_boolean._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_boolean = _100529_mls_attr_boolean; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_class extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-class-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_class._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_class = _100529_mls_attr_class; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_color extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-color-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_color._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_color = _100529_mls_attr_color; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_json extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); this.pattern = new l2_fieldTypes.Input(this, { desc: 'Define a pattern regex for attr', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-json-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_json._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_json = _100529_mls_attr_json; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_list extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); this.list = new l2_fieldTypes.Input(this, { desc: 'Define a options for a list attr', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-list-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_list._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_list = _100529_mls_attr_list; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_number extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); this.max = new l2_fieldTypes.Input(this, { desc: 'Define a max for attr', type: 'number', group: 'principal', elType: 'attr', }); this.min = new l2_fieldTypes.Input(this, { desc: 'Define a min for attr', type: 'number', group: 'principal', elType: 'attr', }); this.step = new l2_fieldTypes.Input(this, { desc: 'Define a step for attr', type: 'text', group: 'principal', elType: 'attr', }); } render() { super.createEL('mls-attr-number-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_number._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_number = _100529_mls_attr_number; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_page extends l2_html.BaseHtml { constructor() { super(...arguments); this.widgetName = new l2_fieldTypes.Input(this, { desc: 'Define a title of attr page', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-page-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_page._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_page = _100529_mls_attr_page; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_section extends l2_html.BaseHtml { constructor() { super(...arguments); this.sectionName = new l2_fieldTypes.Input(this, { desc: 'Define a section name of attr page', type: 'text', group: 'principal', elType: 'attr' }); this.visible = new l2_fieldTypes.Boolean(this, { desc: 'Define whether the section is initially visible', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-section-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_section._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_section = _100529_mls_attr_section; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_string extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); this.pattern = new l2_fieldTypes.Input(this, { desc: 'Define a pattern regex for attr', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-string-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_string._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_string = _100529_mls_attr_string; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_attr_textarea extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.tips = new l2_fieldTypes.Input(this, { desc: 'Define a tips for attr', type: 'text', group: 'principal', elType: 'attr' }); this.rows = new l2_fieldTypes.Input(this, { desc: 'Define number of rows for textarea', type: 'number', group: 'principal', elType: 'attr' }); this.cols = new l2_fieldTypes.Input(this, { desc: 'Define number of cols for textarea', type: 'number', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-attr-textarea-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_attr_textarea._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_attr_textarea = _100529_mls_attr_textarea; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_card_item extends l2_html.Base { constructor() { super(...arguments); this.iconClass = new l2_fieldTypes.Input(this, { desc: 'Define a icon of attr', type: 'text', group: 'principal', elType: 'attr' }); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.text = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.searchDetails = new l2_fieldTypes.Input(this, { desc: 'Define a icon of attr', type: 'text', group: 'principal' }); } render() { super.createEL('mls-card-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_card_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_card_item = _100529_mls_card_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_collab_l3_select_ds extends l2_html.Base { render() { super.createEL('mls-l3-select-ds-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_collab_l3_select_ds._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_collab_l3_select_ds = _100529_mls_collab_l3_select_ds; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_collab_logo extends l2_html.Base { render() { super.createEL('mls-collab-logo-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_collab_logo._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_collab_logo = _100529_mls_collab_logo; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_collab_progress extends l2_html.Base { render() { super.createEL('mls-collab-progress-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_collab_progress._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_collab_progress = _100529_mls_collab_progress; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_collab_ticker extends l2_html.Base { constructor() { super(...arguments); this.text = new l2_fieldTypes.Input(this, { desc: 'Define a text ', type: 'text', group: 'principal', elType: 'attr' }); this.element = new l2_fieldTypes.EnumList(this, { desc: 'Define a element to render', group: 'principal', elType: 'attr', list: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'] }); } render() { super.createEL('mls-collab-ticker-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_collab_ticker._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_collab_ticker = _100529_mls_collab_ticker; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_container_split extends l2_html.BaseHtml { constructor() { super(...arguments); this.defaultLeft = new l2_fieldTypes.Input(this, { desc: 'Set a default width for left panel', type: 'number', group: 'principal', elType: 'attr' }); this.defaultRight = new l2_fieldTypes.Input(this, { desc: 'Set a default width for left panel', type: 'number', group: 'principal', elType: 'attr' }); this.minRightPx = new l2_fieldTypes.Input(this, { desc: 'Define minimum right panel px ', type: 'number', group: 'principal', elType: 'attr' }); this.minLeftPx = new l2_fieldTypes.Input(this, { desc: 'Define minimum left panel px', type: 'number', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-container-split-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_container_split._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_container_split = _100529_mls_container_split; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_contentShadow extends l2_html.BaseHtml { constructor() { super(...arguments); this.tabIndexActive = new l2_fieldTypes.Input(this, { desc: 'Define a initial tab index visible', type: 'number', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-contentshadow-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_contentShadow._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_contentShadow = _100529_mls_contentShadow; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_create_example_wc extends l2_html.Base { render() { super.createEL('mls-create-example-wc-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_create_example_wc._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_create_example_wc = _100529_mls_create_example_wc; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_dyn_page extends l2_html.BaseHtml { constructor() { super(...arguments); this.mlsref = new l2_fieldTypes.Input(this, { desc: 'Define a p�gina que deve ser carregada. Ex: _100529_index', type: 'text', group: 'principal', elType: 'attr' }); this.isvisible = new l2_fieldTypes.Boolean(this, { desc: 'Define se a p�gina deve ser exibida na tela', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-dyn-page'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_dyn_page._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_dyn_page = _100529_mls_dyn_page; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_editor extends l2_html.BaseHtml { render() { super.createEL('mls-editor-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_editor._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_editor = _100529_mls_editor; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_groupBtnModal extends l2_html.Base { constructor() { super(...arguments); this.json = new l2_fieldTypes.Input(this, { desc: 'Json', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-gpbtnmodal-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_groupBtnModal._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_groupBtnModal = _100529_mls_groupBtnModal; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_groupBtnSlider extends l2_html.Base { constructor() { super(...arguments); this.json = new l2_fieldTypes.Input(this, { desc: 'Json', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-gpbtnslider-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_groupBtnSlider._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_groupBtnSlider = _100529_mls_groupBtnSlider; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_index_menu extends l2_html.BaseHtml { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.iconClass = new l2_fieldTypes.Input(this, { desc: 'Define a icon of attr', type: 'text', group: 'principal', elType: 'attr' }); this.searchDetails = new l2_fieldTypes.Input(this, { desc: 'Define a icon of attr', type: 'text', group: 'principal' }); } render() { super.createEL('mls-index-menu-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_index_menu._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_index_menu = _100529_mls_index_menu; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_inspect extends l2_html.BaseHtml { render() { super.createEL('mls-inspect-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_inspect._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_inspect = _100529_mls_inspect; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l0 extends l2_html.BaseHtml { render() { super.createEL('mls-l0-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l0._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l0 = _100529_mls_l0; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l1 extends l2_html.BaseHtml { render() { super.createEL('mls-l1-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l1._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l1 = _100529_mls_l1; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l2 extends l2_html.BaseHtml { render() { super.createEL('mls-l2-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l2._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l2 = _100529_mls_l2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3 extends l2_html.BaseHtml { render() { super.createEL('mls-l3-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3 = _100529_mls_l3; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_assets extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-assets-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_assets._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_assets = _100529_mls_l3_assets; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_background extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-background-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_background._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_background = _100529_mls_l3_background; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_background_gallery extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-background-gallery-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_background_gallery._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_background_gallery = _100529_mls_l3_background_gallery; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_clippath extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-clippath-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_clippath._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_clippath = _100529_mls_l3_clippath; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_clippath_item extends l2_html.Base { constructor() { super(...arguments); this.examplename = new l2_fieldTypes.Input(this, { desc: 'name of example', type: 'text', group: 'principal', elType: 'attr' }); this.clip = new l2_fieldTypes.Input(this, { desc: 'css for clip example', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-clippath-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_clippath_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_clippath_item = _100529_mls_l3_clippath_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_color extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-color-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_color._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_color = _100529_mls_l3_color; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_color_item extends l2_html.Base { constructor() { super(...arguments); this.key = new l2_fieldTypes.Input(this, { desc: 'token color key', type: 'text', group: 'principal', elType: 'attr' }); this.value = new l2_fieldTypes.Input(this, { desc: 'token color value', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-color-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_color_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_color_item = _100529_mls_l3_color_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_dropdown extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field', elType: 'attr' }); this.prop = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'css prop to change', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-dropdown-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_dropdown._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_dropdown = _100529_mls_l3_dropdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_files extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-files-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_files._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_files = _100529_mls_l3_files; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_filter extends l2_html.Base { constructor() { super(...arguments); this.helper = new l2_fieldTypes.Input(this, { desc: 'name of example', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-filter-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_filter._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_filter = _100529_mls_l3_filter; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_gallery extends l2_html.Base { constructor() { super(...arguments); this.helper = new l2_fieldTypes.Input(this, { desc: 'name of example', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-gallery-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_gallery._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_gallery = _100529_mls_l3_gallery; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_gallery_item extends l2_html.Base { constructor() { super(...arguments); this.value = new l2_fieldTypes.Input(this, { desc: 'name of example', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-gallery-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_gallery_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_gallery_item = _100529_mls_l3_gallery_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_group extends l2_html.Base { constructor() { super(...arguments); this.groupname = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'group name', elType: 'attr' }); this.grouptemplate = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'group template to line values', elType: 'attr' }); this.showcheck = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'group template to line values', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-group-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_group._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_group = _100529_mls_l3_group; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_input_color extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field', elType: 'attr' }); this.label = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Value of label', elType: 'attr' }); this.prop = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'css prop to change', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-input-color-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_input_color._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_input_color = _100529_mls_l3_input_color; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_input_dropdown extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field', elType: 'attr' }); this.placeholder = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Value of placeholder', elType: 'attr' }); this.prop = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'css prop to change', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-input-dropdown-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_input_dropdown._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_input_dropdown = _100529_mls_l3_input_dropdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_input_range extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field', elType: 'attr' }); this.label = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Value of label', elType: 'attr' }); this.prop = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'css prop to change', elType: 'attr' }); this.min = new l2_fieldTypes.Input(this, { group: 'principal', type: 'number', desc: 'css prop to change', elType: 'attr' }); this.max = new l2_fieldTypes.Input(this, { group: 'principal', type: 'number', desc: 'css prop to change', elType: 'attr' }); this.step = new l2_fieldTypes.Input(this, { group: 'principal', type: 'text', desc: 'css prop to change', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-input-range-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_input_range._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_input_range = _100529_mls_l3_input_range; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_input_tags extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-input-tags-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_input_tags._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_input_tags = _100529_mls_l3_input_tags; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_line extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'title for line', type: 'text', elType: 'attr' }); this.direction = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'title for line', list: ['row', 'column'], elType: 'attr' }); this.helper = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'define if has group checkbox', elType: 'attr' }); this.linetemplate = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'line template to group values', elType: 'attr' }); this.onlyfulltemplate = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'define if has group checkbox', elType: 'attr' }); this.usecustomonchance = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'define if has group checkbox', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-line-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_line._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_line = _100529_mls_l3_line; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_servicedefault extends l2_html.Base { constructor() { super(...arguments); this.helper = new l2_fieldTypes.Input(this, { desc: 'name of example', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-servicedefault-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_servicedefault._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_servicedefault = _100529_mls_l3_servicedefault; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_styles_select extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-styles-select-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_styles_select._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_styles_select = _100529_mls_l3_styles_select; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_textshadow extends l2_html.Base { constructor() { super(...arguments); this.helper = new l2_fieldTypes.Input(this, { desc: 'name of example', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-textshadow-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_textshadow._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_textshadow = _100529_mls_l3_textshadow; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_transform extends l2_html.Base { constructor() { super(...arguments); this.helper = new l2_fieldTypes.Input(this, { desc: 'name of example', type: 'text', group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-transform-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_transform._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_transform = _100529_mls_l3_transform; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_treeview extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-treeview-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_treeview._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_treeview = _100529_mls_l3_treeview; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_treeview_item extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-treeview-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_treeview_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_treeview_item = _100529_mls_l3_treeview_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_typography_item extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-typography-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_typography_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_typography_item = _100529_mls_l3_typography_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l3_typography_section extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-l3-typography-section-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l3_typography_section._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l3_typography_section = _100529_mls_l3_typography_section; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l4 extends l2_html.BaseHtml { render() { super.createEL('mls-l4-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l4._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l4 = _100529_mls_l4; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l5 extends l2_html.BaseHtml { render() { super.createEL('mls-l5-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l5._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l5 = _100529_mls_l5; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l6 extends l2_html.BaseHtml { render() { super.createEL('mls-l6-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l6._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l6 = _100529_mls_l6; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_l7 extends l2_html.BaseHtml { render() { super.createEL('mls-l7-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_l7._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_l7 = _100529_mls_l7; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_list_card extends l2_html.Base { constructor() { super(...arguments); this.useCheck = new l2_fieldTypes.Boolean(this, { desc: 'Define a icon of attr', group: 'principal', elType: 'attr', list: ['true', 'false'] }); } render() { super.createEL('mls-list-card-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_list_card._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_list_card = _100529_mls_list_card; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_list_files extends l2_html.Base { constructor() { super(...arguments); this.change = new l2_fieldTypes.Input(this, { desc: 'change', type: 'text', group: 'principal', elType: 'attr' }); this.extension = new l2_fieldTypes.Input(this, { desc: 'extension', type: 'text', group: 'principal', elType: 'attr' }); this.level = new l2_fieldTypes.Input(this, { desc: 'level', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-list-files-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_list_files._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_list_files = _100529_mls_list_files; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_load_l4_page extends l2_html.BaseHtml { render() { super.createEL('mls-load-page-l4-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_load_l4_page._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_load_l4_page = _100529_mls_load_l4_page; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_load_l4_page_isolate extends l2_html.BaseHtml { constructor() { super(...arguments); this.tabIndexActive = new l2_fieldTypes.Input(this, { desc: 'Define a initial tab index visible', type: 'number', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-load-l4-page-isolate-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_load_l4_page_isolate._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_load_l4_page_isolate = _100529_mls_load_l4_page_isolate; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_load_webcomponent extends l2_html.BaseHtml { render() { super.createEL('mls-load-webcomponent-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_load_webcomponent._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_load_webcomponent = _100529_mls_load_webcomponent; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_loading extends l2_html.Base { render() { super.createEL('mls-loading-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_loading._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_loading = _100529_mls_loading; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_markdown extends l2_html.BaseHtml { constructor() { super(...arguments); this.text = new l2_fieldTypes.TextArea(this, { desc: 'text markdown', rows: 20, group: 'principal', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('mls-markdown-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_markdown._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_markdown = _100529_mls_markdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_monaco_editor extends l2_html.BaseHtml { render() { super.createEL('mls-monaco-editor-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } l2_html._100529_mls_monaco_editor = _100529_mls_monaco_editor; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_nav extends l2_html.BaseHtml { constructor() { super(...arguments); this.status = new l2_fieldTypes.EnumList(this, { desc: 'Define a status initial of item', group: 'principal', elType: 'attr', list: ['start', 'enabled', 'disabled'] }); this.tabIndexActive = new l2_fieldTypes.Input(this, { desc: 'Define a initial tab index visible', type: 'number', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-nav-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_nav._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_nav = _100529_mls_nav; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_nav_item extends l2_html.BaseHtml { constructor() { super(...arguments); this.icon = new l2_fieldTypes.Input(this, { desc: 'Define a nav menu item icon', type: 'text', group: 'principal', elType: 'attr' }); this.text = new l2_fieldTypes.Input(this, { desc: 'Define a nav menu item text', type: 'text', group: 'principal', elType: 'attr' }); this.tooltip = new l2_fieldTypes.Input(this, { desc: 'Define a nav menu item tooltip info text', type: 'text', group: 'principal', elType: 'attr' }); this.floatleft = new l2_fieldTypes.Boolean(this, { desc: 'Define a nav menu item tooltip info text', group: 'principal', elType: 'attr' }); this.showtext = new l2_fieldTypes.Boolean(this, { desc: 'Define a text is visible', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-nav-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_nav_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_nav_item = _100529_mls_nav_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_nav_vertical extends l2_html.BaseHtml { constructor() { super(...arguments); this.headerList = new l2_fieldTypes.Input(this, { desc: 'headerList', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-nav-vertical-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_nav_vertical._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_nav_vertical = _100529_mls_nav_vertical; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_nav_vertical_item extends l2_html.BaseHtml { constructor() { super(...arguments); this.icon = new l2_fieldTypes.Input(this, { desc: 'icon', type: 'text', group: 'principal', elType: 'attr' }); this.text = new l2_fieldTypes.Input(this, { desc: 'text', type: 'text', group: 'principal', elType: 'attr' }); this.tooltip = new l2_fieldTypes.Input(this, { desc: 'tooltip', type: 'text', group: 'principal', elType: 'attr' }); this.headerItem = new l2_fieldTypes.Input(this, { desc: 'headerItem', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-nav-vertical-item-100529'); if (this.headerItem.value === '') this.headerItem.value = this.text.value; l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_nav_vertical_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_nav_vertical_item = _100529_mls_nav_vertical_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_page extends l2_html.BaseHtml { render() { super.createEL('mls-page-100529'); l2_fieldTypes.renderAllFields(this.el, this); this.el.setAttribute('data-mlsProject', mls.actual[4].getFullName()); return this.el; } } _100529_mls_page._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_page = _100529_mls_page; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_showExample extends l2_html.Base { constructor() { super(...arguments); this.listClass = new l2_fieldTypes.Input(this, { desc: 'listClass', type: 'text', group: 'principal', elType: 'attr' }); this.widget = new l2_fieldTypes.Input(this, { desc: 'widget', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-showexample-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_showExample._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_showExample = _100529_mls_showExample; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_show_widget extends l2_html.Base { constructor() { super(...arguments); this.widget = new l2_fieldTypes.Input(this, { desc: 'widget', type: 'text', group: 'principal', elType: 'attr' }); this.title = new l2_fieldTypes.Input(this, { desc: 'title', type: 'text', group: 'principal', elType: 'attr' }); this.icon = new l2_fieldTypes.Input(this, { desc: 'title', type: 'text', group: 'principal', elType: 'attr' }); this.index = new l2_fieldTypes.Input(this, { desc: 'index', type: 'text', group: 'principal', elType: 'attr' }); this.styleName = new l2_fieldTypes.Input(this, { desc: 'index', type: 'text', group: 'principal', elType: 'attr' }); this.json = new l2_fieldTypes.Input(this, { desc: 'json', type: 'text', group: 'principal', elType: 'attr' }); this.less = new l2_fieldTypes.Input(this, { desc: 'less', type: 'text', group: 'principal', elType: 'attr' }); this.tokens = new l2_fieldTypes.Input(this, { desc: 'tokens', type: 'text', elType: 'attr' }); this.desc = new l2_fieldTypes.Input(this, { desc: 'desc', type: 'text', elType: 'attr' }); } render() { super.createEL('mls-show-widget-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_show_widget._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_show_widget = _100529_mls_show_widget; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_show_widget_examples extends l2_html.Base { constructor() { super(...arguments); this.widget = new l2_fieldTypes.Input(this, { desc: 'widget', type: 'text', group: 'principal', elType: 'attr' }); this.title = new l2_fieldTypes.Input(this, { desc: 'title', type: 'text', group: 'principal', elType: 'attr' }); this.description = new l2_fieldTypes.Input(this, { desc: 'title', type: 'text', group: 'principal', elType: 'attr' }); this.json = new l2_fieldTypes.Input(this, { desc: 'json', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-show-widget-example-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_show_widget_examples._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['section'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_show_widget_examples = _100529_mls_show_widget_examples; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_showexamplecode extends l2_html.Base { constructor() { super(...arguments); this.show = new l2_fieldTypes.Input(this, { desc: 'show', type: 'text', group: 'principal', elType: 'attr' }); this.tagname = new l2_fieldTypes.Input(this, { desc: 'tagname', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-showexamplecode-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_showexamplecode._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_showexamplecode = _100529_mls_showexamplecode; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar extends l2_html.BaseHtml { constructor() { super(...arguments); this.level = new l2_fieldTypes.Input(this, { desc: 'Set a level for this toolbar', type: 'number', group: 'principal', elType: 'attr' }); this.localStorageJsonName = new l2_fieldTypes.Input(this, { desc: 'Define a name of local storage item to save a list of toolbar items', type: 'text', group: 'principal', elType: 'attr' }); this.toolbarPosition = new l2_fieldTypes.EnumList(this, { desc: 'Define if the toolbar items is configurable', group: 'principal', elType: 'attr', list: ['left', 'right'] }); this.status = new l2_fieldTypes.EnumList(this, { desc: 'Define a status initial of item', group: 'principal', elType: 'attr', list: ['start', 'enabled', 'disabled'] }); } render() { super.createEL('mls-toolbar-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_toolbar._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_toolbar = _100529_mls_toolbar; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_content extends l2_html.BaseHtml { render() { super.createEL('mls-toolbar-content-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_toolbar_content._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_toolbar_content = _100529_mls_toolbar_content; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_content_service extends l2_html.BaseHtml { render() { super.createEL('mls-toolbar-content-service-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_toolbar_content_service._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_toolbar_content_service = _100529_mls_toolbar_content_service; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_controller extends l2_html.BaseHtml { render() { super.createEL('mls-toolbar-controller-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_toolbar_controller._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_toolbar_controller = _100529_mls_toolbar_controller; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_item extends l2_html.BaseHtml { render() { super.createEL('mls-toolbar-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_toolbar_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_toolbar_item = _100529_mls_toolbar_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_level extends l2_html.BaseHtml { constructor() { super(...arguments); this.status = new l2_fieldTypes.EnumList(this, { desc: 'Define a status initial of item', group: 'principal', elType: 'attr', list: ['start', 'enabled', 'disabled'] }); this.tabIndexActive = new l2_fieldTypes.Input(this, { desc: 'Define a initial tab index visible', type: 'number', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-toolbar-level-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_toolbar_level._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_toolbar_level = _100529_mls_toolbar_level; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_level_item extends l2_html.BaseHtml { constructor() { super(...arguments); this.icon = new l2_fieldTypes.Input(this, { desc: 'Define a nav menu item icon', type: 'text', group: 'principal', elType: 'attr' }); this.text = new l2_fieldTypes.Input(this, { desc: 'Define a nav menu item text', type: 'text', group: 'principal', elType: 'attr' }); this.tooltip = new l2_fieldTypes.Input(this, { desc: 'Define a nav menu item tooltip info text', type: 'text', group: 'principal', elType: 'attr' }); this.floatleft = new l2_fieldTypes.Boolean(this, { desc: 'Define a nav menu item tooltip info text', group: 'principal', elType: 'attr' }); this.showtext = new l2_fieldTypes.Boolean(this, { desc: 'Define a text is visible', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-toolbar-level-item-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_toolbar_level_item._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_toolbar_level_item = _100529_mls_toolbar_level_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_service extends l2_html.BaseHtml { } l2_html._100529_mls_toolbar_service = _100529_mls_toolbar_service; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_toolbar_service2 extends l2_html.BaseHtml { } l2_html._100529_mls_toolbar_service2 = _100529_mls_toolbar_service2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_tooltip extends l2_html.BaseHtml { render() { super.createEL('mls-tooltip-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_tooltip._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_tooltip = _100529_mls_tooltip; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_tree extends l2_html.Base { constructor() { super(...arguments); this.text = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.icon = new l2_fieldTypes.Input(this, { desc: 'Define a label of attr', type: 'text', group: 'principal', elType: 'attr' }); this.open = new l2_fieldTypes.EnumList(this, { desc: 'Define a label of attr', group: 'principal', elType: 'attr', list: ['true', 'false'] }); } render() { super.createEL('mls-tree-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_tree._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_tree = _100529_mls_tree; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_treeview_json extends l2_html.Base { constructor() { super(...arguments); this.json = new l2_fieldTypes.Input(this, { desc: 'Json', type: 'text', group: 'principal', elType: 'attr' }); } render() { super.createEL('mls-treeview-json-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_treeview_json._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_treeview_json = _100529_mls_treeview_json; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_mls_useCaseAdd extends l2_html.Base { render() { super.createEL('mls-usecaseadd-100529'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100529_mls_useCaseAdd._SearchDetails = { section: l2_html.PCategories.layout, desc: 'section', tags: ['elFieldset', 'elFlowContent'], childrenTags: ['!elChild', '!restricted'], examples: [] }; l2_html._100529_mls_useCaseAdd = _100529_mls_useCaseAdd; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_List extends l2_html.BaseService { constructor(el, level, position) { super(); this.projectActual = 0; this.onClickLink = (op) => { if (op === 'opDefault') return this.showDefault(); if (op === 'opAbout') return this.showAbout(); if (op === 'opAdd') return this.showAdd(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: (mls.actual[5].project ? mls.actual[5].project.toString() : '0'), actions: { opDefault: '', opAbout: 'About', opAdd: 'Add new file', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, updateTitle: undefined, }; this.onMLSEvents = async (ev) => { if (!this.isServiceVisible()) return; if (ev.level !== this.level || (ev.type !== 'FileAction')) return; const fileAction = JSON.parse(ev.desc); if (fileAction.position === this.position || !['statusOrErrorChanged', 'projectListChanged'].includes(fileAction.action) || fileAction.project === 0) return; this.loadService2(); }; if (el) el['mlsWidget'] = this; this._div1 = el; this.level = +level; this.position = position || 'left'; this._div1 = el; mls.events.addEventListener([2, 5], ['ProjectSelected'], (ev) => { if (this.projectActual === mls.actual[5].project) return; this.projectActual = 0; this.menu.title = (mls.actual[5].project ? mls.actual[5].project.toString() : '0'); if (this.menu.updateTitle) this.menu.updateTitle(); if (mls['istrace2']) console.info('ProjectSelected'); this.loadService(); }); mls.events.addListener(2, 'FileAction', this.onMLSEvents.bind(this)); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } openMenu(op) { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink(op); } showDefault() { const path = this.c2.getAttribute('path'); if (path !== '_100529_service_list_files' && path !== '') this.c2.setAttribute('path', '_100529_service_list_files'); return true; } showAdd() { if (this.menu.setMode) this.menu.setMode('editor'); this.c2.setAttribute('path', '_100529_service_list_new_file'); return true; } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_List</h2>' + '<hr>' + '<p>Widget Source: https://multilevelstudio.com/#/l2/_100529_service_List</p>' + '<p>Page Source: https://multilevelstudio.com/#/l4/_100529_service_List</p>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } onExec() { this.loadService(); return true; } loadService2() { const frame = this._div1.querySelector('iframe'); if (!frame || !frame.contentDocument || !frame.contentDocument.body['service_list_files']) return; frame.contentDocument.body['service_list_files'].changeList(500); } ; isServiceVisible() { const container = this._div1.closest('mls-toolbar-content-100529'); if (!container) return false; const serviceName = container.getAttribute('servicename'); if (serviceName !== this.constructor.name) return false; return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-l4-page-isolate-100529'); this.c2.setAttribute('path', '_100529_service_list_files'); this.c2['instance'] = this._div1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.c2.style.width = '100%'; this.c2.style.height = '100%'; this.projectActual = mls.actual[5].project; } else { this.c2['reload'](); } } } _100529_service_List.details = [, , , { name: '&#xf15b; ServiceList', ref: '' }, ]; l2_html._100529_service_List = _100529_service_List; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_Source extends l2_html.BaseService { constructor(el, level, positionToolbar) { super(); this.onClickLink = (op) => { if (op === 'opTS2') return true; if (op === 'opAbout') return this.showAbout(); if (op === 'opTheme') return this.showPageTheme(); if (op === 'opMonacoConfig') return this.showConfEditor(); if (op === 'opMonacoReset') return this.showMonacoReset(); if (op === 'opHistory') return this.showHistory(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.onClickIcon = (op) => { if (op === 'icTs') this.showActiveModel(); if (op === 'icHTML') this.createOrShowModelHTML(true); }; this.menu = { title: 'L2 - widget1', actions: { opAbout: 'About', opTheme: 'Editor - Themes', opMonacoConfig: 'Editor - config', opMonacoReset: 'Editor - reset', opHistory: 'History', }, icons: { icTs: 'Typescript;f121', icHTML: 'HTML;f1c9' }, actionDefault: '', iconDefault: 'icTs', setMode: undefined, updateTitle: undefined, getLastMode: undefined, lastIcon: undefined, setIconActive: undefined, onClickLink: this.onClickLink, onClickIcon: this.onClickIcon }; this.last = undefined; this._onChangedContent = undefined; this.onModelChange = (e, activeModel, storFile) => { clearTimeout(this._onChangedContent); this._onChangedContent = window.setTimeout(async () => { var _a; await this.updateModelStatus(activeModel, true); const ignoreChanges = (e.changes.length === 1 && e.changes[0].range.startLineNumber === 1 && e.changes[0].range.endLineNumber === 1 && e.changes[0].range.endColumn <= 2); if (ignoreChanges) return; let position; if (((_a = mls.l2.editor.editors[this.confE2('left')]) === null || _a === void 0 ? void 0 : _a.model.id) === activeModel.model.id) { position = 'left'; } else { position = 'right'; } mls.events.fireFileAction('changed', storFile, position); }, 400); }; this.getValueInfo = async (activeModel) => { const rc = { content: activeModel.model.getValue(), contentType: 'string', originalShortName: activeModel.originalShortName, originalProject: activeModel.originalProject, originalCRC: activeModel.originalCRC }; return rc; }; this.onProjectLoadedEvents = async (ev) => { if (ev.level !== this._level) return; try { const projectLoadedInfo = JSON.parse(ev.desc); await this.readAllProjectTypescriptAndCompile(projectLoadedInfo.project, '', projectLoadedInfo.needCompile); } catch (e) { console.error('Error on serviceSource_onProjectLoadedEvents: ', e); } }; this.onMLSEvents = async (ev) => { if (ev.level !== this._level || (ev.type !== 'FileAction')) return; const fileAction = JSON.parse(ev.desc); if (fileAction.position !== this._positionToolbar) return; let keyFiles; let keyFilesHTML; const getStorFile = () => { keyFiles = mls.stor.getKeyToFiles(fileAction.project, fileAction.level, fileAction.shortName, fileAction.folder, fileAction.extension); const storFile = mls.stor.files[keyFiles]; if (!storFile) throw new Error('Error on open, mls.stor.files dont exists, key:' + keyFiles); return storFile; }; const getStorFileHTML = () => { keyFilesHTML = mls.stor.getKeyToFiles(fileAction.project, fileAction.level, fileAction.shortName, fileAction.folder, '.html'); return mls.stor.files[keyFilesHTML]; }; const onNew = async () => { this.activeThisService(); const newTSSource = fileAction.newTSSource || `/// <mls shortName="${fileAction.newshortName}" project="${fileAction.newProject}" enhancement="${fileAction.newEnhancement}" /> \n// typescript new file\n`; await this.createModelTS1(fileAction.newshortName, fileAction.newProject, newTSSource, true); this.showActiveModel(); }; const onOpen = async () => { await this.createModelTS_loading(); this.activeThisService(); const storFile = getStorFile(); const fileModel = mls.l2.editor.get(storFile); if (!fileModel) { await this.readAllProjectTypescriptAndCompile(storFile.project, storFile.shortName); await this.createModelTS2(storFile, true, true); } else { mls.l2.editor.editors[this.confE] = fileModel; mls.l2.editor.forceModelUpdate(fileModel.model); } await this.createOrShowModelHTML(false); this.showActiveModel(); }; const onDelete = async () => { const storFile = getStorFile(); const storFileHTML = getStorFileHTML(); if (storFile.status === 'new') { this.deleteFile(storFile); } else storFile.status = 'deleted'; if (storFileHTML) { if (storFileHTML.status === 'new') { this.deleteFile(storFileHTML); } else storFileHTML.status = 'deleted'; } mls.events.fireFileAction('statusOrErrorChanged', storFile, this._positionToolbar); }; const onUndo = async () => { const storFile = getStorFile(); const storFileHTML = getStorFileHTML(); if (storFile.status === 'deleted') { storFile.status = 'changed'; if (storFileHTML) storFileHTML.status = 'changed'; mls.events.fireFileAction('statusOrErrorChanged', storFile, this._positionToolbar); return; } if (storFile.status === 'renamed') { throw new Error('not implemented'); } const imFile = mls.l2.editor.editors[this.confE]; if (imFile.project === storFile.project && imFile.shortName === storFile.shortName) await this.createModelTS_testFile(); mls.l2.editor.remove(storFile); this.removeEventsModelTS(storFile); await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); if (storFile.status === 'new') { delete mls.stor.files[keyFiles]; mls.events.fireFileAction('statusOrErrorChanged', storFile, this._positionToolbar); return; } if (storFile.status === 'changed') { storFile.status = 'nochange'; if (storFile.isLocalVersionOutdated && storFile.newVersionRefIfOutdated) { storFile.versionRef = storFile.newVersionRefIfOutdated; storFile.isLocalVersionOutdated = false; storFile.newVersionRefIfOutdated = undefined; } } else { storFile.status = 'changed'; } await this.createModelTS2(storFile, false, true); await this.undoHTMLFile(storFileHTML, keyFilesHTML); mls.events.fireFileAction('statusOrErrorChanged', storFile, this._positionToolbar); }; const onRename = async () => { const storFile = getStorFile(); const storFileHTML = getStorFileHTML(); await this.createModelTS_loading(); this.activeThisService(); let model1 = mls.l2.editor.get(storFile); if (!model1) model1 = await this.createModelTS2(storFile, false, true); this.renameTSFile(model1, storFile, fileAction.newProject, fileAction.newshortName); mls.l2.editor.editors[this.confE] = model1; this.renameHTMLFile(storFileHTML, fileAction.newProject, fileAction.newshortName); this.showActiveModel(); mls.events.fireFileAction('statusOrErrorChanged', storFile, this._positionToolbar); }; const onClone = async () => { const storFile = getStorFile(); await this.createModelTS_loading(); this.activeThisService(); await this.createModelTS_clone(storFile, fileAction.newProject, fileAction.newshortName); this.showActiveModel(); }; if (mls.istrace) console.time('onAction_' + fileAction.action + '_' + fileAction.position); await this.initMonaco(); switch (fileAction.action) { case 'new': await onNew(); break; case 'open': await onOpen(); break; case 'delete': await onDelete(); break; case 'undo': await onUndo(); break; case 'rename': await onRename(); break; case 'clone': await onClone(); break; default: { } } if (mls.istrace) console.timeEnd('onAction_' + fileAction.action + '_' + fileAction.position); }; this.monacoGlobalInitialized = false; this.onFirtModel = true; this.timeout_compileConfEditor = 0; this._onChangedContentHTML = undefined; this.onModelHTMLChange = (e, storFileHTML, model) => { clearTimeout(this._onChangedContentHTML); this._onChangedContentHTML = window.setTimeout(async () => { const sameContent = storFileHTML['originalCRC'] === mls.common.crc.crc32(model.getValue()).toString(16); if (sameContent) { if (storFileHTML.status !== 'new' && storFileHTML.status !== 'renamed') storFileHTML.status = 'nochange'; if (storFileHTML.status !== 'renamed') await mls.stor.localStor.setContent(storFileHTML, { content: null }); } else { if (storFileHTML.status !== 'renamed' && (storFileHTML.status !== 'new')) storFileHTML.status = 'changed'; await mls.stor.localStor.setContent(storFileHTML, { contentType: 'string', content: model.getValue() }); } mls.events.fireFileAction('statusOrErrorChanged', storFileHTML, model['position']); }, 400); }; this.getValueInfoHTML = async (activeModel, originalShortName, originalProject, originalCRC) => { const rc = { content: activeModel.getValue(), contentType: 'string', originalShortName, originalProject, originalCRC }; return rc; }; if (!el) return; this._div1 = el; this._level = level || 0; this._positionToolbar = positionToolbar || 'left'; if (el) el['mlsWidget'] = this; mls.events.addListener(2, 'FileAction', this.onMLSEvents.bind(this)); mls.events.addListener(2, 'MonacoAction', (ev) => this.onMonacoEvents(ev)); mls.events.addListener(2, 'ProjectLoaded', (ev) => this.onProjectLoadedEvents(ev)); this.initMonaco_GlobalEditor(); this.initMonaco(); } async onServiceClick(ev) { this.menu.setIconActive('icTs'); } onReenter() { return false; } onSourceChange(level) { this._div1.innerHTML = ''; } onSelectedChange() { } onVariationChange(newV, actualV) { } get confE() { return `l${this._level}_${this._positionToolbar}`; } confE2(positionToolbar) { return `l${this._level}_${positionToolbar}`; } get confETS() { return this.confE + '_TS'; } get confEJS() { return this.confE + '_JS'; } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } showAbout() { const div1 = document.createElement('mls-history-list-100554'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_Source</h2>' + '<hr>' + '<p>Widget Source: https://multilevelstudio.com/#/l2/_100529_service_Source</p>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showHistory() { this.showHistorie2(); return true; } async showHistorie2() { const { shortName, project } = mls.l2.editor.editors[this.confE]; const div = document.createElement('div'); const scr = document.createElement('script'); const i2 = `/_${'100554'}_${'mlsHistoryList'}`; scr.type = 'module'; scr.id = i2.replace('/', ''); scr.src = i2; div.appendChild(scr); const ds = mls.l3.getDSInstance(100554, 0); if (ds) { await ds.init(); ds.components.getCSS('_100554_mlsHistoryList').then((css) => { const style = document.createElement('style'); style.textContent = css; div.appendChild(style); }); } const wc = document.createElement('mls-history-list-100554'); wc.setAttribute('project', project.toString()); wc.setAttribute('shortName', shortName); wc.setAttribute('level', '2'); wc.setAttribute('extension', '.ts'); wc.setAttribute('position', this._positionToolbar); div.appendChild(wc); if (this.menu.setMode) this.menu.setMode('page', div); } showPageTheme() { if (this.menu.setMode) this.menu.setMode('page', this.getGlobalPageSetTHeme()); return true; } showMonacoReset() { mls.editor.conf[this.confE] = undefined; this.loadMonacoConfigurations(); if (this.menu.setMode) this.menu.setMode('initial'); this.updateMonacoConfigutarions(); this.saveConfEditorToLocalStorage(); return true; } showConfEditor() { if (this.menu.setMode) this.menu.setMode('editor'); this.setModelConfEditor(); return true; } async readAllProjectTypescriptAndCompile(project, shortName, needCompile = true) { if (_100529_service_Source.projectsLoaded.includes(project)) return; if (mls.istrace) console.log('loading files from project ' + project); _100529_service_Source.projectsLoaded.push(project); const promises = []; const keys = Object.keys(mls.stor.files); for (const key of keys) { const storFile = mls.stor.files[key]; if (storFile.project === project && storFile.level === 2 && storFile.extension === '.ts' && storFile.shortName !== shortName) { promises.push(this.createModelTS2(storFile, false, false)); } } await Promise.all(promises); if (needCompile) await mls.l2.editor.compileAllProjectIfNeed(project, true); } async deleteFile(storFile) { await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); const activeModel = mls.l2.editor.editors[this.confE]; if (activeModel.project === storFile.project && activeModel.shortName === storFile.shortName) await this.createModelTS_testFile(); mls.l2.editor.remove(storFile); this.removeEventsModelTS(storFile); const keyFiles = mls.stor.getKeyToFiles(storFile.project, storFile.level, storFile.shortName, storFile.folder, storFile.extension); delete mls.stor.files[keyFiles]; } async afterUpdate(storFile) { const mmodel = mls.l2.editor.get(storFile); if (!mmodel) return; if (storFile.status === 'deleted') { this.deleteFile(storFile); return; } if (storFile.status === 'renamed') { mmodel.originalProject = undefined; mmodel.originalShortName = undefined; mmodel.originalCRC = mls.common.crc.crc32(mmodel.model.getValue()).toString(16); } await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); storFile.status = 'nochange'; } addEventsModelTS(storFile, model1) { storFile.onAction = (action) => this.afterUpdate(storFile); storFile.getValueInfo = () => this.getValueInfo(model1); model1.model.onDidChangeContent((e) => this.onModelChange(e, model1, storFile)); } removeEventsModelTS(storFile) { storFile.onAction = undefined; storFile.getValueInfo = undefined; } onMonacoEvents(ev) { const args = JSON.parse(ev.desc); if (!args) return; const { action, filePosition, position, project, shortName } = args; if (position !== this._positionToolbar) return; if (action === 'gotoPosition') { this.goToPosition(filePosition, position); } if (mls.istrace) console.info('received monaco actions', args); } goToPosition(position, editorPosition) { const confInvert = `l${this._level}_${editorPosition === 'left' ? 'right' : 'left'}`; const offset = position - 1; const { lineNumber, column } = mls.l2.editor.editors[confInvert].model.getPositionAt(offset); this._ed1.revealPositionInCenter({ lineNumber, column }, monaco.editor.ScrollType.Immediate); const lineLength = mls.l2.editor.editors[confInvert].model.getLineContent(lineNumber).length + 1; const range = new monaco.Range(lineNumber, column, lineNumber, lineLength); this._ed1.setSelection(new monaco.Selection(range.startLineNumber, 0, range.startLineNumber, lineLength)); } activeThisService() { const itemSource = this.getMyToolbarItem(); if (!itemSource) return; itemSource.setAttribute('mode', 'A'); itemSource.click(); mls.editor.setActiveInstance(this._level, this._positionToolbar); } async updateModelStatus(model1, changed) { var _a; if (model1.project === 0) changed = true; model1.changed = changed; const cr = await mls.l2.editor.getCompilerResultTS({ project: model1.project, shortName: model1.shortName }, true); let hasError = cr.errors.length > 0; model1.error = hasError; const key = mls.stor.getKeyToFiles(model1.project, this._level, model1.shortName, '', model1.extension); const storFile = mls.stor.files[key]; const d = { project: model1.project, shortName: model1.shortName, level: this._level, position: this._positionToolbar }; if (!hasError) { const enhancementInstance = await mls.l2.enhancement.getEnhancementInstance(model1).catch((e) => undefined); if (enhancementInstance) await enhancementInstance.onAfterChange(model1); hasError = storFile.hasError; } await this.changeStatusFile(model1, storFile, (_a = cr.tripleSlashMLS) === null || _a === void 0 ? void 0 : _a.variables, hasError); } async changeStatusFile(model1, storFile, variables, hasError) { if (!storFile) return; const oldStatus = storFile.status; storFile.hasError = hasError; const sameContent = model1.originalCRC === mls.common.crc.crc32(model1.model.getValue()).toString(16); if (sameContent) { if (storFile.status !== 'new') storFile.status = 'nochange'; await mls.stor.localStor.setContent(storFile, { content: null }); } else { if (storFile.status !== 'renamed' && (storFile.status !== 'new')) storFile.status = 'changed'; await mls.stor.localStor.setContent(storFile, await this.getValueInfo(model1)); } if (oldStatus !== storFile.status) { mls.events.fireFileAction('statusOrErrorChanged', storFile, this._positionToolbar); } } renameTSFile(model1, storFile, newProject, newShortName) { if (storFile.hasError) throw new Error('Error on rename, clear errors before rename'); if (!this.isNewNameValid(newShortName)) throw new Error('Error on rename, new shortName is a invalid name'); const newSts = { shortName: newShortName, project: newProject }; if (!mls.l2.editor.rename(model1, newSts)) throw new Error('Error on rename mls.l2.editor.mfiles'); if (!mls.stor.renameFile(storFile, newSts)) throw new Error('Error on rename mls.stor.files'); mls.common.tripleslash.changeVariable(model1, 'shortName', newShortName); mls.common.tripleslash.changeVariable(model1, 'project', newProject.toString()); if (storFile.status === 'new') return; storFile.status = 'renamed'; } isNewNameValid(newShortName) { if (newShortName.length === 0 || newShortName.length > 255) return false; const invalidCharacters = /[_\/{}\t\[\]\*$@#=\-+!|?,<>=.;^~��""''``�������������������������������]/; return (!invalidCharacters.test(newShortName)); } showActiveModel() { const activeModel = mls.l2.editor.editors[this.confE]; if (!this._ed1 || !activeModel || !this.menu.getLastMode) return false; const changedFile = this.menu.title !== activeModel.shortName; this.menu.title = activeModel.shortName; const lastMode = this.menu.getLastMode(); if (changedFile && lastMode !== 'initial') { this._ed1.setModel(activeModel.model); this.menu.setMode('initial'); } else if (lastMode === 'initial') { this._ed1.setModel(activeModel.model); this.menu.updateTitle(); } else if (lastMode === 'editor') { } else if (lastMode === 'page') { this._ed1.setModel(activeModel.model); } return true; } async initMonaco() { if (this._div1.children.length < 1 || !this._ed1) { this.initMonaco_ToolBarService(); await this.initMonaco_Editor(); if (typeof this._div1['layout'] === 'function') this._div1['layout'](); } } initMonaco_ToolBarService() { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this._div1.appendChild(this.c1); } async initMonaco_GlobalEditor() { this.loadMonacoConfigurations(); if (this.monacoGlobalInitialized) return; this.monacoGlobalInitialized = true; this.loadMonacoThemeFromLocalStorage(); this.updateMonacoGlobalTheme(); mls.editor.InitMonaco(); } async initMonaco_Editor() { const addEventsEditor = () => { this._ed1.onDidFocusEditorWidget(() => { if (this.menu.lastIcon === 'icHTML') return; mls.editor.setActiveInstance(this._level, this._positionToolbar); }); }; this.c2 = document.createElement('mls-editor-100529'); this._ed1 = monaco.editor.create(this.c2, mls.editor.conf[this.confE]); this.c2['mlsEditor'] = this._ed1; mls.editor.instances[this.confE] = this._ed1; this._div1.appendChild(this.c2); mls.editor.InitEditor(this._ed1); addEventsEditor(); this.createModelTS_loading(); this.createModelConf('// loading ...'); await this.createModelTS_testFile(); } loadMonacoConfigurations() { if (!mls.editor.conf || Object.keys(mls.editor.conf).length === 0) { this.loadConfEditorFromLocalStorage(); } if (mls.editor.conf[this.confE]) return; mls.editor.conf[this.confE] = { contextmenu: true, autoIndent: 'full', wordWrap: 'on', wrappingIndent: 'indent', tabCompletion: 'on', renderControlCharacters: false, showUnused: true, glyphMargin: true, minimap: { enabled: false }, useTabStops: true, scrollBeyondLastColumn: 2, scrollBeyondLastLine: false, formatOnType: true, fixedOverflowWidgets: true, codeLens: true, showFoldingControls: 'mouseover', suggestSelection: 'first', stickyScroll: { enabled: false, maxLineCount: 3 }, stickyTabStops: true, fontSize: 20, automaticLayout: true, }; } getUri(shortFN, ftype) { return monaco.Uri.parse(`file://server/${shortFN}${ftype}`); } async createModelTS_testFile() { const shortName = 'testFile'; const project = 0; const defaultTS = `/// <mls shortName="${shortName}" project="${project}" enhancement="config_ts_web-component" />\n// typescript example`; await this.createModelTS1(shortName, project, defaultTS, true); } async createModelTS_loading() { const shortName = 'loading...'; const project = 0; const defaultTS = 'wait...'; const mfile = await this.createModelTS1(shortName, project, defaultTS, true); if (this.onFirtModel) { this.onFirtModel = false; this._ed1.setModel(mfile.model); } } async createModelTS_clone(storFile, newProject, newShortName) { let model1 = mls.l2.editor.get(storFile); if (!model1) model1 = await this.createModelTS2(storFile, false, true); const defaultTS = model1.model.getValue(); model1 = await this.createModelTS1(newShortName, newProject, defaultTS, true); mls.common.tripleslash.changeVariable(model1, 'shortName', newShortName); mls.common.tripleslash.changeVariable(model1, 'project', newProject.toString()); } async createModelTS1(shortName, project, defaultTS, activateModel) { const level = 2; const extension = '.ts'; if (project > 1) await mls.stor.server.loadProjectInfoIfNeeded(project); const key = mls.stor.getKeyToFiles(project, level, shortName, '', extension); let storFile = mls.stor.files[key]; if (storFile && project !== 0) throw new Error('Error on createModelTS1, model already exists: ' + key); if (!storFile) { storFile = await mls.stor.addOrUpdateFile({ project, level, shortName, extension, versionRef: new Date().toISOString(), folder: '' }); storFile.status = 'new'; } let model1 = mls.l2.editor.get({ project, shortName }); if (!model1) { const src = storFile ? (await storFile.getContent(defaultTS)) || defaultTS : defaultTS; const ftype = src.split("\n")[0].indexOf(' type="definition"') > 0 ? ".d.ts" : ".ts"; const uri = this.getUri(`_${project}_${shortName}`, ftype); model1 = mls.l2.editor.get({ project, shortName }); if (model1) return model1; const model = monaco.editor.createModel(src, 'typescript', uri); model1 = { changed: true, error: false, project, shortName, extension, model, storFile, codeLens: [], }; mls.l2.editor.add(model1); this.addEventsModelTS(storFile, model1); } await this.updateModelStatus(model1, false); if (activateModel) mls.l2.editor.editors[this.confE] = model1; return model1; } async createModelTS2(storFile, activedModel, compile) { const { project, shortName, extension } = storFile; let model1 = mls.l2.editor.get({ project, shortName }); if (model1) return model1; const info = storFile.getValueInfo ? await storFile.getValueInfo() : null; const haveInfo = info && !!info.content; const src = haveInfo ? info.content : await storFile.getContent(); if (src instanceof Blob) throw new Error('ts file must be string'); const originalCRC = haveInfo ? info.originalCRC : mls.common.crc.crc32(src).toString(16); const originalProject = haveInfo ? info.originalProject : undefined; const originalShortName = haveInfo ? info.originalShortName : undefined; const ftype = src.split("\n")[0].indexOf(' type="definition"') > 0 ? ".d.ts" : ".ts"; const uri = this.getUri(`_${project}_${shortName}`, ftype); const model = monaco.editor.createModel(src, 'typescript', uri); model1 = { changed: false, error: false, project, shortName, extension, model, storFile, originalCRC, originalProject, originalShortName, codeLens: [], }; mls.l2.editor.add(model1); this.addEventsModelTS(storFile, model1); if (compile) { await this.updateModelStatus(model1, false); } if (activedModel) { mls.l2.editor.editors[this.confE] = model1; } return model1; } setModelConfEditor() { const src = this.getConfEditorToTypescript(); this.mConfEditor['mlsConf'] = 'confEditor'; this.mConfEditor.setValue(src); this._ed1.setModel(this.mConfEditor); } async createModelConf(src) { if (mls.istrace) console.log(`ServiceSource, createModelConf_${this._positionToolbar}, ${!!this.mConfEditor}`); if (this.mConfEditor) return; const shortName = this.confE + '_service_source.confEditor'; const level = 2; const project = 0; const extension = '.ts'; const storFile = await mls.stor.addOrUpdateFile({ project, level, shortName, extension, versionRef: new Date().toISOString(), folder: '' }); const uri = this.getUri(shortName, extension); this.mConfEditor = monaco.editor.createModel(src, 'typescript', uri); mls.l2.editor.add({ changed: false, error: false, model: this.mConfEditor, storFile, project: 0, shortName, extension, codeLens: [], }); this.mConfEditor.onDidChangeContent((e) => { const mode = this.mConfEditor['mlsConf']; if (!mode) return; src = this.mConfEditor.getValue(); this.compileSrcEditor(mode, src); }); } compileSrcEditor(mode, src) { clearTimeout(this.timeout_compileConfEditor); this.timeout_compileConfEditor = window.setTimeout(async () => { const mmodel = mls.l2.editor.find(this.mConfEditor.id); if (!mmodel) return; const rcc = await mls.l2.editor.getCompilerResultTS(mmodel, true); if (rcc.errors.length !== 0 || !rcc.prodJS) return; if (mode === 'confEditor') this.setConfEditorFromJavascript(rcc.prodJS, src); }, 500); } loadConfEditorFromLocalStorage() { const json = localStorage.getItem('mlsConfEditor'); if (json) { mls.editor.loadConfFromJSON(json); } } saveConfEditorToLocalStorage() { localStorage.setItem('mlsConfEditor', JSON.stringify(mls.editor.conf)); } loadMonacoThemeFromLocalStorage() { if (!mls.editor.themeName) mls.editor.setThemeName(localStorage.getItem('mlsConfTheme')); } saveMonacoGlobalThemeToLS() { localStorage.setItem('mlsConfTheme', mls.editor.themeName); } getConfEditorToTypescript() { return `/// <mls shortName="config_monaco_editor" project="0" enhancement="config_config" /> mls.editor.conf['${this.confE}'] = ` + JSON.stringify(mls.editor.conf[this.confE], null, 2) + ';\n'; } setConfEditorFromJavascript(javastr, src) { if (this._level < 1) return; const that = this; (function scope() { eval(javastr); if (mls.editor.conf[that.confE] && typeof mls.editor.conf[that.confE] === 'object') { that.updateMonacoConfigutarions(); that.saveConfEditorToLocalStorage(); } }).call(this); } async updateMonacoConfigutarions() { this._ed1.updateOptions(mls.editor.conf[this.confE]); } updateMonacoGlobalTheme() { let rc = true; if (mls.istrace) console.log(`service source, updating monaco theme: ${this._positionToolbar}`); const internalThemes = ['VS', 'VS Dark', 'High Contrast (Dark)']; const internalThemes2 = ['vs', 'vs-dark', 'hc-black', 'hc-light']; let name2; try { const internalIndex = internalThemes.indexOf(mls.editor.themeName); if (internalIndex < 0) { name2 = 'mytheme'; const path = mls['baseMonaco'] + '../themes/' + mls.editor.themeName + '.json'; mls.api.get(path, {}, (data) => { const json = JSON.parse(data); monaco.editor.defineTheme(name2, json); monaco.editor.setTheme(name2); }); } else { name2 = internalThemes2[internalIndex]; monaco.editor.setTheme(name2); } } catch (ex) { console.error('error on set theme ' + name2, ex); rc = false; } return rc; } getGlobalPageSetTHeme() { const div1 = document.createElement('div'); div1.innerHTML = `<div>` + `<p id='theme-actual'>Theme actual: ${mls.editor.themeName} </p><br>` + `<p>Set Theme (only 1 theme in all editors)</p>` + `<select class="hidden" id="theme-select" style="display: initial;"><option>select ...</option><option value="vs">VS</option><option value="vs-dark">VS Dark</option><option value="hc-black">High Contrast (Dark)</option><option value="active4d">Active4D</option><option value="all-hallows-eve">All Hallows Eve</option><option value="amy">Amy</option><option value="birds-of-paradise">Birds of Paradise</option><option value="blackboard">Blackboard</option><option value="brilliance-black">Brilliance Black</option><option value="brilliance-dull">Brilliance Dull</option><option value="chrome-devtools">Chrome DevTools</option><option value="clouds-midnight">Clouds Midnight</option><option value="clouds">Clouds</option><option value="cobalt">Cobalt</option><option value="cobalt2">Cobalt2</option><option value="dawn">Dawn</option><option value="dracula">Dracula</option><option value="dreamweaver">Dreamweaver</option><option value="eiffel">Eiffel</option><option value="espresso-libre">Espresso Libre</option><option value="github">GitHub</option><option value="idle">IDLE</option><option value="katzenmilch">Katzenmilch</option><option value="kuroir-theme">Kuroir Theme</option><option value="lazy">LAZY</option><option value="magicwb--amiga-">MagicWB (Amiga)</option><option value="merbivore-soft">Merbivore Soft</option><option value="merbivore">Merbivore</option><option value="monokai-bright">Monokai Bright</option><option value="monokai">Monokai</option><option value="night-owl">Night Owl</option><option value="oceanic-next">Oceanic Next</option><option value="pastels-on-dark">Pastels on Dark</option><option value="slush-and-poppies">Slush and Poppies</option><option value="solarized-dark">Solarized-dark</option><option value="solarized-light">Solarized-light</option><option value="spacecadet">SpaceCadet</option><option value="sunburst">Sunburst</option><option value="textmate--mac-classic-">Textmate (Mac Classic)</option><option value="tomorrow-night-blue">Tomorrow-Night-Blue</option><option value="tomorrow-night-bright">Tomorrow-Night-Bright</option><option value="tomorrow-night-eighties">Tomorrow-Night-Eighties</option><option value="tomorrow-night">Tomorrow-Night</option><option value="tomorrow">Tomorrow</option><option value="twilight">Twilight</option><option value="upstream-sunburst">Upstream Sunburst</option><option value="vibrant-ink">Vibrant Ink</option><option value="xcode-default">Xcode_default</option><option value="zenburnesque">Zenburnesque</option><option value="iplastic">iPlastic</option><option value="idlefingers">idleFingers</option><option value="krtheme">krTheme</option><option value="monoindustrial">monoindustrial</option></select>`; const sel = div1.querySelector('#theme-select'); if (!sel) return div1; sel.oninput = (ev) => { var _a, _b; if (((_a = ev === null || ev === void 0 ? void 0 : ev.srcElement) === null || _a === void 0 ? void 0 : _a.localName) === 'select') { const el = ev.srcElement; const actual = div1.querySelector('#theme-actual'); if (el.selectedIndex < 1) return; mls.editor.setThemeName(((_b = el.options) === null || _b === void 0 ? void 0 : _b[el.selectedIndex].text) || 'default'); this.saveMonacoGlobalThemeToLS(); this.updateMonacoGlobalTheme(); if (actual) actual.innerHTML = `Theme changed to: ${mls.editor.themeName}`; } }; return div1; } async createOrShowModelHTML(open, fileInfo) { const { shortName, project } = mls.l2.editor.editors[this.confE]; const uri = this.getUri(`_${project}_${shortName}`, '.html'); let model = monaco.editor.getModel(uri); const key = mls.stor.getKeyToFiles(project, this._level, shortName, '', '.html'); let storFileHTML = mls.stor.files[key]; if (!storFileHTML) { await this.createHTMLFile(project, shortName, `<h1>_${project}_${shortName}</h1>`); storFileHTML = mls.stor.files[key]; } if (!model) model = await this.getOrCreateModelHTML(shortName, project, storFileHTML, fileInfo); let src; const info = storFileHTML.getValueInfo ? await storFileHTML.getValueInfo() : null; const haveInfo = info && !!info.content; src = haveInfo ? info.content : await storFileHTML.getContent(); const originalCRC = haveInfo ? info.originalCRC : mls.common.crc.crc32(src).toString(16); model['originalCRC'] = originalCRC; if (src instanceof Blob) throw new Error('html file must be string'); if (src) model.setValue(src); if (open) this._ed1.setModel(model); return storFileHTML; } async createHTMLFile(project, shortName, content) { const params = { project, level: 2, shortName, extension: '.html', versionRef: '0', folder: '' }; const file = await mls.stor.addOrUpdateFile(params); file.status = 'new'; const fileInfo = { content, contentType: 'string', }; await mls.stor.localStor.setContent(file, fileInfo); } async getOrCreateModelHTML(shortName, project, storFileHTML, fileInfo) { const uri = this.getUri(`_${project}_${shortName}`, '.html'); let model = monaco.editor.getModel(uri); if (model) return model; const content = fileInfo ? fileInfo.content : await storFileHTML.getContent(); model = monaco.editor.createModel(content, 'html', uri); model['position'] = this._positionToolbar; storFileHTML['originalCRC'] = mls.common.crc.crc32(model.getValue()).toString(16); if (storFileHTML.status === 'renamed') { this.setEventsModelHTML(model, storFileHTML, fileInfo.originalShortName, fileInfo.originalProject); model.setValue(fileInfo.content); } else { this.setEventsModelHTML(model, storFileHTML, storFileHTML.shortName, storFileHTML.project); } return model; } setEventsModelHTML(model, storFileHTML, shortName, project) { storFileHTML.onAction = (action) => this.afterUpdateHTML(storFileHTML, model); storFileHTML.getValueInfo = () => this.getValueInfoHTML(model, shortName, project, storFileHTML['originalCRC']); if (model) model.onDidChangeContent((e) => this.onModelHTMLChange(e, storFileHTML, model)); } async renameHTMLFile(storFileHTML, newProject, newShortName) { if (!storFileHTML) return; const newSts = { shortName: newShortName, project: newProject }; await this.getOrCreateModelHTML(storFileHTML.shortName, storFileHTML.project, storFileHTML); const valueInfo = await storFileHTML.getValueInfo(); const { status } = storFileHTML; if (!mls.stor.renameFile(storFileHTML, newSts)) throw new Error('Error on rename mls.stor.files'); const key = mls.stor.getKeyToFiles(newProject, this._level, newShortName, '', '.html'); const newStorFileHTML = mls.stor.files[key]; newStorFileHTML.status = 'renamed'; await mls.stor.localStor.setContent(newStorFileHTML, valueInfo); setTimeout(async () => { const file = await this.createOrShowModelHTML(false, valueInfo); if (status === 'new') file.status = status; }, 500); } async undoHTMLFile(storFileHTML, keyFiles) { await mls.stor.localStor.setContent(storFileHTML, { contentType: 'string', content: null }); const uri = this.getUri(`_${storFileHTML.project}_${storFileHTML.shortName}`, '.html'); const model = monaco.editor.getModel(uri); if (model) model.dispose(); if (storFileHTML.status === 'new') { delete mls.stor.files[keyFiles]; return; } if (storFileHTML.status === 'changed') { storFileHTML.status = 'nochange'; if (storFileHTML.isLocalVersionOutdated && storFileHTML.newVersionRefIfOutdated) { storFileHTML.versionRef = storFileHTML.newVersionRefIfOutdated; storFileHTML.isLocalVersionOutdated = false; storFileHTML.newVersionRefIfOutdated = undefined; } } else { storFileHTML.status = 'changed'; } } async afterUpdateHTML(storFile, model) { if (storFile.status === 'deleted') { await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); const keyFiles = mls.stor.getKeyToFiles(storFile.project, storFile.level, storFile.shortName, storFile.folder, storFile.extension); delete mls.stor.files[keyFiles]; return; } if (storFile.status === 'renamed') { storFile['originalCRC'] = mls.common.crc.crc32(model.getValue()).toString(16); } await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); storFile.status = 'nochange'; } } _100529_service_Source.details = [ , , , , { name: '&#xf121; Source', ref: 'service_Source' }, ]; _100529_service_Source.projectsLoaded = []; l2_html._100529_service_Source = _100529_service_Source; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_assets extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = async (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opAssets') return this.showHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Assets', actions: { opAbout: 'About', opAssets: 'Assets', }, actionDefault: 'opAssets', setMode: undefined, onClickLink: this.onClickLink, }; this.files = { onDeleteFile: undefined, onUploadFile: this.onUploadFile.bind(this), onChange: this.onFileChanged.bind(this), readonlyFiles: [], readonlyFolders: [], project: undefined, list: {} }; this.serviceByExtensions = { _100529_service_assets_image: ['.png', '.jpg', '.jpeg', '.webp', '.jfif'], _100529_service_assets_video: ['.mp4', '.webm'], _100529_service_assets_icon: ['.svg', '.ico'], _100529_service_assets_editor: ['.json', '.ts', '.js', '.css', '.txt', '.css', '.scss', '.less', '.xml', '.html'], }; this._div1 = el; this.level = +level; if (el) el['mlsWidget'] = this; mls.events.addEventListener([3], ['DSAssetsChanged'], (ev) => { const params = JSON.parse(ev.desc); if (params.emitter === 'right') { if (this.files.onDeleteFile) this.files.onDeleteFile(params.deletedFile); } }); return this; } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onServiceClosed() { this.reset(); } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); } async initDsInstance() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; this.dsInstance = mls.l3.getDSInstance(project, mode); await this.dsInstance.init(); } async onFileChanged(e) { e.filesController.filesSelected2 = Array.from(e.filesController.filesSelected); const params = { emitter: 'left', helper: ['_100529_service_assets_overview'], value: e.filesController, readonlyFolders: this.files.readonlyFolders, readonlyFiles: this.files.readonlyFiles, }; if (e.filesController.filesSelected2.length === 1) { const [file] = e.filesController.filesSelected2; const extensiosServicesKey = Object.keys(this.serviceByExtensions); extensiosServicesKey.forEach((key) => { if (this.serviceByExtensions[key].includes(file.extension)) params.helper.push(key); }); } mls.events.fire([3], ['DSAssetsChanged'], JSON.stringify(params), 0); } async onUploadFile() { await this.prepareFiles(); } showAbout() { if (!this.aboutDiv) { this.aboutDiv = document.createElement('mls-load-page-l4-100529'); this.aboutDiv.setAttribute('path', '_100529_service_assets_about'); } if (this.menu.setMode) this.menu.setMode('page', this.aboutDiv); return true; } async showHelper() { this.menu.title = 'Assets'; await this.prepareFiles(); this.c2.setAttribute('path', '_100529_service_assets'); return true; } async prepareFiles() { const { project } = mls.actual[5]; await this.initDsInstance(); await mls.stor.server.loadProjectInfoIfNeeded(project); const listDs = mls.l5.ds.list(project); const nameDs = listDs[this.dsInstance.dsindex].dsName; const rc = {}; const listFiles = mls.stor.files; const onlyProjects = Object.keys(listFiles).filter((file) => listFiles[file].project === project); onlyProjects.forEach((item) => { const { level, folder } = listFiles[item]; if (level === 3 && (folder.startsWith(`ds/${nameDs}/`) || folder === `ds/${nameDs}`)) rc[item] = listFiles[item]; }); this.files.list = rc; this.files.project = project; this.files.readonlyFiles = []; this.files.readonlyFolders = ['ds', `ds/${nameDs}`, `ds/${nameDs}/docs`, `ds/${nameDs}/css`, `ds/${nameDs}/css`, `ds/${nameDs}/components*`]; } async loadService() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; if (!this.c1 || !this.c2 || this.lastProject !== project || this.lastDsIndex !== mode) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } else { await this.prepareFiles(); } this.lastDsIndex = mode; this.lastProject = project; const params = { service: ['_100529_service_assets_overview'], }; mls.events.fire([this.level], ['DSAssetsSelected'], JSON.stringify(params), 100); } reset() { const params = { service: [], }; mls.events.fire([this.level], ['DSAssetsUnSelected'], JSON.stringify(params)); } } _100529_service_assets.details = [, , , , { name: '&#xf142; Assets', ref: '_100532_service_assets' }, ]; l2_html._100529_service_assets = _100529_service_assets; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_assets_editor extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opEditor') return this.showEditor(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Editor', actions: { opAbout: 'About', opEditor: 'Editor', }, actionDefault: 'opEditor', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; this.editorTypeByExtensions = { '.json': 'json', '.txt': 'plaintext', '.ts': 'typescript', '.js': 'javascript', '.css': 'css', '.less': 'less', '.html': 'html', '.java': 'java', '.scss': 'scss', '.xml': 'xml', }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSAssetsUnSelected'], (ev) => { this.onDsAssetsUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSAssetsChanged'], (ev) => { this.onDsAssetsChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDsAssetsUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; itemAssets.setAttribute('mode', 'H'); } onDsAssetsChanged(ev) { const rc = JSON.parse(ev.desc); const itemAssets = this.getMyToolbarItem(); if (rc.emitter === 'right') return; if (rc.helper.includes(this.constructor.name)) { this.info = rc.value; itemAssets.setAttribute('mode', 'A'); itemAssets.click(); } else itemAssets.setAttribute('mode', 'H'); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Editor</h1>'; this.menu.title = 'About'; this.menu.updateTitle(); if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showEditor() { this.menu.title = 'Editor'; this.menu.updateTitle(); this.showEditor2(); return true; } async showEditor2() { const obj = await this.getValue(); this.setInitialModels(obj.value, obj.mode); this._ed1.setModel(this.model); this._ed1.updateOptions({ readOnly: true }); return true; } createEditor() { this._ed1 = monaco.editor.create(this.c2, mls.editor.conf['l3_assets_visualization_editor']); } getUri(shortFN) { _100529_service_assets_editor.modelCount = _100529_service_assets_editor.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_assets_editor.modelCount}.ts`); } setInitialModels(src, mode) { const uri = this.getUri('l3_assets_visualization_editor'); this.model = monaco.editor.getModel(uri); let val = src; if (mode === 'json') val = JSON.stringify(JSON.parse(src), null, 2); if (this.model) this.model.setValue(src); else this.model = monaco.editor.createModel(val, mode, uri); } async getValue() { var _a; if (!this.info.filesSelected2) return undefined; const [fileSelected] = this.info.filesSelected2; if (!fileSelected) return undefined; const { folder, extension, level, project, shortName } = fileSelected; const keyFile = mls.stor.getKeyToFiles(project, level, shortName, folder, extension); const value = await ((_a = mls.stor.files[keyFile]) === null || _a === void 0 ? void 0 : _a.getContent()); const mode = this.editorTypeByExtensions[extension] ? this.editorTypeByExtensions[extension] : 'plaintext'; return new Promise((resolve, reject) => { if (typeof value === 'string') { resolve({ value, mode }); return; } const file = value; const reader = new FileReader(); reader.addEventListener('load', () => { resolve({ value: reader.result, mode }); }); reader.readAsBinaryString(file); }); } loadService() { if (!this._ed1) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this.createEditor(); this._ed1.setModel(this.model); this.c2['mlsEditor'] = this._ed1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } else { this.setInitialModels('Loading...', 'textplain'); this._ed1.setModel(this.model); this._ed1.updateOptions({ readOnly: true }); this.showEditor2(); } if (typeof this._div1['layout'] === 'function') this._div1['layout'](); } } _100529_service_assets_editor.details = [, , , , { name: '&#xf142; Editor', ref: '_100529_service_assets_editor' }, ]; l2_html._100529_service_assets_editor = _100529_service_assets_editor; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_assets_icon extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opIcon') return this.showIcon(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Overview', actions: { opAbout: 'About', opIcon: 'Overview', }, actionDefault: 'opIcon', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSAssetsSelected'], (ev) => { this.onDsAssetsSelected(ev); }); mls.events.addEventListener([this.level], ['DSAssetsUnSelected'], (ev) => { this.onDsAssetsUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSAssetsChanged'], (ev) => { this.onDsAssetsChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDsAssetsSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; if (params.service.length === 0 || !params.service.includes(this.constructor.name)) { itemAssets.setAttribute('mode', 'H'); return; } itemAssets.setAttribute('mode', 'A'); } onDsAssetsUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; itemAssets.setAttribute('mode', 'H'); } onDsAssetsChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.emitter === 'right') return; if (rc.helper === this.constructor.name) { const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; itemAssets.click(); this.info = rc.value; } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Icon</h1>'; this.menu.title = 'About'; this.menu.updateTitle(); if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showIcon() { this.menu.title = 'Icon'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_assets_icon'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('div'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_assets_icon.details = [, , , , { name: '&#xf142; Icon', ref: '_100529_service_assets_icon' }, ]; l2_html._100529_service_assets_icon = _100529_service_assets_icon; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_assets_image extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opImage') return this.showIcon(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Image', actions: { opAbout: 'About', opImage: 'Image', }, actionDefault: 'opImage', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSAssetsUnSelected'], (ev) => { this.onDsAssetsUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSAssetsChanged'], (ev) => { this.onDsAssetsChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDsAssetsUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; itemAssets.setAttribute('mode', 'H'); } onDsAssetsChanged(ev) { const rc = JSON.parse(ev.desc); const itemAssets = this.getMyToolbarItem(); if (rc.emitter === 'right') return; if (rc.helper.includes(this.constructor.name)) { this.info = rc.value; this._div1['fileSelected'] = this.info.filesSelected2; itemAssets.setAttribute('mode', 'A'); itemAssets.click(); } else itemAssets.setAttribute('mode', 'H'); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Image</h1>'; this.menu.title = 'About'; this.menu.updateTitle(); if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showIcon() { this.menu.title = 'Image'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_assets_image'); return true; } loadService() { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this._div1.style.height = '100%'; } } _100529_service_assets_image.details = [, , , , { name: '&#xf142; Image', ref: '_100529_service_assets_image' }, ]; l2_html._100529_service_assets_image = _100529_service_assets_image; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_assets_overview extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opOverview') return this.showOverview(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Overview', actions: { opAbout: 'About', opOverview: 'Overview', }, actionDefault: 'opOverview', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSAssetsSelected'], (ev) => { this.onDsAssetsSelected(ev); }); mls.events.addEventListener([this.level], ['DSAssetsUnSelected'], (ev) => { this.onDsAssetsUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSAssetsChanged'], (ev) => { this.onDsAssetsChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDsAssetsSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; if (params.service.length === 0 || !params.service.includes(this.constructor.name)) { itemAssets.setAttribute('mode', 'H'); return; } itemAssets.setAttribute('mode', 'A'); itemAssets.click(); } onDsAssetsUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; itemAssets.setAttribute('mode', 'H'); } onDsAssetsChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.emitter === 'right') return; this.info = rc.value; if (rc.helper && rc.helper[rc.helper.length - 1] === this.constructor.name) { const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; itemAssets.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Overview</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } createOverviewDetails() { this.c2.innerHTML = ''; this.c2.style.padding = '1rem'; const title = document.createElement('h3'); let titleValue; if (!this.info || this.info.totalFilesSelected === 0) titleValue = 'No file selected'; else if (this.info.totalFilesSelected === 1) titleValue = this.info.filesSelected2[0].shortName; else titleValue = `${this.info.totalFilesSelected} files selected.`; title.innerHTML = titleValue; this.c2.appendChild(title); } showOverview() { this.menu.title = 'Overview'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_assets_overview'); return true; } loadService() { if (!this.c1 || !this.c2) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } else { } } } _100529_service_assets_overview.details = [, , , , { name: '&#xf142; Overview', ref: '_100529_mls_l3_assets_overview' }, ]; l2_html._100529_service_assets_overview = _100529_service_assets_overview; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_assets_video extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opVideo') return this.showVideo(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Video', actions: { opAbout: 'About', opVideo: 'Video', }, actionDefault: 'opVideo', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSAssetsUnSelected'], (ev) => { this.onDsAssetsUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSAssetsChanged'], (ev) => { this.onDsAssetsChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDsAssetsUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemAssets = this.getMyToolbarItem(); if (!itemAssets) return; itemAssets.setAttribute('mode', 'H'); } onDsAssetsChanged(ev) { const rc = JSON.parse(ev.desc); const itemAssets = this.getMyToolbarItem(); if (rc.emitter === 'right') return; if (rc.helper.includes(this.constructor.name)) { this.info = rc.value; this.info = rc.value; this._div1['fileSelected'] = this.info.filesSelected2; itemAssets.setAttribute('mode', 'A'); itemAssets.click(); } else itemAssets.setAttribute('mode', 'H'); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Video</h1>'; this.menu.title = 'About'; this.menu.updateTitle(); if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showVideo() { this.menu.title = 'Video'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_assets_video'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_assets_video.details = [, , , , { name: '&#xf142; Video', ref: '_100529_service_assets_video' }, ]; l2_html._100529_service_assets_video = _100529_service_assets_video; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_attr_json_helper extends l2_html.BaseService { constructor(el, level, positionToolbar) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opJsonEditor') return this.showEditor(); if (op === 'opJsonEditor2') return this.showEditor2(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Helper JSON', actions: { opAbout: 'About', opJsonEditor: 'Helper JSON', }, actionDefault: 'opJsonEditor2', setMode: undefined, onClickLink: this.onClickLink, getLastMode: undefined, updateTitle: undefined }; this.actualState = { value: '', service: '', attrName: '', componentName: '', position: 'left' }; this._onChangedContent = undefined; this.onEditorChange = (e) => { clearTimeout(this._onChangedContent); this._onChangedContent = window.setTimeout(() => { this.fireChange(this._ed1.getModel().getValue()); }, 400); }; this._div1 = el; if (el) el['mlsWidget'] = this; this._level = level || 0; this._positionToolbar = positionToolbar || 'left'; mls.events.addListener(2, 'onPropsChange', (ev) => this.onPropsChange.bind(this)(ev)); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } get confE() { return `l${this._level}_${this._positionToolbar}_results`; } get confInvert() { return `l${this._level}_${this._positionToolbar === 'left' ? 'right' : 'left'}`; } onPropsChange(ev) { const args = JSON.parse(ev.desc); if (!args) return; if (args.service !== this.constructor.name) return; if (args.position === this._positionToolbar) return; this.actualState = args; if (!this.isServiceVisible()) { const itemService = this.getMyToolbarItem(); if (!itemService) return; itemService.setAttribute('mode', 'A'); itemService.click(); } this.setInitialModels(this.actualState.value); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } createEditor() { this._ed1 = monaco.editor.create(this.c2, mls.editor.conf[this.confE]); } getUri(shortFN) { _100529_service_attr_json_helper.modelCount = _100529_service_attr_json_helper.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_attr_json_helper.modelCount}.ts`); } setInitialModels(src) { const uri = this.getUri('l2_helper_json'); const mode = 'json'; this.model = monaco.editor.getModel(uri); let val = src; if (val) val = JSON.stringify(JSON.parse(src), null, 2); if (!this.model) { this.model = monaco.editor.createModel(val, mode, uri); this.addEvents(); } this.model.setValue(val); this._ed1.setModel(this.model); } addEvents() { this.model.onDidChangeContent((e) => { this.onEditorChange(e); }); } async onExec() { await this.loadService(); } fireChange(value) { const params = { attrName: this.actualState.attrName, componentName: this.actualState.componentName, value, service: 'mls_attr_json', position: this._positionToolbar }; mls.events.fire([2], ['onPropsChange'], JSON.stringify(params)); } isServiceVisible() { const container = this._div1.closest('mls-toolbar-content-100529'); if (!container) return false; const serviceName = container.getAttribute('servicename'); if (serviceName !== this.constructor.name) return false; return true; } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100532_service_attr_json_helper</h2>' + '<hr>' + '<a target="_blank" href="https://multilevelstudio.com/#/l2/_100532_service_attr_json_helper"> Widget Source https://multilevelstudio.com/#/l2/_100532_service_attr_json_helper </a>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showEditor2() { return true; } showEditor() { if (this.menu.setMode) this.menu.setMode('initial'); return true; } async loadService() { console.info('loadService'); if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this.createEditor(); this.c2['mlsEditor'] = this._ed1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); if (typeof this._div1['layout'] === 'function') this._div1['layout'](); } else { this.setInitialModels(''); this._ed1.setModel(this.model); this.showEditor2(); } } openMenuItem(op) { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink(op); } } _100529_service_attr_json_helper.details = [, , , , { name: '&#xf142; Editor JSON', ref: '_100532_service_results' }, ]; l2_html._100529_service_attr_json_helper = _100529_service_attr_json_helper; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_colors extends l2_html.BaseService { constructor(el, level) { super(); this.needFire = true; this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opHelper') return this.showHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Colors', actions: { opAbout: 'About', opHelper: 'Pallete', }, actionDefault: 'opHelper', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; this.level = +level; if (el) el['mlsWidget'] = this; mls.events.addEventListener([this.level], ['DSColorClicked'], (ev) => { if (ev.desc === 'right') { this.needFire = true; return; } this.needFire = false; const itemColor = this.getMyToolbarItem(); if (!itemColor) return; itemColor.click(); this.needFire = true; }); mls.events.addEventListener([3], ['DSColorChanged'], (ev) => { const visible = this.isServiceVisible(); if (!visible) return; if (this.onDSColorChanged) this.onDSColorChanged(ev); }); mls.events.addEventListener([this.level], ['DSTokenSelected'], (ev) => { const itemColor = this.getMyToolbarItem(); if (!itemColor) return; itemColor.setAttribute('mode', 'A'); }); mls.events.addEventListener([this.level], ['DSTokenUnSelected'], (ev) => { const itemColor = this.getMyToolbarItem(); if (!itemColor) return; itemColor.setAttribute('mode', 'H'); }); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } isServiceVisible() { return this._div1.getAttribute('visible') === 'true'; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About</h1>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showHelper() { this.menu.title = 'Pallete'; this.c2.setAttribute('path', '_100529_service_tokens_colors'); return true; } loadService() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; if (!this.c1 || !this.c2 || this.lastProject !== project || this.lastDsIndex !== mode) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } this.lastDsIndex = mode; this.lastProject = project; if (this.needFire) mls.events.fire([this.level], ['DSColorClicked'], 'right'); } } _100529_service_colors.details = [, , , , { name: '&#xf142; Tokens', ref: '_100532_service_tokens' }, ]; l2_html._100529_service_colors = _100529_service_colors; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_configServices extends l2_html.BaseService { constructor(el, level, position) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.onExec(); if (op === 'opAbout') return this.showAbout(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Config Service', actions: { opDefault: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, }; this.sts = 0; this.last = undefined; if (el) el['mlsWidget'] = this; this._div1 = el; this.level = level; this.position = position; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); return true; } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_List</h2>' + '<hr>' + '<p>Widget Source: https://multilevelstudio.com/#/l2/_100529_service_configServices</p>' + '<p>Page Source: https://multilevelstudio.com/#/l4/_100529_service_configServices</p>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-l4-page-isolate-100529'); this.c2.setAttribute('path', '_100529_service_configServices'); this.c2['instance'] = this._div1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.c2.style.width = '100%'; this.c2.style.height = '100%'; } else { this.c2['reload'](); } } } _100529_service_configServices.details = [, , , , { name: '&#xf142; Config', ref: '_100529_service_configServices' }, ]; _100529_service_configServices.staticCount = 0; l2_html._100529_service_configServices = _100529_service_configServices; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_ds_resume extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opResume') return this.showOverview(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Overview', actions: { opAbout: 'About', opOverview: 'Resume', }, actionDefault: 'opResume', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSSelected'], (ev) => { if (!this.isTabL3Active()) return; const itemResume = this.getMyToolbarItem(); if (!itemResume) return; itemResume.setAttribute('mode', 'A'); itemResume.click(); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } isTabL3Active() { const l3 = this._div1.closest('mls-l3-100529'); if (l3 && l3.getAttribute('active') === 'true') return true; return false; } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Overview</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showOverview() { this.menu.title = 'Overview'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_ds_resume'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this.c2.setAttribute('force', 'true'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } this.c2.setAttribute('path', '_100529_service_ds_resume'); } } _100529_service_ds_resume.details = [, , , , { name: '&#xf142; Resume', ref: '_100529_mls_l3_ds_resume' }, ]; l2_html._100529_service_ds_resume = _100529_service_ds_resume; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_histories extends l2_html.BaseService { constructor(el, level, position) { super(); this.hashOriginal = ""; this.hashModified = ""; this.histories = {}; this.onClickLink = (op) => { if (op === 'opHistories') return this.showStart(); if (op === 'opAbout') return this.showAbout(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Save', actions: { opHistories: 'Start', opAbout: 'About', }, actionDefault: 'opHistories', setMode: undefined, onClickLink: this.onClickLink, }; this.extensions = { javascript: '.js', typescript: '.ts', json: '.json', html: '.html' }; if (el) el['mlsWidget'] = this; this._div1 = el; this._level = +level; this._positionToolbar = position || 'left'; this._div1 = el; mls.events.addEventListener([2], ['HistoriesSelected'], (ev) => this.onSelectHistories(ev)); } get confE() { return `l${this._level}_${this._positionToolbar}_histories`; } onServiceClick(ev) { this.loadService(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } showStart() { return true; } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_histories</h2>' + '<hr>' + '<a href="https://multilevelstudio.com/#/l2/_100529_service_histories" target="_blank"> Service Source: https://multilevelstudio.com/#/l2/_100529_service_histories </a>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } async loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this.createEditor(); this.c2['mlsEditor'] = this._ed1; this.setInitialHistories('Loading...', 'Loading...'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } if (!this.fileInfo) { this.setInitialHistories('No histories selected', 'No histories selected'); } if (typeof this._div1['layout'] === 'function') { setTimeout(() => { this._div1['layout'](); }, 100); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } async getHistories(hash) { if (this.histories[hash]) return this.histories[hash]; const content = await this.fileInfo.getHistoryContent(hash); this.histories[hash] = content; return this.histories[hash]; } createEditor() { const opt = { automaticLayout: true, }; this._ed1 = monaco.editor.createDiffEditor(this.c2, opt); } setInitialHistories(srcOriginal, srcModified) { const modelOriginal = this.createOrGetModel('typescript', srcOriginal, 'original'); const modelModified = this.createOrGetModel('typescript', srcModified, 'modified'); this._ed1.updateOptions({ readOnly: true }); this._ed1.setModel({ original: modelOriginal, modified: modelModified, }); } createOrGetModel(editorType, src, tp) { const uri = this.getUri(`${this.constructor.name}_${this._positionToolbar}_${tp}`); let model1 = monaco.editor.getModel(uri); if (!model1) { model1 = monaco.editor.createModel(src, editorType, uri); } return model1; } getUri(shortFN) { _100529_service_histories.modelCount = _100529_service_histories.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_histories.modelCount}.ts`); } async onSelectHistories(ev) { const params = JSON.parse(ev.desc); if (params.position === this._positionToolbar) return; if (params.level !== this._level) return; const itemHistorie = this.getMyToolbarItem(); if (!itemHistorie) return; itemHistorie.setAttribute('mode', 'A'); itemHistorie.click(); const key = mls.stor.getKeyToFiles(params.project, params.level, params.shortName, params.folder, params.extension); const storFile = mls.stor.files[key]; if (!storFile) return; this.fileInfo = storFile; this.hashModified = params.hashModified; this.hashOriginal = params.hashOriginal; let src2 = ''; if (this.hashModified === 'local') { const info = await this.fileInfo.getValueInfo(); src2 = info && info.content ? info.content : (await this.fileInfo.getContent()); } else { src2 = this.hashModified ? await this.getHistories(this.hashModified) : ''; } const src1 = this.hashOriginal ? await this.getHistories(this.hashOriginal) : ''; this.setInitialHistories(src1, src2); } } l2_html._100529_service_histories = _100529_service_histories; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_home extends l2_html.BaseHtml { } l2_html._100529_service_home = _100529_service_home; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_icons extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opIcons') return this.showIcons(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Icons', actions: { opAbout: 'About', opIcons: 'Icons', }, actionDefault: 'opIcons', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About icons</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showIcons() { const div1 = document.createElement('div'); this.menu.title = 'Icons'; div1.innerHTML = '<h1>My Icons</h1>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } loadService() { if (this._div1.children.length !== 1) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); if (typeof this._div1['layout'] === 'function') this._div1['layout'](); } } reset() { } } _100529_service_icons.details = [, , , , { name: '&#xf142; Icons', ref: '_100532_service_icons' }, ]; l2_html._100529_service_icons = _100529_service_icons; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_images extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opImages') return this.showIcons(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Images', actions: { opAbout: 'About', opImages: 'Icons', }, actionDefault: 'opImages', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About images</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showIcons() { const div1 = document.createElement('div'); this.menu.title = 'Images'; div1.innerHTML = '<h1>My Images</h1>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } loadService() { if (this._div1.children.length !== 1) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } reset() { } } _100529_service_images.details = [, , , , { name: '&#xf142; Images', ref: '_100532_service_images' }, ]; l2_html._100529_service_images = _100529_service_images; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_l3_documentation extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.showDocs(); if (op === 'opAbout') return this.showAbout(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Documentation', actions: { opDefault: 'Docs', opDefault2: 'Docs2', opDefault3: 'Docs3', opDefault4: 'Docs4', opDefault5: 'Docs5', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, getLastMode: undefined, updateTitle: undefined }; if (el) el['mlsWidget'] = this; this.level = +level; this._div1 = el; mls.events.addEventListener([this.level], ['DSDocPageChanged'], (ev) => { if (this.onDSDocPageChanged) this.onDSDocPageChanged(ev); }); mls.events.addEventListener([this.level], ['DSDocSelected'], (ev) => { if (this.onDSDocSelected) this.onDSDocSelected(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } showAbout() { if (!this.aboutDiv) { this.aboutDiv = document.createElement('mls-load-page-l4-100529'); this.aboutDiv.setAttribute('path', '_100529_service_doc_about'); } if (this.menu.setMode) this.menu.setMode('page', this.aboutDiv); return true; } showDocs() { this.menu.title = 'Docs'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_l3_documentation'); return true; } onExec() { this.loadService(); return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.c2.style.width = '100%'; this.c2.style.height = '100%'; } mls.events.fire([this.level], ['DSDocSelected'], 'Doc Selected', 0); } reset() { mls.events.fire([this.level], ['DSDocUnSelected'], 'Doc UnSelected'); } fireComunication(json) { mls.events.fire([this.level], ['DSDocPageClicked'], json); } } _100529_service_l3_documentation.details = [, , , { name: '&#xf02d; Documentation', ref: '' }, ]; l2_html._100529_service_l3_documentation = _100529_service_l3_documentation; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_l3_see_documentation extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.onExec(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Documentation', actions: { opDefault: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, }; if (el) el['mlsWidget'] = this; this.level = +level; this._div1 = el; mls.events.addEventListener([3], ['DSDocPageClicked'], (ev) => { if (this.onDSDocPageClicked) this.onDSDocPageClicked(ev); }); mls.events.addEventListener([this.level], ['DSDocSelected'], (ev) => { const itemDocPage = this.getMyToolbarItem(); if (!itemDocPage) return; itemDocPage.setAttribute('mode', 'A'); itemDocPage.click(); }); mls.events.addEventListener([this.level], ['DSDocUnSelected'], (ev) => { const itemDocPage = this.getMyToolbarItem(); if (!itemDocPage) return; itemDocPage.setAttribute('mode', 'H'); this._div1.innerHTML = ''; this.c1 = undefined; this.c2 = undefined; }); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-2-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } this.c2.setAttribute('path', '_100529_service_l3_see_documentation'); } fireComunication(json) { mls.events.fire([this.level], ['DSDocPageChanged'], json); } } _100529_service_l3_see_documentation.details = [, , , { name: '&#xf02d; Documentation', ref: '' }, ]; l2_html._100529_service_l3_see_documentation = _100529_service_l3_see_documentation; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_libs extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opLibs') return this.showLibs(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Libs', actions: { opAbout: 'About', opLibs: 'Libs', }, actionDefault: 'opLibs', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Libs</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showLibs() { const div1 = document.createElement('div'); this.menu.title = 'Libs'; div1.innerHTML = '<h1>My Libs</h1>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } loadService() { if (this._div1.children.length !== 1) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } reset() { } } _100529_service_libs.details = [, , , , { name: '&#xf142; libs', ref: '_100529_service_libs' }, ]; l2_html._100529_service_libs = _100529_service_libs; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_preview extends l2_html.BaseService { constructor(el, level, positionToolbar) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.showDefault(); if (op === 'opAbout') return this.showAbout(); if (op === 'opPreview') return this.showPreview(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Preview', actions: { opAbout: 'About', opPreview: 'Preview', opDefault: '' }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, updateTitle: undefined, getLastMode: undefined }; this.lastEditorMode = false; this.getValueInfo = async (activeModel) => { const rc = { content: activeModel.model.getValue(), contentType: 'string', originalShortName: activeModel.originalShortName, originalProject: activeModel.originalProject, originalCRC: activeModel.originalCRC }; return rc; }; this._onChangedContent = undefined; this.onModelChange = (activeModel, storFile) => { clearTimeout(this._onChangedContent); this._onChangedContent = window.setTimeout(() => { this.updateModelStatus(activeModel, true, storFile); }, 400); }; this._div1 = el; this._level = level || 0; this._positionToolbar = positionToolbar || 'left'; if (el) el['mlsWidget'] = this; mls.events.addListener(2, 'FileAction', this.onMLSEvents.bind(this)); mls.events.addEventListener([3], ['DSWidgetsSelected'], this.onMLSEventsL3.bind(this)); mls.events.addEventListener([3], ['DSWidgetsUnSelected'], (ev) => { if (ev.level !== this._level) return; const item = this.getMyToolbarItem(); if (!item) return; item.setAttribute('mode', 'H'); }); mls.events.addEventListener([3], ['DSStyleSelected'], async (ev) => { if (ev.level !== this._level) return; const params = ev.desc ? JSON.parse(ev.desc) : []; if (!params.isComponent || (params.service.length > 0 && !params.service.includes(this.constructor.name))) return; const itemWExample = this.getMyToolbarItem(); if (!itemWExample) return; itemWExample.setAttribute('mode', 'A'); if (params.component) mls.actual[0].setFullName(params.component); if ((!this.info && params.component) || (this.info && params.component && this.info.shortName !== mls.actual[0].path)) { this.info = { project: mls.actual[0].project, shortName: mls.actual[0].path, folder: '', extension: '.ts' }; } this.lastOpenFile = this.info; await this.verifyAndSetDefaultPreview(); }); mls.events.addEventListener([3], ['DSStyleUnSelected'], (ev) => { if (ev.level !== this._level) return; const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemWExample = this.getMyToolbarItem(); if (!itemWExample) return; itemWExample.setAttribute('mode', 'H'); }); mls.events.addEventListener([2, 3], ['DSStyleChanged'], async (ev) => { if (ev.level !== this._level) return; const rc = JSON.parse(ev.desc); if (rc.emitter === 'right' || rc.emitter === 'right-get') return; if (!this.c2) return; await this.verifyAndSetDefaultPreview(); }); mls.events.addEventListener([2, 3], ['DSStyleCursorChanged'], (ev) => { if (ev.level !== this._level) return; const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemWEx = this.getMyToolbarItem(); if (!itemWEx || this._div1.getAttribute('visible') === 'true') return; itemWEx.click(); } }); } get confE() { return `l${this._level}_${this._positionToolbar}_preview_HTML`; } onServiceClick(ev) { this.onExec(); } openEditorMode() { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink('opEditor'); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } async listWebComponents() { try { if (!this.info) return []; const key = mls.stor.getKeyToFiles(this.info.project, 2, this.info.shortName, this.info.folder, '.html'); if (!mls.stor.files[key]) throw new Error('Not found stor file: listWebComponents'); const file = mls.stor.files[key]; const html = (await file.getValueInfo()).content; const l = this.extrairTagsCustomizadas(html); return l; } catch (e) { console.info(e); return undefined; } } async createFileHtml(project, shortName) { try { const mfile = await this.createFile(project, shortName); return mfile; } catch (e) { throw new Error(e.message); } } showDefault() { if (this.lastEditorMode) { this.lastEditorMode = false; } else { this.verifyAndSetDefaultPreview(); } return true; } showPreview() { if (this.menu.setMode) this.menu.setMode('initial', this.c2); this.verifyAndSetDefaultPreview(); return true; } showEditor() { try { this.lastEditorMode = true; const key = mls.stor.getKeyToFiles(this.info.project, 2, this.info.shortName, this.info.folder, '.html'); const storFile = mls.stor.files[key]; const fileModel = this.getMFile(storFile.project, storFile.shortName, storFile.extension); if (!fileModel) { this.createModelHTML2(storFile, true).then(() => { this.showActiveModel(); if (this.menu.setMode) this.menu.setMode('page', this.divMonaco); this.recalculaEditor(); return true; }); } else { mls.l2.editor.editors[this.confE] = fileModel; if (!fileModel.compilerResults || fileModel.compilerResults.modelNeedCompile) { mls.l2.editor.forceModelUpdate(fileModel.model); } this.showActiveModel(); if (this.menu.setMode) this.menu.setMode('page', this.divMonaco); this.recalculaEditor(); return true; } } catch (e) { this.lastEditorMode = false; return false; } } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_preview</h2>' + '<hr>' + '<a target="_blank" href="https://multilevelstudio.com/#/l2/_100529_service_preview"> Widget Source https://multilevelstudio.com/#/l2/_100529_service_preview </a>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } async onMLSEventsL3(ev) { if (ev.level !== this._level) return; const js = JSON.parse(ev.desc); if (!js && !js.value) return; const item = this.getMyToolbarItem(); if (!item) return; item.setAttribute('mode', 'A'); item.click(); mls.actual[0].setFullName(js.value); this.info = { project: mls.actual[0].project, shortName: mls.actual[0].path, folder: '', extension: '.ts' }; await this.onOpenEvent(this.info); } async onMLSEvents(ev) { try { if (ev.level !== this._level || (ev.type !== 'FileAction')) return; const fileAction = JSON.parse(ev.desc); if (fileAction.position === this._positionToolbar || !['open', 'statusOrErrorChanged', 'changed', 'new'].includes(fileAction.action) || fileAction.project === 0) return; clearTimeout(this.timeEvent); this.timeEvent = setTimeout(async () => { await this.onMLSEvents2(fileAction); }, 500); } catch (e) { console.info(e); } } async onMLSEvents2(fileAction) { const visible = this.isServiceVisible(); if (['open', 'new'].includes(fileAction.action)) { const mfile = mls.l2.editor.get({ project: fileAction.project, shortName: fileAction.shortName }); if (!mfile) { this.activeMe('H', false); return; } const mmodule = await mls.l2.enhancement.getEnhancementInstance(mfile); if (!mmodule) { this.activeMe('H', false); return; } this.lastOpenFile = fileAction; await this.onOpenEvent(fileAction); } else if (visible && ['statusOrErrorChanged', 'changed'].includes(fileAction.action)) { const mfile = mls.l2.editor.get({ project: fileAction.project, shortName: fileAction.shortName }); if (mfile && mfile.storFile.hasError) { this._div1.setAttribute('error', 'File has error'); return; } await this.onChangedEvent(fileAction); } } async onChangedEvent(fileAction) { if (this.isServiceVisible() === false) return; await this.loadService(); } async verifyAndSetDefaultPreview() { if (!this.c2) return; const fileAction = this.lastOpenFile; if (!fileAction) return; const mfile = mls.l2.editor.get({ project: fileAction.project, shortName: fileAction.shortName }); if (!mfile) { if (this._level !== 3) this.activeMe('H', false); return; } const mmodule = await mls.l2.enhancement.getEnhancementInstance(mfile); if (!mmodule) { if (this._level !== 3) this.activeMe('H', false); return; } const details = await mmodule.getDesignDetails(mfile); const path = this.c2.getAttribute('path'); if (details['servicePreviewDefault'] && (!path || path !== details['servicePreviewDefault'])) { this.c2.setAttribute('path', details['servicePreviewDefault']); } else if (details['servicePreviewDefault'] && path === details['servicePreviewDefault']) { this.c2['reload'](); } } async onOpenEvent(fileAction) { this.info = { project: fileAction.project, shortName: fileAction.shortName, folder: fileAction.folder, extension: fileAction.extension }; this.menu.title = `_${fileAction.project}_${fileAction.shortName}`; this.activeMe('A', false); const dsIndex = mls.actual[3].mode && this._level !== 2 ? mls.actual[3].mode : 0; const ds = mls.l3.getDSInstance(mls.actual[5].project, dsIndex); await ds.init(); if (this.isServiceVisible() === false) return; await this.verifyAndSetDefaultPreview(); if (this.menu.updateTitle) this.menu.updateTitle(); } isServiceVisible() { const container = this._div1.closest('mls-toolbar-content-100529'); if (!container) return false; const serviceName = container.getAttribute('servicename'); if (serviceName !== this.constructor.name) return false; return true; } activeMe(status, click) { const itemBg = this.getMyToolbarItem(); if (!itemBg) return; itemBg.setAttribute('mode', status); if (click) itemBg.click(); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); return true; } async createFile(project, shortName) { const mfile = await this.createModelHTML_new(project, shortName); return mfile; } async createModelHTML_new(newProject, newShortName) { const defaultHTML = await this.getDefaultHTML(newProject, newShortName); const mfile = await this.createModelHTML1(newShortName, newProject, defaultHTML, true, 'new'); return mfile; } async getDefaultHTML(newProject, newShortName) { const defaultHTML = `<h3 id="openEditorServicePreview" style="cursor:pointer">Edit this file</h3>`; const mfile = mls.l2.editor.get({ project: newProject, shortName: newShortName }); if (!mfile.compilerResults.prodJS) { mfile.compilerResults.modelNeedCompile = true; await mls.l2.editor.getCompilerResultTS(mfile); } const mmodule = await mls.l2.enhancement.getEnhancementInstance(mfile); if (!mmodule || !mmodule.getDesignDetails) return defaultHTML; const html = await mmodule.getDesignDetails(mfile); return defaultHTML + '\n' + html.defaultHtmlExamplePreview; } getUri(shortFN) { return monaco.Uri.parse(`file://server/${shortFN}.html`); } async createModelHTML1(shortName, project, defaultHTML, activateModel, newStatus = null) { const level = 2; const extension = '.html'; const key = mls.stor.getKeyToFiles(project, level, shortName, '', extension); let storFile = mls.stor.files[key]; if (storFile && newStatus === 'new') throw new Error('Error on new status, model already exists: ' + key); const src = storFile ? (await storFile.getContent(defaultHTML)) || defaultHTML : defaultHTML; const uri = this.getUri(`_${project}_${shortName}_${extension}`); let model1 = this.getMFile(project, shortName, extension); if (!model1) { const model = monaco.editor.createModel(src, 'html', uri); model1 = { changed: true, error: false, project, shortName, extension, model, storFile, codeLens: [] }; this.addMFiles(model1); storFile = await mls.stor.addOrUpdateFile({ project, level, shortName, extension, versionRef: new Date().toISOString(), folder: '' }); if (newStatus) storFile.status = newStatus; this.addEventsModelHTML(storFile, model1); } if (activateModel) mls.l2.editor.editors[this.confE] = model1; return model1; } getMFile(project, shortName, extension) { return (mls.l2.editor['mfiles'])[`_${project}_${shortName}_${extension}`]; } addMFiles(item) { const key = `_${item.project}_${item.shortName}_${item.extension}`; if ((mls.l2.editor['mfiles'])[key]) delete (mls.l2.editor['mfiles'])[key]; (mls.l2.editor['mfiles'])[key] = item; return item; } ; async createModelHTML2(storFile, activedModel) { const { project, shortName, extension } = storFile; let model1 = this.getMFile(project, shortName, extension); if (model1) return model1; const info = storFile.getValueInfo ? await storFile.getValueInfo() : null; const haveInfo = info && !!info.content; const src = haveInfo ? info.content : await storFile.getContent(); if (src instanceof Blob) throw new Error('html file must be string'); const originalCRC = haveInfo ? info.originalCRC : mls.common.crc.crc32(src).toString(16); const originalProject = haveInfo ? info.originalProject : undefined; const originalShortName = haveInfo ? info.originalShortName : undefined; const uri = this.getUri(`_${project}_${shortName}_${extension}`); const model = monaco.editor.createModel(src, 'html', uri); model1 = { changed: false, error: false, project, shortName, extension, model, originalCRC, originalProject, originalShortName, storFile, codeLens: [] }; this.addMFiles(model1); this.addEventsModelHTML(storFile, model1); await this.updateModelStatus(model1, false, storFile); if (activedModel) { mls.l2.editor.editors[this.confE] = model1; } return model1; } showActiveModel() { const activeModel = mls.l2.editor.editors[this.confE]; if (!this._ed1 || !activeModel || !this.menu.getLastMode) return false; const changedFile = this.menu.title !== `_${activeModel.project}_${activeModel.shortName}`; this.menu.title = `_${activeModel.project}_${activeModel.shortName}`; const lastMode = this.menu.getLastMode(); if (changedFile && lastMode !== 'initial') { this._ed1.setModel(activeModel.model); this.menu.setMode('initial'); } else if (lastMode === 'initial') { this._ed1.setModel(activeModel.model); this.menu.updateTitle(); } else if (lastMode === 'editor') { } else if (lastMode === 'page') { this._ed1.setModel(activeModel.model); } return true; } addEventsModelHTML(storFile, model1) { storFile.onAction = (action) => this.afterUpdate(storFile); storFile.getValueInfo = () => this.getValueInfo(model1); model1.model.onDidChangeContent((e) => this.onModelChange(model1, storFile)); } async afterUpdate(storFile) { const mmodel = this.getMFile(storFile.project, storFile.shortName, storFile.extension); if (!mmodel) return; if (storFile.status === 'deleted') { this.deleteFile(storFile); return; } if (storFile.status === 'renamed') { mmodel.originalProject = undefined; mmodel.originalShortName = undefined; mmodel.originalCRC = mls.common.crc.crc32(mmodel.model.getValue()).toString(16); } await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); storFile.status = 'nochange'; } async deleteFile(storFile) { await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); mls.l2.editor.remove(storFile); const keyFiles = mls.stor.getKeyToFiles(storFile.project, storFile.level, storFile.shortName, storFile.folder, storFile.extension); delete mls.stor.files[keyFiles]; } async updateModelStatus(model1, changed, storFile) { await this.changeStatusFile(model1, storFile); } async changeStatusFile(model1, storFile) { if (!storFile) return; const sameContent = model1.originalCRC === mls.common.crc.crc32(model1.model.getValue()).toString(16); if (sameContent) { if (storFile.status !== 'new') storFile.status = 'nochange'; await mls.stor.localStor.setContent(storFile, { content: null }); return; } if (storFile.status !== 'renamed' && (storFile.status !== 'new')) storFile.status = 'changed'; const html = await this.getValueInfo(model1); let html2 = this.removerScript(html.content); if (html.content !== html2) { model1.model.setValue(html2); html.content = html2; } await mls.stor.localStor.setContent(storFile, html); } removerScript(html) { const regex = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi; return html.replace(regex, ''); } extrairTagsCustomizadas(html) { const regex = /<\/?([a-z][a-z0-9-]*)\b[^>]*>/gi; const customTags = []; let match; while ((match = regex.exec(html)) !== null) { const tag = match[1]; if (tag.indexOf('-') >= 0 && !customTags.includes(tag)) customTags.push(tag); } return customTags; } async initMonacoEditor() { this.divMonaco = document.createElement('mls-editor-100529'); this._ed1 = monaco.editor.create(this.divMonaco, mls.editor.conf[this.confE]); this.divMonaco['mlsEditor'] = this._ed1; mls.editor.instances[this.confE] = this._ed1; } recalculaEditor() { var _a; const size = (_a = this._div1.getAttribute('msize')) === null || _a === void 0 ? void 0 : _a.split(','); const sizec = this._div1.getBoundingClientRect(); this.divMonaco.style.height = size && size[1] ? size[1] + 'px' : sizec.height + 'px'; this.divMonaco.style.width = '100%'; if (typeof this._div1['layout'] === 'function') this._ed1.layout(); } async loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this.c2['instance'] = this._div1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.initMonacoEditor(); } else { this.verifyAndSetDefaultPreview(); } } } _100529_service_preview.details = [, , , , { name: '&#xf06e; Preview', ref: '_100529_service_previewWidget' }, ]; l2_html._100529_service_preview = _100529_service_preview; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_previewWidget extends l2_html.BaseService { constructor(el, level, positionToolbar) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opPreview') return this.showPreview(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Preview', actions: { opAbout: 'About', opPreview: 'Preview', opEditor: 'Editor', opDefault: '' }, actionDefault: 'opPreview', setMode: undefined, onClickLink: this.onClickLink, updateTitle: undefined, getLastMode: undefined }; this.getValueInfo = async (activeModel) => { const rc = { content: activeModel.model.getValue(), contentType: 'string', originalShortName: activeModel.originalShortName, originalProject: activeModel.originalProject, originalCRC: activeModel.originalCRC }; return rc; }; this._onChangedContent = undefined; this.onModelChange = (activeModel, storFile) => { clearTimeout(this._onChangedContent); this._onChangedContent = window.setTimeout(() => { this.updateModelStatus(activeModel, true, storFile); }, 400); }; this._div1 = el; if (mls.istrace) console.info('servicePreview: 1.0.0.14'); if (el) el['mlsWidget'] = this; this._level = level || 0; this._positionToolbar = positionToolbar || 'left'; mls.events.addListener(2, 'FileAction', this.onMLSEvents.bind(this)); } get confE() { return `l${this._level}_${this._positionToolbar}_preview_HTML`; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } async listWebComponents() { try { if (!this.info) return []; const key = mls.stor.getKeyToFiles(this.info.project, 2, this.info.shortName, this.info.folder, '.html'); if (!mls.stor.files[key]) throw new Error('Not found stor file: listWebComponents'); const file = mls.stor.files[key]; const html = (await file.getValueInfo()).content; const l = this.extrairTagsCustomizadas(html); return l; } catch (e) { console.info(e); } } async onMLSEvents(ev) { try { if (ev.level !== this._level || (ev.type !== 'FileAction')) return; const fileAction = JSON.parse(ev.desc); if (fileAction.position === this._positionToolbar || !['open', 'statusOrErrorChanged'].includes(fileAction.action) || fileAction.project === 0) return; if (fileAction.action === 'open') { await this.onOpenEvent(fileAction); } else if (fileAction.action === 'statusOrErrorChanged') { await this.onChangedEvent(fileAction); } } catch (e) { console.info(e); } } async onChangedEvent(fileAction) { if (this.isServiceVisible() === false) return; await this.loadService(); } async onOpenEvent(fileAction) { this.info = { project: fileAction.project, shortName: fileAction.shortName, folder: fileAction.folder, extension: fileAction.extension }; this.activeMe('A', false); const ds = mls.l3.getDSInstance(mls.actual[5].project, 0); await ds.init(); const key = mls.stor.getKeyToFiles(fileAction.project, 2, fileAction.shortName, fileAction.folder, '.html'); const exist = !!mls.stor.files[key]; if (!exist) await this.createFile(fileAction); await this.loadService(); } isServiceVisible() { const container = this._div1.closest('mls-toolbar-content-100529'); if (!container) return false; const serviceName = container.getAttribute('servicename'); if (serviceName !== this.constructor.name) return false; return true; } showPreview() { this.c2['reload'](); return true; } showEditor() { const key = mls.stor.getKeyToFiles(this.info.project, 2, this.info.shortName, this.info.folder, '.html'); const storFile = mls.stor.files[key]; const fileModel = this.getMFile(storFile.project, storFile.shortName, storFile.extension); if (!fileModel) { this.createModelHTML2(storFile, true).then(() => { this.showActiveModel(); if (this.menu.setMode) this.menu.setMode('page', this.divMonaco); this.recalculaEditor(); return true; }).catch((e) => false); } else { mls.l2.editor.editors[this.confE] = fileModel; if (!fileModel.compilerResults || fileModel.compilerResults.modelNeedCompile) { mls.l2.editor.forceModelUpdate(fileModel.model); } this.showActiveModel(); if (this.menu.setMode) this.menu.setMode('page', this.divMonaco); this.recalculaEditor(); return true; } } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_servicePreviewWidget</h2>' + '<hr>' + '<a target="_blank" href="https://multilevelstudio.com/#/l2/_100529_servicePreviewWidget"> Widget Source https://multilevelstudio.com/#/l2/_100529_servicePreviewWidget </a>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } activeMe(status, click) { const itemBg = this.getMyToolbarItem(); if (!itemBg) return; itemBg.setAttribute('mode', status); if (click) itemBg.click(); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); return true; } async createFile(fileAction) { await this.createModelHTML_new(fileAction.project, fileAction.shortName); } async createModelHTML_new(newProject, newShortName) { const defaultHTML = `<h3 id="openEditorServicePreview" style="cursor:pointer">Edit this file</h3>`; await this.createModelHTML1(newShortName, newProject, defaultHTML, true, 'new'); } getUri(shortFN) { return monaco.Uri.parse(`file://server/${shortFN}.html`); } async createModelHTML1(shortName, project, defaultHTML, activateModel, newStatus = null) { const level = 2; const extension = '.html'; const key = mls.stor.getKeyToFiles(project, level, shortName, '', extension); let storFile = mls.stor.files[key]; if (storFile && newStatus === 'new') throw new Error('Error on new status, model already exists: ' + key); const src = storFile ? (await storFile.getContent(defaultHTML)) || defaultHTML : defaultHTML; const uri = this.getUri(`_${project}_${shortName}_${extension}`); let model1 = this.getMFile(project, shortName, extension); if (!model1) { const model = monaco.editor.createModel(src, 'html', uri); model1 = { changed: true, error: false, project, shortName, extension, model, storFile, codeLens: [] }; this.addMFiles(model1); storFile = await mls.stor.addOrUpdateFile({ project, level, shortName, extension, versionRef: new Date().toISOString(), folder: '' }); if (newStatus) storFile.status = newStatus; this.addEventsModelHTML(storFile, model1); } if (activateModel) mls.l2.editor.editors[this.confE] = model1; return model1; } getMFile(project, shortName, extension) { return (mls.l2.editor['mfiles'])[`_${project}_${shortName}_${extension}`]; } addMFiles(item) { const key = `_${item.project}_${item.shortName}_${item.extension}`; if ((mls.l2.editor['mfiles'])[key]) delete (mls.l2.editor['mfiles'])[key]; (mls.l2.editor['mfiles'])[key] = item; return item; } ; async createModelHTML2(storFile, activedModel) { const { project, shortName, extension } = storFile; let model1 = this.getMFile(project, shortName, extension); if (model1) return model1; const info = storFile.getValueInfo ? await storFile.getValueInfo() : null; const haveInfo = info && !!info.content; const src = haveInfo ? info.content : await storFile.getContent(); if (src instanceof Blob) throw new Error('html file must be string'); const originalCRC = haveInfo ? info.originalCRC : mls.common.crc.crc32(src).toString(16); const originalProject = haveInfo ? info.originalProject : undefined; const originalShortName = haveInfo ? info.originalShortName : undefined; const uri = this.getUri(`_${project}_${shortName}_${extension}`); const model = monaco.editor.createModel(src, 'html', uri); model1 = { changed: false, error: false, project, shortName, extension, model, originalCRC, originalProject, originalShortName, storFile, codeLens: [] }; this.addMFiles(model1); this.addEventsModelHTML(storFile, model1); await this.updateModelStatus(model1, false, storFile); if (activedModel) { mls.l2.editor.editors[this.confE] = model1; } return model1; } showActiveModel() { const activeModel = mls.l2.editor.editors[this.confE]; if (!this._ed1 || !activeModel || !this.menu.getLastMode) return false; const changedFile = this.menu.title !== activeModel.shortName; this.menu.title = activeModel.shortName; const lastMode = this.menu.getLastMode(); if (changedFile && lastMode !== 'initial') { this._ed1.setModel(activeModel.model); this.menu.setMode('initial'); } else if (lastMode === 'initial') { this._ed1.setModel(activeModel.model); this.menu.updateTitle(); } else if (lastMode === 'editor') { } else if (lastMode === 'page') { this._ed1.setModel(activeModel.model); } return true; } addEventsModelHTML(storFile, model1) { storFile.onAction = (action) => this.afterUpdate(storFile); storFile.getValueInfo = () => this.getValueInfo(model1); model1.model.onDidChangeContent((e) => this.onModelChange(model1, storFile)); } async afterUpdate(storFile) { const mmodel = this.getMFile(storFile.project, storFile.shortName, storFile.extension); if (!mmodel) return; if (storFile.status === 'deleted') { this.deleteFile(storFile); return; } if (storFile.status === 'renamed') { mmodel.originalProject = undefined; mmodel.originalShortName = undefined; mmodel.originalCRC = mls.common.crc.crc32(mmodel.model.getValue()).toString(16); } await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); storFile.status = 'nochange'; } async deleteFile(storFile) { await mls.stor.localStor.setContent(storFile, { contentType: 'string', content: null }); mls.l2.editor.remove(storFile); const keyFiles = mls.stor.getKeyToFiles(storFile.project, storFile.level, storFile.shortName, storFile.folder, storFile.extension); delete mls.stor.files[keyFiles]; } async updateModelStatus(model1, changed, storFile) { await this.changeStatusFile(model1, storFile); } async changeStatusFile(model1, storFile) { if (!storFile) return; const sameContent = model1.originalCRC === mls.common.crc.crc32(model1.model.getValue()).toString(16); if (sameContent) { if (storFile.status !== 'new') storFile.status = 'nochange'; await mls.stor.localStor.setContent(storFile, { content: null }); return; } if (storFile.status !== 'renamed' && (storFile.status !== 'new')) storFile.status = 'changed'; const html = await this.getValueInfo(model1); let html2 = this.removerScript(html.content); if (html.content !== html2) { model1.model.setValue(html2); html.content = html2; } await mls.stor.localStor.setContent(storFile, html); } removerScript(html) { const regex = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi; return html.replace(regex, ''); } extrairTagsCustomizadas(html) { const regex = /<\/?([a-z][a-z0-9-]*)\b[^>]*>/gi; const coreTags = ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'bgsound', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'image', 'img', 'input', 'ins', 'isindex', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'listing', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'nobr', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'plaintext', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr', 'xmp']; const customTags = []; let match; while ((match = regex.exec(html)) !== null) { const tag = match[1]; if (!coreTags.includes(tag) && !customTags.includes(tag)) { customTags.push(tag); } } return customTags; } async initMonacoEditor() { this.divMonaco = document.createElement('mls-editor-100529'); this._ed1 = monaco.editor.create(this.divMonaco, mls.editor.conf[this.confE]); this.divMonaco['mlsEditor'] = this._ed1; mls.editor.instances[this.confE] = this._ed1; } recalculaEditor() { var _a; const size = (_a = this._div1.getAttribute('msize')) === null || _a === void 0 ? void 0 : _a.split(','); const sizec = this._div1.getBoundingClientRect(); this.divMonaco.style.height = size && size[1] ? size[1] + 'px' : sizec.height + 'px'; this.divMonaco.style.width = '100%'; if (typeof this._div1['layout'] === 'function') this._ed1.layout(); } async loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-l4-page-isolate-100529'); this.c2.setAttribute('path', '_100529_servicePreviewWidget'); this.c2['instance'] = this._div1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.initMonacoEditor(); } else { this.c2['reload'](); } } } _100529_service_previewWidget.details = [, , , , { name: '&#xf06e; Preview', ref: '_100529_service_previewWidget' }, ]; l2_html._100529_service_previewWidget = _100529_service_previewWidget; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_project_details extends l2_html.BaseService { constructor(el, level, position) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.onExec(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Project Details', actions: { opDefault: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, updateTitle: undefined, getLastMode: undefined, }; if (el) el['mlsWidget'] = this; this._div1 = el; this.level = level; this.position = position || 'left'; this._div1 = el; mls.events.addEventListener([5], ['ProjectSelected'], (ev) => { this.onProjectChanged(ev.desc); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); return true; } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onProjectChanged(ev) { const params = JSON.parse(ev); if (params.emitter === 'right') return; if (params.value === this.lastProject) return; this.lastProject = params.value; this.menu.title = 'Project Details: ' + this.lastProject; this.menu.updateTitle(); const projectDetails = mls.l5.getProjectDetails(this.lastProject); this.setProjectDetails(projectDetails); } setProjectDetails(item) { this.c2.innerHTML = ''; if (!item) { this.c2.innerHTML = 'Please, select a project...'; return; } const details = document.createElement('details'); const summary = document.createElement('summary'); summary.innerHTML = 'Resume'; const lastModified = document.createElement('span'); lastModified.innerHTML = '<b>Last modified: </b>' + this.getLastModifiedFormated(item.created_at); lastModified.style.marginLeft = '1rem'; lastModified.style.marginTop = '1rem'; details.appendChild(summary); details.appendChild(lastModified); details.open = true; this.c2.appendChild(details); } getLastModifiedFormated(dt) { let lastUpdated; const dateToday = new Date(); const dtLastWrite = new Date(dt); const _MS_PER_DAY = 1000 * 60 * 60 * 24; function dateDiffInDays(a, b) { const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate()); const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate()); return Math.floor((utc2 - utc1) / _MS_PER_DAY); } const diffDays = dateDiffInDays(dtLastWrite, dateToday); const moreThanTwoDays = diffDays > 1; if (diffDays === 0) lastUpdated = 'updated today'; else if (diffDays < 30) lastUpdated = `updated ${diffDays} ${moreThanTwoDays ? 'days' : 'day'} ago`; else { const actualYear = dateToday.getFullYear(); const lastWriteYear = dtLastWrite.getFullYear(); const lastWriteMounth = dtLastWrite.getMonth(); const lastWriteDay = dtLastWrite.getDate(); const mounthFilter = { 0: 'Jan', 1: 'Feb', 2: 'Mar', 3: 'Apr', 4: 'May', 5: 'June', 6: 'July', 7: 'Aug', 8: 'Sept', 9: 'Oct', 10: 'Nov', 11: 'Dec', }; lastUpdated = `updated on ${lastWriteYear}, ${lastWriteDay} ${mounthFilter[lastWriteMounth]} `; } return lastUpdated; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('div'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } this.lastProject = mls.actual[5].project; let projectDetails; if (this.lastProject) projectDetails = mls.l5.getProjectDetails(this.lastProject); this.setProjectDetails(projectDetails); } get confE() { return `l${this.level}_${this.position}`; } } _100529_service_project_details.details = [, , , { name: '&#xf15b; ServiceList', ref: '' }, ]; l2_html._100529_service_project_details = _100529_service_project_details; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_results extends l2_html.BaseService { constructor(el, level, positionToolbar) { super(); this.editorModelName = 'serviceresults.js'; this.isReferenceOpen = false; this.isHelpAssistant = false; this.results = { delay: 0, devDoc: '', devJS: '', devTS: '', errors: '', imports: [], modelNeedCompile: false, modelVersion: 0, prodDTS: '', prodJS: '', prodMap: '', trace: [], tripleSlashMLS: undefined, references: [], decorators: '', configTS: undefined, libTS: undefined }; this.resultsLanguages = { prodJS: 'javascript', devJS: 'javascript', devTS: 'typescript', devDoc: 'json', errors: 'json', configTS: 'json', libTS: 'json', }; this.extensions = { javascript: '.js', typescript: '.ts', json: '.json', }; this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opProdJS') return this.showProdJS(); if (op === 'opProdJS2') return this.showProdJS3(); if (op === 'opTSConfig') return this.showTsConfig(); if (op === 'opTSLibs') return this.showTsLib(); if (op === 'opDevDoc') return this.showDevDoc(); if (op === 'opDevDocJson') return this.showDevDocJson(); if (op === 'opReferences') return this.showFileRefs(); if (op === 'opAssistant') return this.showAssistant(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Production - Javascript', actions: { opAbout: 'About', opProdJS: 'Production - Javascript', opTSConfig: 'Typescript Config', opTSLibs: 'Typescript Libs', opReferences: 'References', opDevDoc: 'Dev - Documentation', opDevDocJson: 'Dev - Documentation Json', }, actionDefault: 'opProdJS2', setMode: undefined, onClickLink: this.onClickLink, getLastMode: undefined, updateTitle: undefined }; this.actualResultMode = 'prodJS'; this.hasError = false; this._div1 = el; if (el) el['mlsWidget'] = this; this._level = level || 0; this._positionToolbar = positionToolbar || 'left'; this.editorModelName = `serviceresults_${this._positionToolbar}.js`; mls.events.addListener(2, 'FileAction', (ev) => this.onFileActionReceived.bind(this)(ev)); mls.events.addListener(2, 'MonacoAction', (ev) => this.onMonacoEvents(ev)); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } get confE() { return `l${this._level}_${this._positionToolbar}_results`; } get confInvert() { return `l${this._level}_${this._positionToolbar === 'left' ? 'right' : 'left'}`; } async onExec() { await this.loadService(); } isServiceVisible() { const container = this._div1.closest('mls-toolbar-content-100529'); if (!container) return false; const serviceName = container.getAttribute('servicename'); if (serviceName !== this.constructor.name) return false; return true; } createEditor() { this._ed1 = monaco.editor.create(this.c2, mls.editor.conf[this.confE]); monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ noImplicitAny: true }); } createOrGetModel(resultName, editorType, src) { const project = 100529; const shortName = resultName; const uri = this.getUri(`_${project}_${shortName}`); let model1 = mls.l2.editor.get({ project, shortName }); if (!model1) { const model = monaco.editor.createModel(src, editorType, uri); model1 = { changed: false, error: false, project, shortName, model, extension: this.extensions[editorType], }; mls.l2.editor.add(model1); } return model1; } setInitialModelProdJS(src) { const model1 = this.createOrGetModel(this.editorModelName, 'javascript', src); if (!model1) return; mls.l2.editor.editors[`${this.confE}_${this.editorModelName}`] = model1; this._ed1.setModel(model1.model); } setModelLanguage(language, value) { const activeModel = mls.l2.editor.editors[`${this.confE}_${this.editorModelName}`]; if (!activeModel) return; monaco.editor.setModelLanguage(activeModel.model, language); this._ed1.setScrollTop(0); activeModel.model.setValue(value); } getUri(shortFN) { _100529_service_results.modelCount = _100529_service_results.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_results.modelCount}.ts`); } async getCompileResults(shortName, project) { const editor = mls.l2.editor.editors[this.confInvert]; if (!editor || !shortName || !project) return; const mfile = mls.l2.editor.get({ shortName, project }); if (!mfile) return; if (mfile.compilerResults && !mfile.compilerResults.prodJS) mfile.compilerResults.modelNeedCompile = true; const results = await mls.l2.editor.getCompilerResultTS(mfile); const errs = { Errors: results.errors }; const libs = monaco.languages.typescript.typescriptDefaults.getExtraLibs(); const libs2 = {}; Object.keys(libs).forEach((key) => { libs2[key] = { version: libs[key].version }; }); this.hasError = results.errors.length > 0; this.results = Object.assign(Object.assign({}, results), { errors: JSON.stringify(errs, null, 2), references: [], configTS: JSON.stringify(monaco.languages.typescript.typescriptDefaults.getCompilerOptions(), null, 2), libTS: JSON.stringify(libs2, null, 2) }); } async onFileActionReceived(ev) { const params = JSON.parse(ev.desc); const { shortName, project } = params; if (params.position === this._positionToolbar) return; const isServiceVisible = this.isServiceVisible(); this.actualFileName = params.shortName; this.actualFileProject = params.project; if ((params.action === 'changed' || params.action === 'open') && isServiceVisible) { await this.getCompileResults(shortName, project); if (this.actualResultMode === 'refs') this.createListRefs(); else if (this.actualResultMode === 'devDocPage') this.openResultsDocsPageMode(); else if (this.hasError) this.openErrorMode(); else this.openActualResultMode(); } else if (params.action === 'fileReference') { await this.getCompileResults(shortName, project); const itemService = this.getMyToolbarItem(); this.isReferenceOpen = true; if (!itemService) return; itemService.click(); } } onMonacoEvents(ev) { const args = JSON.parse(ev.desc); if (!args) return; const { action, position } = args; if (position === this._positionToolbar) return; if (action === 'helpAssistant') { this.actualResultMode = 'assistant'; this.assistantArgs = args; const itemService = this.getMyToolbarItem(); this.isHelpAssistant = true; if (!itemService) return; itemService.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } async getReferences(shortName, project) { await mls.l2.editor['compileAllProjectIfNeed'](project); const refs = mls.l2.editor.listAllAffectedFiles(project, shortName); return refs; } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_results</h2>' + '<hr>' + '<a target="_blank" href="https://multilevelstudio.com/#/l2/_100529_service_results"> Widget Source https://multilevelstudio.com/#/l2/_100529_service_results </a>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showProdJS() { if (this.menu.setMode) this.menu.setMode('initial'); this.actualResultMode = 'prodJS'; return this.showProdJS2(); } showProdJS2() { if (this.hasError) { this.setModelLanguage(this.resultsLanguages.errors, this.results.errors); return true; } this.setModelLanguage(this.resultsLanguages.prodJS, this.results.prodJS); return true; } showProdJS3() { this.actualResultMode = 'prodJS'; return this.showProdJS2(); } showDevTs() { if (this.menu.setMode) this.menu.setMode('editor'); this.actualResultMode = 'devTS'; this.setModelLanguage(this.resultsLanguages.devTS, this.results.devTS); return true; } showDevJs() { if (this.menu.setMode) this.menu.setMode('editor'); this.actualResultMode = 'devJS'; this.setModelLanguage(this.resultsLanguages.devJS, this.results.devJS); return true; } showTsConfig() { if (this.menu.setMode) this.menu.setMode('editor'); this.actualResultMode = 'configTS'; this.setModelLanguage(this.resultsLanguages.configTS, this.results.configTS); return true; } showTsLib() { if (this.menu.setMode) this.menu.setMode('editor'); this.actualResultMode = 'libTS'; this.setModelLanguage(this.resultsLanguages.libTS, this.results.libTS); return true; } showDevDoc() { this.actualResultMode = 'devDocPage'; if (!this.devDocContainer) { this.devDocContainer = document.createElement('mls-load-page-l4-100529'); this.devDocContainer.setAttribute('path', '_100529_service_results_doc'); } if (this.menu.setMode) this.menu.setMode('page', this.devDocContainer); return true; } showFileRefs() { this.menu.title = 'File References'; this.menu.updateTitle(); this.menu.title = this.menu.actions['opProdJS']; this.actualResultMode = 'refs'; const div1 = document.createElement('div'); div1.style.padding = '2rem'; this.list = document.createElement('ul'); const hr = document.createElement('hr'); this.refTitle = document.createElement('h2'); this.createListRefs(); div1.appendChild(this.refTitle); div1.appendChild(hr); div1.appendChild(this.list); if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showAssistant() { this.menu.title = 'HelpAssistant'; this.menu.updateTitle(); this.menu.title = this.menu.actions['opProdJS']; const div1 = document.createElement('div'); div1.style.padding = '2rem'; const divDoc = document.createElement('mls-load-page-l4-100529'); divDoc.setAttribute('path', this.assistantArgs['codeLenCommand'].refs); div1.appendChild(divDoc); if (this.menu.setMode) this.menu.setMode('page', div1); return true; } async createListRefs() { if (!this.list) return; this.refTitle.innerHTML = `<b>File References from:</b> _${this.actualFileProject}_${this.actualFileName}`; this.list.innerHTML = 'Loading...'; const references = await this.getReferences(this.actualFileName, this.actualFileProject); this.results.references = references; this.list.innerHTML = ''; if (this.results.references.length === 0) { this.list.innerHTML = 'No references.'; return; } this.results.references.forEach((ref) => { const li = document.createElement('li'); const a = document.createElement('a'); a.href = '#'; a.innerHTML = `Project: ${ref.project} ShortName: ${ref.shortName} `; a.onclick = (e) => { e.preventDefault(); const cmdOpen = { action: 'open', level: 2, project: ref.project, shortName: ref.shortName, extension: ref.extension, folder: '', position: this._positionToolbar }; mls.events.fire([2], ['FileAction'], JSON.stringify(cmdOpen), 0); }; li.appendChild(a); this.list.appendChild(li); }); } showDevDocJson() { if (this.menu.setMode) this.menu.setMode('editor'); this.actualResultMode = 'devDoc'; this.setModelLanguage(this.resultsLanguages.devDoc, this.results.devDoc); return true; } delay(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); } async loadService() { const editor = mls.l2.editor.editors[this.confInvert]; if (!editor) await this.delay(3000); if (!editor) this._div1.setAttribute('error', `Config editor : ${this.confInvert} is not configured, try again!`); if (editor) { const { project, shortName } = editor; await this.getCompileResults(shortName, project); this.actualFileName = shortName; this.actualFileProject = project; } if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this.createEditor(); this.setInitialModelProdJS(''); this.c2['mlsEditor'] = this._ed1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); if (typeof this._div1['layout'] === 'function') this._div1['layout'](); } if (this.hasError) this.openErrorMode(); else if (this.actualResultMode === 'refs') this.createListRefs(); else if (this.actualResultMode === 'devDocPage') this.openResultsDocsPageMode(); else if (this.isReferenceOpen) this.openReferenceMode(); else if (this.isHelpAssistant) this.openHelpAssistantMode(); else this.openActualResultMode(); } async openActualResultMode() { this.setModelLanguage(this.resultsLanguages[this.actualResultMode], this.results[this.actualResultMode]); } openErrorMode() { this.setModelLanguage(this.resultsLanguages.errors, this.results.errors); } openResultsDocsPageMode() { this.actualResultMode = 'devDocPage'; this.devDocContainer.setAttribute('force', 'true'); this.devDocContainer.setAttribute('path', '_100529_service_results_doc'); } openReferenceMode() { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink('opReferences'); this.isReferenceOpen = false; } openHelpAssistantMode() { this.openMenuItem('opAssistant'); this.isHelpAssistant = false; } openMenuItem(op) { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink(op); } } _100529_service_results.details = [, , , , { name: '&#xf142; Results', ref: '_100529_service_results' }, ]; l2_html._100529_service_results = _100529_service_results; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_save extends l2_html.BaseService { constructor(el, level, position) { super(); this.onClickLink = (op) => { if (op === 'opSave') return this.onSave(); if (op === 'opDefault') return this.onDefault(); if (op === 'opAbout') return this.showAbout(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Save', actions: { opSave: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, }; this.onMLSEvents = async (ev) => { if (ev.type !== 'FileAction') return; const fileAction = JSON.parse(ev.desc); if (!['changed', 'delete', 'new', 'rename'].includes(fileAction.action)) return; if (this.isServiceVisible()) { this.loadService(); } if (!this.myparent || !this.myparent['toogleBadge']) return; this.myparent['toogleBadge'](true, '_100529_service_save'); }; if (el) el['mlsWidget'] = this; this._div1 = el; this.level = +level; this.position = position || 'left'; this._div1 = el; this.myparent = el ? el.closest('mls-toolbar-100529') : undefined; mls.events.addListener(2, 'FileAction', this.onMLSEvents.bind(this)); mls.events.addListener(3, 'FileAction', this.onMLSEvents.bind(this)); mls.events.addListener(5, 'ProjectSelected', (ev) => { this.loadService(); }); this.verifyExitFileChanged(); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } clearChangeds() { if (!this.myparent || !this.myparent['toogleBadge']) return; this.myparent['toogleBadge'](false, '_100529_service_save'); } verifyExitFileChanged() { if (!mls.stor.files) return; const array = Object.keys(mls.stor.files); let exist = false; array.forEach((i) => { const f = mls.stor.files[i]; if (!f) return; if (f.project === mls.actual[5].project && f.status !== 'nochange') exist = true; }); if (!exist) return; if ((!this.myparent || !this.myparent['toogleBadge'])) return; this.myparent['toogleBadge'](true, '_100529_service_save'); } isServiceVisible() { const container = this._div1.closest('mls-toolbar-content-100529'); if (!container) return false; const serviceName = container.getAttribute('servicename'); if (serviceName !== this.constructor.name) return false; return true; } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_save</h2>' + '<hr>' + '<p>Widget Source: https://multilevelstudio.com/#/l2/_100529_service_save</p>' + '<p>Page Source: https://multilevelstudio.com/#/l4/_100529_service_save</p>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } onSave() { this.c2.setAttribute('path', '_100529_service_save'); return true; } onDefault() { this.c2.setAttribute('path', '_100529_service_save'); return true; } onExec() { this.loadService(); return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.c2.style.width = '100%'; this.c2.style.height = '100%'; this.c2.setAttribute('force', 'true'); } else { this.c2.setAttribute('path', '_100529_service_save'); } } get confE() { return `l${this.level}_${this.position}`; } getUri(shortFN) { return window['monaco'].Uri.parse(`file://server/${shortFN}.ts`); } } _100529_service_save.details = [, , , { name: '&#xf15b; Save', ref: '' }, ]; l2_html._100529_service_save = _100529_service_save; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_select_project extends l2_html.BaseService { constructor(el, level, position) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.showList(); if (op === 'opAbout') return this.showAbout(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Your Projects', actions: { opDefault: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, }; if (el) el['mlsWidget'] = this; this._div1 = el; this.level = level; this.position = position || 'left'; this._div1 = el; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); } showList() { return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.c2.setAttribute('force', 'true'); } this.c2.setAttribute('path', '_100529_service_select_project'); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About this Service</h1>' + '<h2>Service Name: _100529_service_select_project</h2>' + '<hr>' + '<a target="_blank" href="https://multilevelstudio.com/#/l2/_100529_service_select_project"> Widget Source</a > ' + '<br>' + '<a target="_blank" href="https://multilevelstudio.com/#/l4/_100529_service_select_project"> Widget L4 </a>' + '<hr>' + '<br>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } } _100529_service_select_project.details = [, , , { name: '&#xf15b; ServiceList', ref: '' }, ]; l2_html._100529_service_select_project = _100529_service_select_project; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_selectds extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opSelect') return this.showHelper(); if (op === 'opSelect2') return this.showHelper2(); if (op === 'opAdd') return this.showAdd(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Select Design System', actions: { opAbout: 'About', opSelect: 'Select', opAdd: 'Add', }, actionDefault: 'opSelect2', setMode: undefined, onClickLink: this.onClickLink, getLastMode: undefined, updateTitle: undefined }; this._div1 = el; this.level = +level; if (el) el['mlsWidget'] = this; mls.events.addEventListener([3], ['DSChanged'], (ev) => { this.toogleSaveNotification(); }); mls.events.addEventListener([5], ['ProjectSelected'], (ev) => { this.loadService(); }); return this; } toogleSaveNotification() { const serviceToolbar = this._div1.closest('mls-toolbar-100529'); if (serviceToolbar) serviceToolbar.toogleBadge(true, '_100529_service_save'); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onServiceClosed() { } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); } onDsChanged(project) { const params = { emitter: 'left', value: project }; } showAbout() { if (this.menu.setMode) this.menu.setMode('editor'); this.c2.setAttribute('path', '_100529_service_selectds_about'); return true; } showHelper() { if (this.menu.setMode) this.menu.setMode('initial'); return true; } showHelper2() { this.c2.setAttribute('path', '_100529_service_selectds'); this.closePreview(); return true; } showAdd() { if (this.menu.setMode) this.menu.setMode('editor'); this.c2.setAttribute('path', '_100529_service_selectds_add'); return true; } openMenu(op) { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink(op); } closePreview() { const params2 = { service: [], isComponent: false }; mls.events.fire([this.level], ['DSStyleUnSelected'], JSON.stringify(params2), 0); } loadService() { this._div1.innerHTML = ''; this._div1.style.height = '100%'; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } _100529_service_selectds.details = [, , , , { name: '&#xf142; Select Ds', ref: '_100529_service_selectds' }, ]; l2_html._100529_service_selectds = _100529_service_selectds; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_start extends l2_html.BaseHtml { } l2_html._100529_service_start = _100529_service_start; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opResultCss') return this.showResultCss(); if (op === 'opStyle') return this.showStyle(); if (op === 'opStyle2') return this.showStyle2(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Styles', actions: { opAbout: 'About', opStyle: 'Styles Geral', opResultCss: 'Result CSS', }, actionDefault: 'opStyle2', setMode: undefined, onClickLink: this.onClickLink, }; this.isComponent = false; this.componentName = ''; this.isStyleRename = false; this.isSetStyle = false; this.lastEditorInfo = { line: 0, content: '' }; this.models = { style: undefined, results: undefined }; this.defaultServices = { componentStyle: '', globalStyle: '_100529_service_styles_preview' }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; this.init(); } onServiceClick(ev) { this.isComponent = ev['isComponent'] === true; this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } init() { this.setInitialModels('', 'style'); this.setInitialModels('', 'results'); this.setEvents(); } setEvents() { mls.events.addEventListener([this.level], ['DSStyleChanged'], (ev) => { this.onDSStyleChanged(ev); }); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } showStyle() { if (this.menu.setMode) this.menu.setMode('initial'); return this.showStyle2(); } showAbout() { if (!this.aboutDiv) { this.aboutDiv = document.createElement('mls-load-page-l4-100529'); this.aboutDiv.setAttribute('path', '_100529_service_styles_about'); } if (!this.isComponent) this.c3.style.display = 'none'; if (this.menu.setMode) this.menu.setMode('page', this.aboutDiv); return true; } showResultCss() { const modelResults = this.models['results']; this._ed1.setModel(modelResults); if (this.menu.setMode) this.menu.setMode('editor'); this.c3.style.display = 'none'; this._div1['layout'](); this._ed1.updateOptions({ readOnly: true }); modelResults.setValue('Compiling...'); this.dsInstance.components.getCSS(this.componentName).then((result) => { modelResults.setValue(result); }).catch((err) => { modelResults.setValue(err); }); return true; } createEditor() { this._ed1 = monaco.editor.create(this.c2, mls.editor.conf['style_config']); } getUri(shortFN) { _100529_service_styles.modelCount = _100529_service_styles.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_styles.modelCount}.ts`); } setInitialModels(src, model) { const uri = this.getUri('l3_styles'); this.models[model] = monaco.editor.getModel(uri); if (this.models[model]) this.models[model].setValue(src); else this.models[model] = monaco.editor.createModel(src, 'less', uri); this.setModelAPI(); } setModelAPI() { const modelStyle = this.models['style']; modelStyle.add = (text, lineNumber, refLine) => { let lineToChange = lineNumber; const blockInfo = modelStyle.getBlockInfo(); if (!lineToChange) { const newLineNumber = refLine === blockInfo.endLine ? refLine : refLine + 1; const columnStartRefLine = modelStyle['getLineIndentColumn'](refLine); const newLine = { range: new monaco.Range(newLineNumber, 1, newLineNumber, 1), text: ' '.repeat(columnStartRefLine - 1) + '\n', forceMoveMarkers: true }; this._ed1.executeEdits('style', [newLine]); lineToChange = newLineNumber; } const columnStart = modelStyle['getLineIndentColumn'](lineToChange); const columnEnd = modelStyle.getLineLength(lineToChange) + 1; const range = new monaco.Range(lineToChange, columnStart, lineToChange, columnEnd); this._ed1.executeEdits('style', [{ range, text }]); const endLineLength = modelStyle.getLineLength(blockInfo.endLine) + 1; const rangeBlock = new monaco.Range(blockInfo.startLine, 1, blockInfo.endLine, endLineLength); modelStyle.removeBlankLines(rangeBlock); }; modelStyle.changeBlock = (key, value, comment) => { const blockLess = modelStyle.getLessBlock(); const { lineNumber } = this._ed1.getPosition(); const text = `${key}: ${value};//${comment}`; const objChanged = { lineChange: undefined, prop: key, newValue: value, oldValue: '' }; blockLess.lines.forEach((item) => { if (item.key === key) { objChanged.lineChange = item.line; objChanged.oldValue = item.value; } }); if (!objChanged.newValue) { const linewithSameKey = blockLess.lines.find((line) => line.key === objChanged.prop); if (!linewithSameKey) return; modelStyle.removeLine(linewithSameKey.line); return; } if (!objChanged.lineChange) { modelStyle.add(text, objChanged.lineChange, lineNumber); return; } modelStyle.add(text, objChanged.lineChange); }; modelStyle.removeLine = (lineNumber) => { const columnEnd = modelStyle.getLineLength(lineNumber) + 1; const columnStart = modelStyle['getLineIndentColumn'](lineNumber); const range = new monaco.Range(lineNumber, columnStart, lineNumber, columnEnd); this._ed1.executeEdits('', [{ range, text: null }]); }; modelStyle.removeBlankLines = (range) => { const text = this._ed1.getModel().getValueInRange(range); const newText = text.replace(/^\s*[\r\n]/gm, ''); const edit = { range, text: newText }; this._ed1.executeEdits('style', [edit]); }; modelStyle.getLessBlock = () => { const { isValidBlock, endLine, startLine, selector } = modelStyle.getBlockInfo(); if (!isValidBlock) return undefined; const rc = { lines: [], selector }; const lines = modelStyle.getLinesContent(); let bracketsOpenCount = 0; let bracketsCloseCount = 0; for (let i = startLine - 1; i <= endLine - 1; i++) { let line = lines[i]; line = line.replace(/\/\/.*/, ''); const isInBlockComment = modelStyle.isInCommentBlock(lines, i + 1); if (isInBlockComment) continue; if (line.indexOf('{') >= 0) bracketsOpenCount += 1; if (line.indexOf('}') >= 0) bracketsCloseCount += 1; if ((bracketsOpenCount - bracketsCloseCount) > 1) continue; const rules = line.split(';'); rules.forEach((rule) => { if (!rule) return; const item = modelStyle.convertRuleToKeyValue(rule); if (!item) return; item.line = i + 1; rc.lines.push(item); }); } return rc; }; modelStyle.getHelperNameByLine = (lineNumber) => { const lineContent = modelStyle.getLineContent(lineNumber); const [, helperName] = lineContent.split('//'); return helperName; }; modelStyle.isCursorInBlockValid = () => { const blockInfo = modelStyle.getBlockInfo(); return blockInfo.isValidBlock; }; modelStyle.getBlockInfoByLine = (lineNumber) => { const lines = modelStyle.getLinesContent(); const startBlockInfo = modelStyle.haveStartBlock(lines, lineNumber); const endBlockInfo = modelStyle.haveEndBlock(lines, lineNumber); const rc = { selector: '', endLine: endBlockInfo.line, hasEndBlock: endBlockInfo.haveEndBlock, hasStartBlock: startBlockInfo.haveStartBlock, startLine: startBlockInfo.line, isValidBlock: startBlockInfo.haveStartBlock && endBlockInfo.haveEndBlock }; if (startBlockInfo.line > 0 && rc.isValidBlock) { const lineStartContent = modelStyle.getLineContent(startBlockInfo.line); rc.selector = lineStartContent.replace(/\/\/.*/, '').replace(/\{.*$/, '').trim(); } return rc; }; modelStyle.getBlockInfo = () => { const { lineNumber } = this._ed1.getPosition(); const rc = modelStyle.getBlockInfoByLine(lineNumber); return rc; }; modelStyle.isInCommentBlock = (lines, lineNumber) => { let countStartBlockComment = 0; let countEndBlockComment = 0; for (let i = 0; i <= lineNumber - 1; i++) { const line = lines[i]; if (line.indexOf('/*') >= 0) countStartBlockComment += 1; if (line.indexOf('*/') >= 0 && i !== lineNumber - 1) countEndBlockComment += 1; } const isInBlockComment = countStartBlockComment > countEndBlockComment; return isInBlockComment; }; modelStyle.haveStartBlock = (lines, lineNumber) => { const rc = { haveStartBlock: false, line: -1 }; let bracketsCount = 1; let actualLine = lines[lineNumber - 1]; if (actualLine.trim().startsWith('//')) return rc; actualLine = actualLine.replace(/\/\/.*/, '').replace(/\/\*.*/, ''); if (actualLine.indexOf('{') >= 0) { rc.haveStartBlock = true; rc.line = lineNumber; return rc; } if (actualLine.indexOf('}') >= 0) bracketsCount -= 1; const isInBlockComment = modelStyle.isInCommentBlock(lines, lineNumber); if (isInBlockComment) return rc; for (let i = lineNumber - 1; i >= 0; i--) { let line = lines[i]; line = line.replace(/\/\/.*/, ''); const lineInCommentBlock = modelStyle.isInCommentBlock(lines, i + 1); if (line.indexOf('}') >= 0 && !lineInCommentBlock) bracketsCount += 1; if (line.indexOf('{') >= 0 && !lineInCommentBlock) bracketsCount -= 1; if (bracketsCount === 0) { rc.haveStartBlock = true; rc.line = i + 1; break; } } return rc; }; modelStyle.haveEndBlock = (lines, lineNumber) => { const rc = { haveEndBlock: false, line: -1 }; let bracketsCount = 1; let actualLine = lines[lineNumber - 1]; if (actualLine.trim().startsWith('//')) return rc; actualLine = actualLine.replace(/\/\/.*/, '').replace(/\/\*.*/, ''); if (actualLine.indexOf('}') >= 0) { rc.haveEndBlock = true; rc.line = lineNumber; return rc; } if (actualLine.indexOf('{') >= 0) bracketsCount -= 1; const isInBlockComment = modelStyle.isInCommentBlock(lines, lineNumber); if (isInBlockComment) return rc; for (let i = lineNumber - 1; i <= lines.length - 1; i++) { let line = lines[i]; line = line.replace(/\/\/.*/, ''); const lineInCommentBlock = modelStyle.isInCommentBlock(lines, i + 1); if (line.indexOf('{') >= 0 && !lineInCommentBlock) bracketsCount += 1; if (line.indexOf('}') >= 0 && !lineInCommentBlock) bracketsCount -= 1; if (bracketsCount === 0) { rc.haveEndBlock = true; rc.line = i + 1; break; } } return rc; }; modelStyle.convertRuleToKeyValue = (content) => { const blockLine = {}; const [key, value] = content.split(':'); if (!key || !value) return undefined; blockLine.key = key.trim(); blockLine.value = value.trim(); return blockLine; }; } async setStyle(styleLess) { this.isSetStyle = true; const lessTokens = await this.getTokens(); let textByRange = styleLess; const content = `${textByRange.trim()}\n\n//Start Less Tokens\n${lessTokens}\n//End Less Tokens\n`; const range = new monaco.Range(0, 0, this._ed1.getModel().getLineCount() + 1, 0); this._ed1.updateOptions({ readOnly: false }); this._ed1.executeEdits('style', [{ range, text: content.trim() }]); this._ed1.setScrollPosition({ scrollTop: 0 }); const position = new monaco.Position(0, 0); this._ed1.setPosition(position); } getIntervalLinesReadOnly() { const [startLine] = this._ed1.getModel().findMatches(`//Start Less Tokens`, true, false, false, null, true); const [endLine] = this._ed1.getModel().findMatches(`//End Less Tokens`, true, false, false, null, true); return { end: endLine ? endLine.range.startLineNumber : undefined, start: startLine ? startLine.range.startLineNumber : undefined }; } onExec() { this.loadService(); this.rightServiceOpened = this.getServiceRightOpened(); } changeEditor(lines, helper) { const modelStyle = this.models['style']; lines.forEach((line) => { modelStyle.changeBlock(line.key, line.value, helper); }); } getParamsServices() { const serviceDef = this.isComponent ? this.defaultServices.componentStyle : this.defaultServices.globalStyle; const params = { service: [serviceDef], isComponent: this.isComponent, component: this.componentName }; return params; } showStyle2() { if (!this.isComponent) this.c3.style.display = 'none'; this._div1['layout'](); this._ed1.setModel(this.models['style']); const modelStyle = this.models['style']; this._ed1.updateOptions({ readOnly: false }); this.getStyle().then((styleGlobal) => { if (this.isComponent) return; this.setStyle(styleGlobal); }); this._ed1.onDidChangeCursorPosition((e) => { const actualModel = this._ed1.getModel(); if (actualModel !== this.models['style']) return; const { lineNumber } = e.position; const content = modelStyle.getLineContent(lineNumber); const isReadOnlyArea = this.isReadOnlyArea(lineNumber); this._ed1.updateOptions({ readOnly: isReadOnlyArea }); if (isReadOnlyArea) { const serviceDef = this.isComponent ? this.defaultServices.componentStyle : this.defaultServices.globalStyle; const params = this.getParamsServices(); mls.events.fire([this.level], ['DSStyleUnSelected'], JSON.stringify(params), 0); this.openServiceHelper(serviceDef); this.lastEditorInfo.content = content; this.lastEditorInfo.line = lineNumber; return; } if (this.timeoutCursorChangesEditorStyle) clearTimeout(this.timeoutCursorChangesEditorStyle); this.timeoutCursorChangesEditorStyle = setTimeout(() => { this.onCursorChange(lineNumber, content); }, 500); }); this._ed1.getModel().onDidChangeContent((event) => { if (this.timeoutChangesEditorStyle) clearTimeout(this.timeoutChangesEditorStyle); this.timeoutChangesEditorStyle = setTimeout(() => { this.onEditorChange(false); }, 1000); }); return true; } async onEditorChange(isGet) { this.clearErrors(); if (this.isSetStyle) { this.isSetStyle = false; return; } const modelStyle = this.models['style']; const value = modelStyle.getLessBlock(); const less = modelStyle.getValue().trim(); const rc = { emitter: 'left', helper: this.rightServiceOpened || this.getServiceRightOpened(), value: (value === null || value === void 0 ? void 0 : value.lines) || [], less, selector: (value === null || value === void 0 ? void 0 : value.selector) || '', isComponent: this.isComponent, origemLevel: 3 }; if (!isGet) { const regex = /\/\/Start Less Tokens[\s\S]*?\/\/End Less Tokens/g; rc.less = less.replace(regex, ''); } if (!this.isComponent && !isGet) { const cssItem = this.dsInstance.css.list['definitions']; if (!cssItem) return; try { await cssItem.setContent(rc.less); } catch (err) { const errorInfo = this.extractErrorDetails(err.message); if (errorInfo) this.setErrorOnEditor(errorInfo); } } if (this.isComponent) { rc.less = await this.onChangeEditorIfComponent(rc); } mls.events.fire([2], ['DSStyleChanged'], JSON.stringify(rc)); mls.events.fire([3], ['DSStyleChanged'], JSON.stringify(rc), 300); } async onAfterAdd() { const style = this.c3.styles[this.c3.value]; const less = await style.getStyleLessIO(); this.onChangeWidgetStyle(less); } async onChangeEditorIfComponent(params) { const style = this.c3.styles[this.c3.value]; if (!style) return params.less; const isFirstLineCorrect = this.checkIfFirtsLineCorrect(params.less, style.stylename); if (!isFirstLineCorrect) { this._div1.setAttribute('error', 'Invalid first line, must be start with component tag name my-tag.mystyle'); throw new Error('Invalid first line'); } if (this.isStyleRename) { params.less = await this.renameStyleComponent(params.less, style); return params.less; } await this.saveStyleLess(params.less, style); const mfile = mls.l2.editor['mfiles'][this.componentName]; if (mfile) { mfile.compilerResults.modelNeedCompile = true; await mls.l2.editor.getCompilerResultTS(mfile, true); const enhancement = await mls.l2.enhancement.getEnhancementInstance(mfile); await enhancement.onAfterChange(mfile); const searchString = 'css'; const replacementString = ''; const regex = new RegExp(searchString, 'g'); const modifiedString = mfile.compilerResults['cacheVersion'].replace(regex, replacementString); mfile.compilerResults['cacheVersion'] = modifiedString + 'css' + Math.floor(Math.random() * (1000 - 9999999 + 1)) + 9999999; await mls.stor.cache['AddMfileIfNeed'](mfile); } return params.less; } async saveStyleLess(less, style) { const validComponentStyle = this.checkIfValidComponentStyle(less); if (!validComponentStyle) return; try { await style.setStyleLessIO(less); } catch (err) { const errorInfo = this.extractErrorDetails(err.message); if (errorInfo) this.setErrorOnEditor(errorInfo); } } async renameStyleComponent(less, style) { this.isStyleRename = false; const allLines = less.split('\n'); allLines[0] = allLines[0].replace(this.oldStyleName, style.stylename); const newless = allLines.join('\n'); try { await style.setStyleLessIO(newless); await this.setStyle(newless); return newless; } catch (err) { const errorInfo = this.extractErrorDetails(err.message); if (errorInfo) this.setErrorOnEditor(errorInfo); return less; } } checkIfValidComponentStyle(less) { let bracketsOpenCount = 0; let bracketsCloseCount = 0; let isvalid = true; let lineStartInvalid; const lines = less.split('\n'); const modelStyle = this.models['style']; for (let i = 0; i <= lines.length - 1; i++) { let line = lines[i]; line = line.replace(/\/\/.*/, ''); const isInBlockComment = modelStyle.isInCommentBlock(lines, i + 1); if (isInBlockComment) continue; if (line.indexOf('{') >= 0) bracketsOpenCount += 1; if (line.indexOf('}') >= 0) bracketsCloseCount += 1; if (bracketsOpenCount > 0 && bracketsOpenCount === bracketsCloseCount) { lineStartInvalid = i + 2; break; } } if (lineStartInvalid) { for (let i = lineStartInvalid - 1; i <= lines.length - 1; i++) { let line = lines[i]; line = line.replace(/\/\/.*/, ''); if (line.indexOf('{') >= 0) { isvalid = false; const errorInfo = { column: 0, errorMessage: 'This block is invalid, in style component use once this first block', line: i + 1 }; this.setErrorOnEditor(errorInfo); break; } } } return isvalid; } checkIfFirtsLineCorrect(less, stylename) { const [firstLine] = less.split('\n'); const tagName = this.getWidgetTagName(this.componentName); if (stylename === this.componentName.substr(8, this.componentName.length)) { if (!this.isStyleRename && !firstLine.startsWith(tagName)) return false; return true; } if (!this.isStyleRename && !firstLine.startsWith(tagName + '.' + stylename)) return false; return true; } extractErrorDetails(errorString) { const pattern = /Error [A-Za-z]+: [A-Za-z]+: (.+) on line (\d+), column (\d+)/; const match = pattern.exec(errorString); if (match) { const errorMessage = match[1]; const line = parseInt(match[2], 10); const column = parseInt(match[3], 10); return { errorMessage, line, column }; } return null; } clearErrors() { const model = this._ed1.getModel(); monaco.editor.setModelMarkers(model, 'markerSource', []); } setErrorOnEditor(info) { const markerOptions = { severity: monaco.MarkerSeverity.Error, message: info.errorMessage, startLineNumber: info.line, startColumn: info.column, endLineNumber: info.line, endColumn: info.column, }; const model = this._ed1.getModel(); monaco.editor.setModelMarkers(model, 'markerSource', [markerOptions]); } getServiceRightOpened() { const toolbar = this._div1.closest('mls-toolbar-100529'); const nextToolbar = toolbar.nextElementSibling.nextElementSibling; const nextToolbarItemSelected = nextToolbar.querySelector('mls-toolbar-item-100529 .toolbar-item.selected'); const nextToolbarRef = nextToolbarItemSelected ? nextToolbarItemSelected.parentElement.getAttribute('ref') : ''; return nextToolbarRef; } onCursorChange(lineNumber, content) { const modelStyle = this.models['style']; if (lineNumber === this.lastEditorInfo.line && content === this.lastEditorInfo.content) return; this.lastEditorInfo.content = content; this.lastEditorInfo.line = lineNumber; const serviceDef = this.isComponent ? this.defaultServices.componentStyle : this.defaultServices.globalStyle; let helperName = serviceDef; const validPosition = modelStyle.isCursorInBlockValid(); const params = { service: [serviceDef], isComponent: this.isComponent, component: this.componentName }; if (!validPosition) mls.events.fire([this.level], ['DSStyleUnSelected'], JSON.stringify(params), 0); else { params.service = []; mls.events.fire([this.level], ['DSStyleSelected'], JSON.stringify(params), 0); helperName = modelStyle.getHelperNameByLine(lineNumber); } this.openServiceHelper(helperName); } isReadOnlyArea(lineNumber) { const { end, start } = this.getIntervalLinesReadOnly(); if (!end || !start) return false; if (lineNumber >= start && lineNumber <= end) return true; return false; } isReadOnlyAreaIfIsComponent(lineNumber) { return false; } async getStyle() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; this.dsInstance = mls.l3.getDSInstance(project, mode); await this.dsInstance.init(); const cssItem = this.dsInstance.css.list['definitions']; if (!cssItem) return ''; const content = await cssItem.getContent(); return content; } async getTokens() { const { list } = this.dsInstance.tokens; const tokens = []; Object.keys(list).forEach((tok) => { tokens.push(list[tok]); }); const tokensColors = tokens.filter((tok) => tok.category === 'color' && !tok.key.startsWith('_dark-')); const tokensTypo = tokens.filter((tok) => tok.category === 'typography'); const tokensCustom = tokens.filter((tok) => tok.category === 'custom'); const strColors = tokensColors.map((item) => `@${item.key}: ${item.value};`).join('\n'); const strTypo = tokensTypo.map((item) => `@${item.key}: ${item.value};`).join('\n'); const strCustom = tokensCustom.map((item) => `@${item.key}: ${item.value};`).join('\n'); const resumeTokens = ['// Tokens Colors', strColors, '// Tokens Typography', strTypo, '//Tokens Custom', strCustom].join('\n'); return resumeTokens; } openServiceHelper(helperName) { this.rightServiceOpened = helperName; const rc = { emitter: 'left', helper: helperName, }; mls.events.fire([this.level], ['DSStyleCursorChanged'], JSON.stringify(rc)); } async onDSStyleChanged(obj) { const desc = JSON.parse(obj.desc); if (desc.emitter === 'left') return; if (desc.emitter === 'right-get') { this.onEditorChange(true); return; } if (desc.isComponent) { mls.actual[3].mode = 0; this.isComponent = true; this.defaultServices.componentStyle = desc.helper; const { widget, origemLevel } = desc; const itemStyles = this.getMyToolbarItem(); if (!itemStyles || !widget) return; if (origemLevel === 2) this.openNavLevel3(); this.componentName = widget; const ev = new Event('click'); ev['isComponent'] = true; itemStyles.dispatchEvent(ev); this.c3.setAttribute('component', widget); this.c3.onChange = async (less) => this.onChangeWidgetStyle(less); this.c3.onDelete = async (style) => this.onDeleteWidgetStyle(style); this.c3.onAdd = async (value) => this.onAddWidgetStyle(value); this.c3.onAfterAdd = async () => this.onAfterAdd(); this.c3.onRename = async (style, value) => this.onRenameWidgetStyle(style, value); const params = this.getParamsServices(); mls.events.fire([this.level], ['DSStyleSelected'], JSON.stringify(params), 0); this.openServiceHelper(this.defaultServices.componentStyle); return; } this.changeEditor(desc.value, desc.helper); } async onChangeWidgetStyle(less) { await this.setStyle(less); } async onAddWidgetStyle(value) { this._div1.setAttribute('error', ''); const tagName = this.getWidgetTagName(this.componentName); const styleName = value; const less = `${tagName}.${styleName} { // don't change this line \n \t// here your style \n}`; try { await this.dsInstance.components.styles.add(this.componentName, styleName, less); } catch (err) { this._div1.setAttribute('error', err.message); } } async onDeleteWidgetStyle(style) { this._div1.setAttribute('error', ''); try { await style.setStyleLessIO(null); const rc = { emitter: 'left', helper: this.rightServiceOpened || this.getServiceRightOpened(), value: [], less: '', selector: '', isComponent: this.isComponent, origemLevel: 3 }; mls.events.fire([this.level], ['DSStyleChanged'], JSON.stringify(rc)); } catch (err) { this._div1.setAttribute('error', err.message); } } async onRenameWidgetStyle(style, value) { this._div1.setAttribute('error', ''); try { this.isStyleRename = true; this.oldStyleName = style.stylename; await this.dsInstance.components.styles.rename(this.componentName, style.stylename, value); this.onEditorChange(false); } catch (err) { this._div1.setAttribute('error', err.message); } } getWidgetTagName(widgetName) { const parts = widgetName.split('_'); parts.shift(); const project = parts.shift() || ''; let formattedString = `${parts.join('-')}-${project}`; formattedString = formattedString.replace(/([^A-Z-]|^)([A-Z])/g, (_, prefix, letter) => `${prefix}-${letter.toLowerCase()}`).toLowerCase(); return formattedString; } openNavLevel3() { const nav = this._div1.closest('mls-nav-100529'); const indexNavL3 = '4'; if (!nav) return; nav.setAttribute('tabindexactive', indexNavL3); } loadService() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; if (!this._ed1) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c3 = document.createElement('mls-l3-styles-select-100533'); this.c3.setAttribute('mheight', '50'); this.c3.setAttribute('project', project.toString()); this.c3.setAttribute('dsindex', mode.toString()); if (!this.isComponent) this.c3.style.display = 'none'; this.c2 = document.createElement('mls-editor-100529'); this.createEditor(); this._ed1.setModel(this.models['style']); this.c2['mlsEditor'] = this._ed1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c3); this._div1.appendChild(this.c2); if (typeof this._div1['layout'] === 'function') this._div1['layout'](); } else { this._ed1.setModel(this.models['style']); if (this.menu.setMode) this.menu.setMode('initial'); if (!this.isComponent && this.c3) this.c3.style.display = 'none'; } const serviceDef = this.isComponent ? this.defaultServices.componentStyle : this.defaultServices.globalStyle; const params = { service: [serviceDef], isComponent: this.isComponent, component: this.componentName }; const params2 = { service: [], isComponent: this.isComponent, component: this.componentName }; mls.events.fire([this.level], ['DSStyleUnSelected'], JSON.stringify(params2), 0); mls.events.fire([this.level], ['DSStyleSelected'], JSON.stringify(params), 100); this.openServiceHelper(serviceDef); } reset() { const params = { service: [], isComponent: this.isComponent, component: this.componentName }; mls.events.fire([this.level], ['DSStyleUnSelected'], JSON.stringify(params), 0); this.isComponent = false; } } _100529_service_styles.details = [, , , , { name: '&#xf142; Tokens', ref: '_100532_service_tokens' }, ]; l2_html._100529_service_styles = _100529_service_styles; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_background extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opBackground') return this.showLibs(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Background', actions: { opAbout: 'About', opBackground: 'Background', }, actionDefault: 'opBackground', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemBg = this.getMyToolbarItem(); if (!itemBg) return; itemBg.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemBg = this.getMyToolbarItem(); if (!itemBg) return; itemBg.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemBg = this.getMyToolbarItem(); if (!itemBg || this._div1.getAttribute('visible') === 'true') return; itemBg.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Background</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showLibs() { this.menu.title = 'Background'; this.c2.setAttribute('path', '_100529_service_styles_background'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_background.details = [, , , , { name: '&#xf142; Background', ref: '_100532_service_styles_background' }, ]; l2_html._100529_service_styles_background = _100529_service_styles_background; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_border extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opBorder') return this.showBorderHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Border', actions: { opAbout: 'About', opBorder: 'Border', }, actionDefault: 'opBorder', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemBorder = this.getMyToolbarItem(); if (!itemBorder) return; itemBorder.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemBorder = this.getMyToolbarItem(); if (!itemBorder) return; itemBorder.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemBorder = this.getMyToolbarItem(); if (!itemBorder || this._div1.getAttribute('visible') === 'true') return; itemBorder.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Border</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showBorderHelper() { this.menu.title = 'Border'; this.c2.setAttribute('path', '_100529_service_styles_border'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_border.details = [, , , , { name: '&#xf142; Border', ref: '_100532_service_styles_border' }, ]; l2_html._100529_service_styles_border = _100529_service_styles_border; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_clippath extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opClipPath') return this.showClipPathHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'ClipPath', actions: { opAbout: 'About', opClipPath: 'ClipPath', }, actionDefault: 'opClipPath', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemClip = this.getMyToolbarItem(); if (!itemClip) return; itemClip.setAttribute('mode', 'A'); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemClip = this.getMyToolbarItem(); if (!itemClip) return; itemClip.setAttribute('mode', 'H'); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemClip = this.getMyToolbarItem(); if (!itemClip || this._div1.getAttribute('visible') === 'true') return; itemClip.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Clip Path</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showClipPathHelper() { this.menu.title = 'ClipPath'; this.c2.setAttribute('path', '_100529_service_styles_clippath'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } reset() { } } _100529_service_styles_clippath.details = [, , , , { name: '&#xf142; ClipPath', ref: '_100532_service_styles_clippath' }, ]; l2_html._100529_service_styles_clippath = _100529_service_styles_clippath; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_columns extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opColumns') return this.showColumnsHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Columns', actions: { opAbout: 'About', opColumns: 'Columns', }, actionDefault: 'opColumns', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemColumns = this.getMyToolbarItem(); if (!itemColumns) return; itemColumns.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemColumns = this.getMyToolbarItem(); if (!itemColumns) return; itemColumns.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemColumns = this.getMyToolbarItem(); if (!itemColumns || this._div1.getAttribute('visible') === 'true') return; itemColumns.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Columns</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showColumnsHelper() { this.menu.title = 'Columns'; this.c2.setAttribute('path', '_100529_service_styles_columns'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_columns.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_columns = _100529_service_styles_columns; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_filter extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opFilter') return this.showFilterHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Filter', actions: { opAbout: 'About', opFilter: 'Filter', }, actionDefault: 'opFilter', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemFilter = this.getMyToolbarItem(); if (!itemFilter) return; itemFilter.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemFilter = this.getMyToolbarItem(); if (!itemFilter) return; itemFilter.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemFilter = this.getMyToolbarItem(); if (!itemFilter || this._div1.getAttribute('visible') === 'true') return; itemFilter.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Filter</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showFilterHelper() { this.menu.title = 'Filter'; this.c2.setAttribute('path', '_100529_service_styles_filter'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_filter.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_filter = _100529_service_styles_filter; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_flex extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opFlex') return this.showFlexHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Flex', actions: { opAbout: 'About', opFlex: 'Flex', }, actionDefault: 'opFlex', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemFlex = this.getMyToolbarItem(); if (!itemFlex) return; itemFlex.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemFlex = this.getMyToolbarItem(); if (!itemFlex) return; itemFlex.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemFlex = this.getMyToolbarItem(); if (!itemFlex || this._div1.getAttribute('visible') === 'true') return; itemFlex.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Flex</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showFlexHelper() { this.menu.title = 'Flex'; this.c2.setAttribute('path', '_100529_service_styles_flex'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } reset() { } } _100529_service_styles_flex.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_flex = _100529_service_styles_flex; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_flex_item extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opFlexItem') return this.showFlexItemHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'FlexItem', actions: { opAbout: 'About', opFlexItem: 'FlexItem', }, actionDefault: 'opFlexItem', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemFlexItem = this.getMyToolbarItem(); if (!itemFlexItem) return; itemFlexItem.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemFlexItem = this.getMyToolbarItem(); if (!itemFlexItem) return; itemFlexItem.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemFlexItem = this.getMyToolbarItem(); if (!itemFlexItem || this._div1.getAttribute('visible') === 'true') return; itemFlexItem.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About FlexItem</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showFlexItemHelper() { this.menu.title = 'FlexItem'; this.c2.setAttribute('path', '_100529_service_styles_flex_item'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_flex_item.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_flex_item = _100529_service_styles_flex_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_preview extends l2_html.BaseService { constructor(el, level) { super(); this.state = { readOnly: false, index: undefined, project: undefined }; this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opPreview') return this.showPreview(); if (op === 'opEditor') return this.showEditor(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Preview', actions: { opAbout: 'About', opPreview: 'Preview', opEditor: 'Editor', }, actionDefault: 'opPreview', setMode: undefined, onClickLink: this.onClickLink, getLastMode: undefined, updateTitle: undefined }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; if (params.isAddShowPreview) { this.state.index = params.dsInfoAddShowPreview.index; this.state.project = params.dsInfoAddShowPreview.project; this.state.readOnly = true; this.showMyToolbarItem(true); return; } this.showMyToolbarItem(); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; this.hideMyToolbarItem(); this.clearState(); }); mls.events.addEventListener([this.level], ['DSTokenSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; this.showMyToolbarItem(); }); mls.events.addEventListener([this.level], ['DSTokenUnSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; this.hideMyToolbarItem(); }); mls.events.addEventListener([this.level], ['DSStyleChanged', 'DSColorChanged', 'DSTYPOChanged', 'DSCustomChanged'], (ev) => { if (!this.isServiceVisible()) return; this.onDsStyleChanged(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } get confE() { return `l${this.level}_${this._positionToolbar}_preview_style`; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } clearState() { this.state.project = undefined; this.state.index = undefined; this.state.readOnly = false; } hideMyToolbarItem() { const itemStylePreview = this.getMyToolbarItem(); if (!itemStylePreview) return; itemStylePreview.setAttribute('mode', 'H'); } showMyToolbarItem(show = false) { const itemStylePreview = this.getMyToolbarItem(); if (!itemStylePreview) return; itemStylePreview.setAttribute('mode', 'A'); if (show) itemStylePreview.click(); } isServiceVisible() { return this._div1.getAttribute('visible') === 'true'; } onDsStyleChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.emitter !== 'left') return; this.addStyle(); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemPreview = this.getMyToolbarItem(); if (!itemPreview || this._div1.getAttribute('visible') === 'true') return; itemPreview.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Preview Style</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showPreview() { this.menu.title = 'Preview'; this.createPreview(); return true; } async createPreview() { if (!this.ds) return; const div1 = document.createElement('div'); const html = await this.ds.css['getHTMLPreview'](); this.iframeEx = document.createElement('iframe'); div1.appendChild(this.iframeEx); this.iframeEx.addEventListener('load', () => { this.prepareIframe(html); }); if (this.menu.setMode) this.menu.setMode('page', div1); } async prepareIframe(html) { const iframeDocument = this.iframeEx.contentDocument; this.iframeEx.style.width = '100%'; this.iframeEx.style.height = 'calc(100vh - 110px)'; this.iframeEx.style.border = 'none'; iframeDocument.body.innerHTML = ''; await this.addStyle(); iframeDocument.body.innerHTML = html; await this.addScripts(iframeDocument.body); } addScripts(elm) { Array.from(elm.querySelectorAll('script')) .forEach((oldScriptEl) => { const newScriptEl = document.createElement('script'); Array.from(oldScriptEl.attributes).forEach((attr) => { newScriptEl.setAttribute(attr.name, attr.value); }); const scriptText = document.createTextNode(oldScriptEl.innerHTML); newScriptEl.appendChild(scriptText); oldScriptEl.parentNode.replaceChild(newScriptEl, oldScriptEl); }); } async addStyle() { if (!this.ds) return; const styleGlobal = await this.ds.css.getStylesInLess(); const iframeDocument = this.iframeEx.contentDocument; const mlsSt = iframeDocument.body.querySelector('#mls_style'); if (mlsSt) mlsSt.remove(); const style = iframeDocument.createElement('style'); style.id = 'mls_style'; mls.l2.compileLess(styleGlobal).then((css) => { style.textContent = css; iframeDocument.body.appendChild(style); }); } showEditor() { if (this.menu.setMode) this.menu.setMode('page', this.divMonaco); this.recalculaEditor(); this.setContentInEditor(); return true; } async getHTML() { try { const html = await this.ds.css['getHTMLPreview'](); return html; } catch (err) { console.error(err.message); return ''; } } async setContentInEditor() { const html = await this.getHTML(); this.model.setValue(html); this._ed1.updateOptions({ readOnly: this.state.readOnly }); } getUri(shortFN) { _100529_service_styles_preview.modelCount = _100529_service_styles_preview.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_styles_preview.modelCount}.ts`); } setInitialModels(src) { const uri = this.getUri('l3_styles_html'); this.model = monaco.editor.getModel(uri); if (this.model) this.model.setValue(src); else this.model = monaco.editor.createModel(src, 'html', uri); this.model.onDidChangeContent((event) => { if (this.timeoutChangesEditorStylePreview) clearTimeout(this.timeoutChangesEditorStylePreview); this.timeoutChangesEditorStylePreview = setTimeout(() => { this.onEditorChange(); }, 1000); }); } async onEditorChange() { const val = this.model.getValue().trim(); await this.ds.css['setHTMLPreview'](val); } async initMonacoEditor() { this.divMonaco = document.createElement('mls-editor-100529'); this._ed1 = monaco.editor.create(this.divMonaco, mls.editor.conf[this.confE]); } recalculaEditor() { var _a; const size = (_a = this._div1.getAttribute('msize')) === null || _a === void 0 ? void 0 : _a.split(','); const sizec = this._div1.getBoundingClientRect(); this.divMonaco.style.height = size && size[1] ? size[1] + 'px' : sizec.height + 'px'; this.divMonaco.style.width = '100%'; if (typeof this._div1['layout'] === 'function') this._ed1.layout(); } async loadService() { if (!this.state.project) { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; this.state.index = mode; this.state.project = project; this.state.readOnly = false; } this.ds = mls.l3.getDSInstance(this.state.project, this.state.index); await this.ds.init(); if (!this.c1 || this.lastDsIndex !== this.state.index || this.lastDsProject !== this.state.project) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.initMonacoEditor(); this.setInitialModels(''); } else { this.addStyle(); } this.lastDsIndex = this.state.index; this.lastDsProject = this.state.project; this.state.project = undefined; this.state.index = undefined; this._ed1.setModel(this.model); } } _100529_service_styles_preview.details = [, , , , { name: '&#xf142; Background', ref: '_100532_service_styles_background' }, ]; l2_html._100529_service_styles_preview = _100529_service_styles_preview; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_size extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opSize') return this.showSizeHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Size', actions: { opAbout: 'About', opSize: 'Size', }, actionDefault: 'opSize', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemSize = this.getMyToolbarItem(); if (!itemSize) return; itemSize.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemSize = this.getMyToolbarItem(); if (!itemSize) return; itemSize.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemSize = this.getMyToolbarItem(); if (!itemSize || this._div1.getAttribute('visible') === 'true') return; itemSize.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Size</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showSizeHelper() { this.menu.title = 'Size'; this.c2.setAttribute('path', '_100529_service_styles_size'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_size.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_size = _100529_service_styles_size; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_spacing extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opMargin') return this.showBorderHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Margin', actions: { opAbout: 'About', opMargin: 'Spacing', }, actionDefault: 'opMargin', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemMargin = this.getMyToolbarItem(); if (!itemMargin) return; itemMargin.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemMargin = this.getMyToolbarItem(); if (!itemMargin) return; itemMargin.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemMargin = this.getMyToolbarItem(); if (!itemMargin || this._div1.getAttribute('visible') === 'true') return; itemMargin.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Spacing</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showBorderHelper() { this.menu.title = 'Spacing'; this.c2.setAttribute('path', '_100529_service_styles_spacing'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_spacing.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_spacing = _100529_service_styles_spacing; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_textshadow extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opTextShadow') return this.showTextShadowHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'TextShadow', actions: { opAbout: 'About', opTextShadow: 'TextShadow', }, actionDefault: 'opTextShadow', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemTextShadow = this.getMyToolbarItem(); if (!itemTextShadow) return; itemTextShadow.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemTextShadow = this.getMyToolbarItem(); if (!itemTextShadow) return; itemTextShadow.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemTextShadow = this.getMyToolbarItem(); if (!itemTextShadow || this._div1.getAttribute('visible') === 'true') return; itemTextShadow.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About TextShadow</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showTextShadowHelper() { this.menu.title = 'TextShadow'; this.c2.setAttribute('path', '_100529_service_styles_textshadow'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_textshadow.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_textshadow = _100529_service_styles_textshadow; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_transform extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opTransform') return this.showTransformHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Transform', actions: { opAbout: 'About', opTransform: 'Transform', }, actionDefault: 'opTransform', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemTransform = this.getMyToolbarItem(); if (!itemTransform) return; itemTransform.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemTransform = this.getMyToolbarItem(); if (!itemTransform) return; itemTransform.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemTransform = this.getMyToolbarItem(); if (!itemTransform || this._div1.getAttribute('visible') === 'true') return; itemTransform.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Transform</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showTransformHelper() { this.menu.title = 'Transform'; this.c2.setAttribute('path', '_100529_service_styles_transform'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_transform.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_transform = _100529_service_styles_transform; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_styles_typography extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opTypography') return this.showTypographyHelper(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Typography', actions: { opAbout: 'About', opTypography: 'Typography', }, actionDefault: 'opTypography', setMode: undefined, onClickLink: this.onClickLink, }; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { this.onDSStyleSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { this.onDSStyleUnSelected(ev); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { this.onDSStyleCursorChanged(ev); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { } onDSStyleSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.length > 0 && !params.service.includes(this.constructor.name)) return; const itemTypo = this.getMyToolbarItem(); if (!itemTypo) return; itemTypo.setAttribute('mode', 'A'); } onDSStyleUnSelected(ev) { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemTypo = this.getMyToolbarItem(); if (!itemTypo) return; itemTypo.setAttribute('mode', 'H'); } onDSStyleCursorChanged(ev) { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemTypo = this.getMyToolbarItem(); if (!itemTypo || this._div1.getAttribute('visible') === 'true') return; itemTypo.click(); } } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About Typography</h1>'; this.menu.title = 'About'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showTypographyHelper() { this.menu.title = 'Typography'; this.c2.setAttribute('path', '_100529_service_styles_typography'); return true; } loadService() { if (this._div1.children.length === 0) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } } } _100529_service_styles_typography.details = [, , , , { name: '', ref: '' }, ]; l2_html._100529_service_styles_typography = _100529_service_styles_typography; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_tokens extends l2_html.BaseService { constructor(el, level) { super(); this.models = { resume: undefined, color: undefined, custom: undefined, typography: undefined, }; this.lastLine = { resume: undefined, color: undefined, custom: undefined, typography: undefined, }; this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opTypography') return this.showTypography(); if (op === 'opCustom') return this.showCustom(); if (op === 'opColors') return this.showColors(); if (op === 'opColors2') return this.showColors2(); if (op === 'opEditor') return this.showResume(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Colors', actions: { opAbout: 'About', opTypography: 'Typography', opCustom: 'Custom', opColors: 'Colors', }, actionDefault: 'opColors2', setMode: undefined, onClickLink: this.onClickLink, getLastMode: undefined, updateTitle: undefined, }; this.tokensColors = []; this.tokensTypo = []; this.tokensCustom = []; this.lastLineColor = undefined; this.isRightChange = false; this._div1 = el; if (el) el['mlsWidget'] = this; this.level = +level; mls.events.addEventListener([3], ['DSColorChanged'], (ev) => { this.editEditorByDSColorChanged(ev.desc); }); mls.events.addEventListener([this.level], ['DSTYPOClicked'], (ev) => { if (ev.desc !== 'right') return; this.onClickLink('opTypography'); }); mls.events.addEventListener([this.level], ['DSColorClicked'], (ev) => { if (ev.desc !== 'right') return; this.onClickLink('opColors'); }); } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } async setTokens() { const { resumeTokens, tokensColors, tokensCustom, tokensTypo } = await this.getTokens(); this.setInitialModels(resumeTokens, 'resume'); this.setInitialModels(tokensColors, 'color'); this.setInitialModels(tokensCustom, 'custom'); this.setInitialModels(tokensTypo, 'typography'); } async getTokens() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; const dss = mls.l5.ds.list(project); const dsInfo = dss[mode]; if (!dsInfo) return { tokensColors: '', tokensTypo: '', tokensCustom: '', resumeTokens: '' }; this.dsInstance = mls.l3.getDSInstance(project, mode); await this.dsInstance.init(); const { list } = this.dsInstance.tokens; const tokens = []; Object.keys(list).forEach((tok) => { tokens.push(list[tok]); }); this.tokensColors = tokens.filter((tok) => tok.category === 'color'); this.tokensTypo = tokens.filter((tok) => tok.category === 'typography'); this.tokensCustom = tokens.filter((tok) => tok.category === 'custom'); const strColors = this.tokensColors.map((item) => `@${item.key}: ${item.value};`).join('\n'); const strTypo = this.tokensTypo.map((item) => `@${item.key}: ${item.value};`).join('\n'); const strCustom = this.tokensCustom.map((item) => `@${item.key}: ${item.value};`).join('\n'); const resumeTokens = ['// Tokens Colors', strColors, '// Tokens Typography', strTypo, '//Tokens Custom', strCustom].join('\n'); return { tokensColors: strColors, tokensTypo: strTypo, tokensCustom: strCustom, resumeTokens }; } createEditor() { this._ed1 = monaco.editor.create(this.c2, mls.editor.conf['tokens']); } getUri(shortFN) { _100529_service_tokens.modelCount = _100529_service_tokens.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_tokens.modelCount}.ts`); } setInitialModels(src, model) { const uri = this.getUri('l3_tokens'); this.models[model] = monaco.editor.getModel(uri); if (this.models[model]) this.models[model].setValue(src); else this.models[model] = monaco.editor.createModel(src, 'less', uri); } onExec() { this.loadService(); } showAbout() { if (!this.aboutDiv) { this.aboutDiv = document.createElement('mls-load-page-l4-100529'); this.aboutDiv.setAttribute('path', '_100529_service_tokens_about'); } if (this.menu.setMode) this.menu.setMode('page', this.aboutDiv); return true; } showResume() { this.menu.title = 'Tokens - Resume'; this.menu.updateTitle(); this.showResume2(); return true; } async showResume2() { const { resumeTokens } = await this.getTokens(); this.setInitialModels(resumeTokens, 'resume'); this._ed1.setModel(this.models['resume']); this._ed1.updateOptions({ readOnly: true }); return true; } showCustom() { if (this.menu.setMode) this.menu.setMode('editor'); this._ed1.setModel(this.models['custom']); this._ed1.updateOptions({ readOnly: false }); mls.events.fire([this.level], ['DSCustomClicked'], 'Custom Clicked'); this._ed1.getModel().onDidChangeContent((event) => { this.timeoutChangesEditorCustom = setTimeout(() => { if (this.timeoutChangesEditorCustom) clearTimeout(this.timeoutChangesEditorCustom); this.onEditorCustomChange(event.changes); }, 1000); }); return true; } showTypography() { if (this.menu.setMode) this.menu.setMode('editor'); this._ed1.setModel(this.models['typography']); this._ed1.updateOptions({ readOnly: false }); this._ed1.getModel().onDidChangeContent((event) => { this.timeoutChangesEditorTypography = setTimeout(() => { if (this.timeoutChangesEditorTypography) clearTimeout(this.timeoutChangesEditorTypography); this.onEditorTypoChange(event.changes); }, 1000); }); return true; } showColors() { if (this.menu.setMode) this.menu.setMode('initial'); return this.showColors2(); } showColors2() { this.setTokens().then(() => { this._ed1.setModel(this.models['color']); this._ed1.updateOptions({ readOnly: false }); const rc = this.getEditorJsonKeyValue('color'); const params = { emitter: 'left', value: `${JSON.stringify(rc)};${''};${this.isRightChange ? 'refresh' : 'editor'}` }; mls.events.fire([this.level], ['DSColorChanged'], JSON.stringify(params), 1000); this._ed1.getModel().onDidChangeContent((event) => { this.timeoutChangesEditorColor = setTimeout(() => { if (this.timeoutChangesEditorColor) clearTimeout(this.timeoutChangesEditorColor); this.onEditorColorChange(event.changes); }, 500); }); this._ed1.onDidChangeCursorPosition((event) => { this.onEditorColorLineChange(event.position.lineNumber); }); }); return true; } onEditorColorLineChange(line) { if (this.isRightChange) { this.isRightChange = false; return; } if (this.lastLine && this.lastLineColor !== line) { this.lastLineColor = line; const lineKeyValue = this.convertTokenLineEditorToKeyValue(this._ed1.getModel().getLineContent(line)); const params = { emitter: 'left', value: `${lineKeyValue.key};${''};line` }; mls.events.fire([this.level], ['DSColorChanged'], JSON.stringify(params), 0); } } onEditorColorChange(changes) { const [change] = changes; if (!change) return; const lineChange = change.range.startLineNumber; const lineKeyValue = this.convertTokenLineEditorToKeyValue(this._ed1.getModel().getLineContent(lineChange)); const tokens = this.getEditorsTokens(); const colorsTokens = tokens.filter((item) => item.category === 'color'); this.dsInstance.tokens['setTokenList'](tokens); let params; if (this.isRightChange) { this.isRightChange = false; params = { emitter: 'left', value: `${JSON.stringify(colorsTokens)};${''};refresh` }; } else { params = { emitter: 'left', value: `${lineKeyValue.key || JSON.stringify(colorsTokens)};${''};editor` }; } mls.events.fire([this.level], ['DSColorChanged'], JSON.stringify(params)); } onEditorTypoChange(changes) { const [change] = changes; if (!change) return; const tokens = this.getEditorsTokens(); const typoTokens = tokens.filter((item) => item.category === 'typography'); this.dsInstance.tokens['setTokenList'](tokens); const rc = this.getEditorJsonKeyValue('typography'); const params = { emitter: 'left', value: `${JSON.stringify(rc)};${''};${'editor'}` }; mls.events.fire([this.level], ['DSTYPOChanged'], JSON.stringify(params), 1000); } onEditorCustomChange(changes) { const [change] = changes; if (!change) return; const tokens = this.getEditorsTokens(); const customTokens = tokens.filter((item) => item.category === 'custom'); this.dsInstance.tokens['setTokenList'](tokens); const rc = this.getEditorJsonKeyValue('custom'); const params = { emitter: 'left', value: `${JSON.stringify(rc)};${''};${'editor'}` }; mls.events.fire([this.level], ['DSCustomChanged'], JSON.stringify(params), 1000); } getEditorsTokens() { const rcT = this.getEditorJsonKeyValue('typography'); const rcC = this.getEditorJsonKeyValue('color'); const rcCustom = this.getEditorJsonKeyValue('custom'); return [...rcC, ...rcT, ...rcCustom]; } async editEditorByDSColorChanged(desc) { const params = JSON.parse(desc); if (params.emitter !== 'right') return; const [key, value, mode] = params.value.split(';'); if (mode !== 'helper' && mode !== 'line') return; this.isRightChange = true; const colorModel = this.models['color']; if (key.startsWith('[')) { const allTokensColors = JSON.parse(key); this.tokensColors = allTokensColors; const allTokens = [...this.tokensColors, ...this.tokensTypo, ...this.tokensCustom]; await this.dsInstance.tokens['setTokenList'](allTokens); const { tokensColors } = await this.getTokens(); colorModel.setValue(tokensColors); return; } if (mode === 'helper' && this._ed1.getModel().id !== colorModel.id) { await this.dsInstance.tokens.update(key, value); return; } const line = this._ed1.getModel().findMatches(`@${key}:`, true, false, false, null, true); if (!line || line.length === 0) return; const { startLineNumber, startColumn, endLineNumber } = line[0].range; const lineLength = colorModel.getLineContent(startLineNumber).length + 1; const range = new monaco.Range(startLineNumber, startColumn, endLineNumber, lineLength); const text = value ? `@${key}: ${value};` : null; if (mode === 'helper' && !text) { this._ed1.executeEdits('', [{ range: new monaco.Range(range.startLineNumber, 1, range.startLineNumber + 1, 1), text }]); return; } if (mode === 'helper') this._ed1.executeEdits('color', [{ range, text }]); if (this.lastLine['color'] === startLineNumber) return; this.lastLine['color'] = startLineNumber; this._ed1.setSelection(new monaco.Selection(range.startLineNumber, 0, range.startLineNumber, lineLength)); this._ed1.revealLineInCenter(startLineNumber); } getEditorJsonKeyValue(model) { const editorValue = this.models[model].getValue().trim().split('\n'); let rc = (editorValue.map((line) => { const obj = {}; const { key, value } = this.convertTokenLineEditorToKeyValue(line); obj.key = key; obj.value = value; obj.category = model; return obj; }).filter((item) => item.key !== undefined)); const filteredRc = rc.reduce((acc, current) => { const x = acc.find((item) => item.key === current.key); return (!x || !x.key || !x.value) ? acc.concat([current]) : acc; }, []); return filteredRc; } convertTokenLineEditorToKeyValue(content) { const rc = {}; if (!content.startsWith('@') || !content.endsWith(';')) return rc; const [key, value] = (content.substring(1, content.length - 1)).split(':'); rc.key = key.trim(); rc.value = value.trim(); return rc; } openMenu(op) { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink(op); } async loadService() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; if (!this.c1 || !this.c2 || this.lastProject !== project || this.lastDsIndex !== mode) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this.createEditor(); this._ed1.setModel(this.models['resume']); this.c2['mlsEditor'] = this._ed1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); if (typeof this._div1['layout'] === 'function') this._div1['layout'](); } this.lastDsIndex = mode; this.lastProject = project; mls.events.fire([this.level], ['DSColorClicked'], 'left'); const params = { isComponent: false, service: ['_100529_service_styles_preview'] }; mls.events.fire([this.level], ['DSTokenSelected'], JSON.stringify(params), 0); } reset() { const params = { isComponent: false, service: [] }; mls.events.fire([this.level], ['DSTokenUnSelected'], JSON.stringify(params)); } } _100529_service_tokens.details = [, , , , { name: '&#xf142; Tokens', ref: '_100532_service_tokens' }, ]; l2_html._100529_service_tokens = _100529_service_tokens; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_typography extends l2_html.BaseService { constructor(el, level) { super(); this.models = { definitions: undefined }; this.needFire = true; this.onClickLink = (op) => { if (op === 'opAbout') return this.showAbout(); if (op === 'opVisualization') return this.showHelper(); if (op === 'opDefinition') return this.showDefinitions(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Definitions', actions: { opAbout: 'About', opDefinition: 'Definitions', opVisualization: 'Visualization', }, actionDefault: 'opVisualization', setMode: undefined, onClickLink: this.onClickLink, }; this.defDefault = ` h1 { font-family: @mls-font-header-font-primary; font-size: round( @mls-font-header-primary-size * @mls-font-primary-base-6); font-weight: @mls-font-header-weight-bold; } h2 { font-family: @mls-font-header-font-primary; font-size: round( @mls-font-header-primary-size *@mls-font-primary-base-5); font-weight: @mls-font-header-weight-regular; } h3 { font-family: @mls-font-header-font-primary; font-size: round( @mls-font-header-primary-size *@mls-font-primary-base-4); font-weight: @mls-font-header-weight-regular; } h4 { font-family: @mls-font-header-font-primary; font-size: round( @mls-font-header-primary-size *@mls-font-primary-base-3); font-weight: @mls-font-header-weight-regular; } h5 { font-family: @mls-font-header-font-primary; font-size: round( @mls-font-header-primary-size *@mls-font-primary-base-2); font-weight: @mls-font-header-weight-regular; } h6 { font-family: @mls-font-header-font-primary; font-size: round( @mls-font-header-primary-size *@mls-font-primary-base-1); font-weight: @mls-font-header-weight-regular; } `; this._div1 = el; this.level = +level; if (el) el['mlsWidget'] = this; mls.events.addEventListener([this.level], ['DSTYPOClicked'], (ev) => { console.info(ev); if (ev.desc === 'right') { this.needFire = true; return; } this.needFire = false; const itemTypo = this.getMyToolbarItem(); if (!itemTypo) return; itemTypo.click(); this.needFire = true; }); mls.events.addEventListener([this.level], ['DSTokenSelected'], (ev) => { console.info(ev); const itemTypo = this.getMyToolbarItem(); if (!itemTypo) return; itemTypo.setAttribute('mode', 'A'); }); mls.events.addEventListener([this.level], ['DSTokenUnSelected'], (ev) => { console.info(ev); const itemTypo = this.getMyToolbarItem(); if (!itemTypo) return; itemTypo.setAttribute('mode', 'H'); }); mls.events.addEventListener([this.level], ['DSTYPOChanged'], (ev) => { this.onTypoChanged(ev.desc); }); return this; } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About</h1>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showHelper() { this.menu.title = 'Visualization'; if (!this.visualizationContainer) this.visualizationContainer = document.createElement('mls-l3-typography-section'); if (this.menu.setMode) this.menu.setMode('page', this.visualizationContainer); return true; } showDefinitions() { this._ed1.setModel(this.models['definitions']); this.menu.title = 'Definitions'; this._ed1.getModel().onDidChangeContent((event) => { if (this.timeoutChangesEditorDefinitions) clearTimeout(this.timeoutChangesEditorDefinitions); this.timeoutChangesEditorDefinitions = setTimeout(() => { this.onEditorDefinitionsChange(); }, 1000); }); this.onEditorDefinitionsChange(); return true; } setInitialModels(src, model) { const uri = this.getUri('l3_typography_definitions'); this.models[model] = monaco.editor.getModel(uri); if (this.models[model]) this.models[model].setValue(src); else this.models[model] = monaco.editor.createModel(src, 'less', uri); } getUri(shortFN) { _100529_service_typography.modelCount = _100529_service_typography.modelCount + 1 || 1; return monaco.Uri.parse(`file://server/${shortFN}_${_100529_service_typography.modelCount}.ts`); } createEditor() { this._ed1 = monaco.editor.create(this.c2, mls.editor.conf['l3_typography_definitions']); this._ed1.onDidChangeCursorPosition((e) => { const { end, start } = this.getIntervalLinesReadOnly(); if (!end || !start) this._ed1.updateOptions({ readOnly: false }); else if (e.position.lineNumber >= start && e.position.lineNumber <= end) this._ed1.updateOptions({ readOnly: true }); else this._ed1.updateOptions({ readOnly: false }); }); } async onEditorDefinitionsChange() { const rc = await this.getLessCompile(); if (!this.visualizationContainer) this.visualizationContainer = document.createElement('mls-l3-typography-section'); this.visualizationContainer.setAttribute('css', rc); } async getLessCompile() { const compile = await mls.l2.compileLess(this._ed1.getModel().getValue()); return compile; } getIntervalLinesReadOnly() { const [startLine] = this._ed1.getModel().findMatches(`//Start Less Tokens`, true, false, false, null, true); const [endLine] = this._ed1.getModel().findMatches(`//End Less Tokens`, true, false, false, null, true); return { end: endLine ? endLine.range.startLineNumber : undefined, start: startLine ? startLine.range.startLineNumber : undefined }; } onTypoChanged(data) { const [key, value, mode] = data.split(';'); if (mode === 'editor-right' || mode !== 'editor-left') return; if (key && key !== 'undefined') { const arr = JSON.parse(key); const lessTokens = (arr.map((item) => `@${item.key}:${item.value};`)).join('\n'); let textByRange = this.defDefault; const { start } = this.getIntervalLinesReadOnly(); if (start) { const rangeText = new monaco.Range(0, 0, start, 0); textByRange = this._ed1.getModel().getValueInRange(rangeText); } const content = `${textByRange.trim()}\n//Start Less Tokens\n${lessTokens}\n//End Less Tokens\n`; const range = new monaco.Range(0, 0, this._ed1.getModel().getLineCount() + 1, 10); this._ed1.updateOptions({ readOnly: false }); this._ed1.executeEdits('definitions', [{ range, text: content.trim() }]); this._ed1.setScrollPosition({ scrollTop: 0 }); this.onEditorDefinitionsChange(); } } loadService() { if (this._div1.children.length !== 1 || !this.c2) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-editor-100529'); this.createEditor(); this.c2['mlsEditor'] = this._ed1; this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } if (this.needFire) mls.events.fire([this.level], ['DSTYPOClicked'], 'right'); } } _100529_service_typography.details = [, , , , { name: '&#xf142; Typography', ref: '_100533_service_typography' }, ]; l2_html._100529_service_typography = _100529_service_typography; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_widgets extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.showDefault(); if (op === 'opAbout') return this.showAbout(); if (op === 'opAdd') return this.showAdd(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Widgets', actions: { opDefault: '', opAbout: 'About', opAdd: 'Add Component', }, actionDefault: 'opDefault', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; if (el) el['mlsWidget'] = this; this.level = +level; this._div1 = el; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onServiceClosed() { this.reset(); } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About</h1>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showDefault() { this.menu.title = 'Components'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_widgets'); return true; } showAdd() { this.menu.title = 'Add Component'; this.menu.updateTitle(); if (this.menu.setMode) this.menu.setMode('editor'); this.c2.setAttribute('path', '_100529_service_widgets_add'); return true; } openMenu(op) { const toolbarService = this._div1.querySelector('mls-toolbar-service-100529'); const checkbox = toolbarService.querySelector('.menu-btn'); checkbox.checked = true; checkbox.onchange(undefined); this.onClickLink(op); } onExec() { this.loadService(); return true; } loadService() { const { project } = mls.actual[5]; const { mode } = mls.actual[3]; if (!this.c1 || !this.c2 || this.lastProject !== project || this.lastDsIndex !== mode) { this._div1.innerHTML = ''; this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.c2.style.width = '100%'; this.c2.style.height = '100%'; this.c2.setAttribute('path', '_100529_service_widgets'); } this.lastDsIndex = mode; this.lastProject = project; } reset() { mls.events.fire([this.level], ['DSWidgetsUnSelected'], 'Doc UnSelected'); } fireComunication(json) { mls.events.fire([this.level], ['DSWidgetsSelected'], json, 800); } } _100529_service_widgets.details = [, , , { name: '&#xf02d; Widgets', ref: '' }, ]; l2_html._100529_service_widgets = _100529_service_widgets; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_widgets_doc extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.onExec(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Documentation', actions: { opDefault: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, }; if (el) el['mlsWidget'] = this; this.level = +level; this._div1 = el; mls.events.addEventListener([this.level], ['DSWidgetsSelected'], (ev) => { console.info(ev); const itemDocPage = this.getMyToolbarItem(); if (!itemDocPage) return; itemDocPage.setAttribute('mode', 'A'); itemDocPage.click(); }); mls.events.addEventListener([this.level], ['DSWidgetsUnSelected'], (ev) => { console.info(ev); const itemDocPage = this.getMyToolbarItem(); if (!itemDocPage) return; itemDocPage.setAttribute('mode', 'H'); this._div1.innerHTML = ''; this.c1 = undefined; this.c2 = undefined; }); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } this.c2.setAttribute('path', '_100529_service_widgets_doc'); } fireComunication(json) { mls.events.fire([this.level], ['DSWidgetsSelected'], json); } } _100529_service_widgets_doc.details = [, , , { name: '&#xf02d; Documentation', ref: '' }, ]; l2_html._100529_service_widgets_doc = _100529_service_widgets_doc; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_widgets_examples extends l2_html.BaseService { constructor(el, level) { super(); this.forceUpdate = false; this.onClickLink = (op) => { if (op === 'opDefault') return this.showDefault(); if (op === 'opAbout') return this.showAbout(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Examples', actions: { opDefault: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, getLastMode: undefined, updateTitle: undefined, onClickLink: this.onClickLink, }; if (el) el['mlsWidget'] = this; this.level = +level; this._div1 = el; mls.events.addEventListener([this.level], ['DSWidgetsSelected'], (ev) => { this.forceUpdate = true; const item = this.getMyToolbarItem(); if (!item) return; item.setAttribute('mode', 'A'); this.info = ev; }); mls.events.addEventListener([this.level], ['DSWidgetsUnSelected'], (ev) => { this.forceUpdate = false; const item = this.getMyToolbarItem(); if (!item) return; item.setAttribute('mode', 'H'); }); mls.events.addEventListener([this.level], ['DSStyleSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (!params.isComponent || (params.service.length > 0 && !params.service.includes(this.constructor.name))) return; const itemWExample = this.getMyToolbarItem(); if (!itemWExample) return; itemWExample.setAttribute('mode', 'A'); }); mls.events.addEventListener([this.level], ['DSStyleUnSelected'], (ev) => { const params = ev.desc ? JSON.parse(ev.desc) : []; if (params.service.includes(this.constructor.name)) return; const itemWExample = this.getMyToolbarItem(); if (!itemWExample) return; itemWExample.setAttribute('mode', 'H'); }); mls.events.addEventListener([this.level], ['DSStyleChanged'], (ev) => { const rc = JSON.parse(ev.desc); if (rc.emitter === 'right') return; if (rc.less === '') return; if (!this.funcChangedStyle) return; this.funcChangedStyle(rc); }); mls.events.addEventListener([this.level], ['DSStyleCursorChanged'], (ev) => { const rc = JSON.parse(ev.desc); if (rc.helper === this.constructor.name) { const itemWEx = this.getMyToolbarItem(); if (!itemWEx || this._div1.getAttribute('visible') === 'true') return; itemWEx.click(); } }); mls.events.addEventListener([this.level], ['DSSelected'], (ev) => { this._div1.innerHTML = ''; this.c1 = undefined; this.c2 = undefined; }); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } showAbout() { const div1 = document.createElement('div'); div1.innerHTML = '<h1>About</h1>'; if (this.menu.setMode) this.menu.setMode('page', div1); return true; } showDefault() { this.menu.title = 'Examples'; this.menu.updateTitle(); this.c2.setAttribute('path', '_100529_service_widgets_examples'); return true; } onExec() { this.loadService(); return true; } loadService() { if ((!this.c1 || !this.c2)) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); this.c2.setAttribute('path', '_100529_service_widgets_examples'); } if (this.forceUpdate) this.c2.setAttribute('path', '_100529_service_widgets_examples'); } fireComunication(token, json) { mls.events.fire([this.level], [token], json); } } _100529_service_widgets_examples.details = [, , , { name: '&#xf03a; Examples', ref: '' }, ]; l2_html._100529_service_widgets_examples = _100529_service_widgets_examples; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100529_service_widgets_mkt extends l2_html.BaseService { constructor(el, level) { super(); this.onClickLink = (op) => { if (op === 'opDefault') return this.onExec(); if (this.menu.setMode) this.menu.setMode('initial'); return false; }; this.menu = { title: 'Marketing', actions: { opDefault: '', opAbout: 'About', }, actionDefault: 'opDefault', setMode: undefined, onClickLink: this.onClickLink, }; if (el) el['mlsWidget'] = this; this.level = +level; this._div1 = el; mls.events.addEventListener([this.level], ['DSWidgetsSelected'], (ev) => { console.info('mkt' + ev); const item = this.getMyToolbarItem(); if (!item) return; item.setAttribute('mode', 'A'); }); mls.events.addEventListener([this.level], ['DSWidgetsUnSelected'], (ev) => { console.info('mkt'); const item = this.getMyToolbarItem(); if (!item) return; item.setAttribute('mode', 'H'); this._div1.innerHTML = ''; this.c1 = undefined; this.c2 = undefined; }); } getMyToolbarItem() { const toolbar = this._div1.closest('mls-toolbar-100529'); if (!toolbar) return undefined; const ref = this._div1.getAttribute('data-service'); const item = toolbar.querySelector(`mls-toolbar-item-100529[ref="${ref}"]`); return item; } onServiceClick(ev) { this.onExec(); } onReenter() { return false; } onSelectedChange() { } onVariationChange(newV, actualV) { } onExec() { this.loadService(); return true; } loadService() { if (!this.c1 || !this.c2) { this.c1 = document.createElement('mls-toolbar-service-100529'); this.c2 = document.createElement('mls-load-page-l4-100529'); this._div1.appendChild(this.c1); this._div1.appendChild(this.c2); } this.c2.setAttribute('path', '_100529_service_widgets_mkt'); } fireComunication(json) { mls.events.fire([this.level], ['DSWidgetsSelected'], json); } } _100529_service_widgets_mkt.details = [, , , { name: '&#xf0a1; Marketing', ref: '' }, ]; l2_html._100529_service_widgets_mkt = _100529_service_widgets_mkt; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_services_Base extends l2_html.Base { constructor() { super(); this.id.visible = false; this.searchDetails.visible = false; this.name.visible = false; this.class.visible = false; this.style.visible = false; } render() { super.createEL('null'); return this.el; } createLogDetails(title, parent) { const li = document.createElement('li'); const details = document.createElement('details'); details.open = false; const summary = document.createElement('summary'); summary.innerHTML = title; details.appendChild(summary); li.appendChild(details); const sectionLog = parent; if (!sectionLog) return undefined; sectionLog.appendChild(li); return details; } createLogLine(text, el) { if (!el) return; const p = document.createElement('p'); p.innerHTML = text; el.appendChild(p); } } l2_html._100131_automation_publish_services_Base = _100131_automation_publish_services_Base; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_Service_FindAddOn_GetJson extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_Service_FindAddOn_GetJson = _100131_Service_FindAddOn_GetJson; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_RemotesFiles extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_RemotesFiles = _100131_addon_RemotesFiles; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_RemotesFilesAWS extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_RemotesFilesAWS = _100131_addon_RemotesFilesAWS; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_RemotesFilesGoogleCloud extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_RemotesFilesGoogleCloud = _100131_addon_RemotesFilesGoogleCloud; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_RemotesFiles_Drive extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_RemotesFiles_Drive = _100131_addon_RemotesFiles_Drive; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_RemotesFiles_DriveGoogle extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_RemotesFiles_DriveGoogle = _100131_addon_RemotesFiles_DriveGoogle; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_RemotesFiles_Drive_VisuGoogle extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_RemotesFiles_Drive_VisuGoogle = _100131_addon_RemotesFiles_Drive_VisuGoogle; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_RemotesFiles_Drive_Visualization extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_RemotesFiles_Drive_Visualization = _100131_addon_RemotesFiles_Drive_Visualization; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_drive_overview extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_drive_overview = _100131_addon_drive_overview; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addon_drive_style extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_addon_drive_style = _100131_addon_drive_style; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addons_help_list extends l2_html.Base { constructor() { super(...arguments); this.placeholder = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'placeholder for input', elType: 'string' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('ul'); l2_fieldTypes.renderAllFields(this.el, this); for (let i = 0; i < this.children.length; i++) { const childrenElement = this.children[i]; if (childrenElement.renderHTML().tagName === 'LI') { if (childrenElement.children.length > 0) { childrenElement.class.value = 'addonsHelpItem addonsHelpWithChildrenClose'; this.class.value = 'addonsHelpUl'; } else if (childrenElement.children.length === 0) { childrenElement.class.value = 'addonsHelpItem addonsHelpNoChildren'; } } } return this.el; } } _100131_addons_help_list._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'component for help on addons', tags: ['elAddonsHelp'], childrenTags: ['elAddonsHelp', 'elAddonsHelpItem'], examples: ['{}' ] }; l2_html._100131_addons_help_list = _100131_addons_help_list; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addons_help_list_item extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'title for item', elType: 'string' }); this.url = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'url for item', elType: 'string' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('li'); l2_fieldTypes.renderAllFields(this.el, this); const a = document.createElement('a'); a.innerText = this.title.value; a.href = '#'; a.setAttribute('data-url', this.url.value); this.el.setAttribute('data-item', this.title.value); this.el.appendChild(a); for (let i = 0; i < this.children.length; i++) { if (this.children[i].renderHTML().tagName === 'UL') { this.children[i]['class'].value = 'addonsHelpUl d-none'; } } return this.el; } } _100131_addons_help_list_item._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'component for help on addons', tags: ['elAddonsHelpItem'], childrenTags: ['elAddonsHelp'], examples: ['{}' ] }; l2_html._100131_addons_help_list_item = _100131_addons_help_list_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_addons_help_list_visualization extends l2_html.Base { render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_addons_help_list_visualization._SearchDetails = { section: l2_html.PCategories.none, desc: 'Container for visualization help L4', tags: ['elAddonsHelpVisualization'], childrenTags: ['elAddonsHelp'], examples: [ '{}' ] }; l2_html._100131_addons_help_list_visualization = _100131_addons_help_list_visualization; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_GoogleFonts extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_GoogleFonts._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_GoogleFonts = _100131_api_GoogleFonts; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_HelperMidia extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_HelperMidia.jsonSchema = { definitions: { name: 'api_FormBuilder_Tables_Info', icon: 'fa-archive', description: 'api_FormBuilder_Tables_Info ipsum dolor sit amet, consectetur adipiscing elit.', className: 'api_FormBuilder_Tables_Info', useRepeat: false }, id: 'root.properties', type: 'object', title: 'The Root Schema', required: [ 'api', 'tables', 'tableSelected', 'widgets', 'filterWgt' ], properties: { api: { id: '#/properties/api', type: 'string', title: 'The Api Schema', default: '', examples: [ 'dasda' ], pattern: '^(.*)$' }, tables: { id: '#/properties/tables', type: 'array', title: 'The Tables Schema', items: { id: '#/properties/tables/items', type: 'object', title: 'The Items Schema', required: [ 'name', 'fields' ], properties: { name: { id: '#/properties/tables/items/properties/name', type: 'string', title: 'The Name Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, fields: { id: '#/properties/tables/items/properties/fields', type: 'array', title: 'The Fields Schema', items: { id: '#/properties/tables/items/properties/fields/items', type: 'object', title: 'The Items Schema', required: [ 'position', 'checked', 'name', 'type', 'widget', 'constrain', 'description', ], properties: { position: { id: '#/properties/tables/items/properties/fields/items/properties/position', type: 'string', title: 'The position Schema', default: '', examples: [ 'sdada' ], pattern: '^(.*)$' }, checked: { id: '#/properties/tables/items/properties/fields/items/properties/checked', type: 'string', title: 'The checked Schema', default: '', examples: [ 'sdada' ], pattern: '^(.*)$' }, name: { id: '#/properties/tables/items/properties/fields/items/properties/name', type: 'string', title: 'The Name Schema', default: '', examples: [ 'sdada' ], pattern: '^(.*)$' }, type: { id: '#/properties/tables/items/properties/fields/items/properties/type', type: 'string', title: 'The Type Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' }, widget: { id: '#/properties/tables/items/properties/fields/items/properties/widget', type: 'string', title: 'The widget Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' }, constrain: { id: '#/properties/tables/items/properties/fields/items/properties/constrain', type: 'string', title: 'The constrain Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' }, description: { id: '#/properties/tables/items/properties/fields/items/properties/description', type: 'string', title: 'The description Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' } } } } } } }, tableSelected: { id: '#/properties/tableSelected', type: 'object', title: 'The Tableselected Schema', required: [ 'position', 'checked', 'name', 'type', 'widget', 'constrain', 'description', ], properties: { position: { id: '#/properties/tableSelected/properties/position', type: 'string', title: 'The position Schema', default: '', examples: [ 'sdada' ], pattern: '^(.*)$' }, checked: { id: '#/properties/tableSelected/properties/checked', type: 'string', title: 'The checked Schema', default: '', examples: [ 'sdada' ], pattern: '^(.*)$' }, name: { id: '#/properties/tableSelected/properties/name', type: 'string', title: 'The Name Schema', default: '', examples: [ 'sdada' ], pattern: '^(.*)$' }, type: { id: '#/properties/tableSelected/properties/type', type: 'string', title: 'The Type Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' }, widget: { id: '#/properties/tableSelected/properties/widget', type: 'string', title: 'The widget Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' }, constrain: { id: '#/properties/tableSelected/properties/constrain', type: 'string', title: 'The constrain Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' }, description: { id: '#/properties/tableSelected/properties/description', type: 'string', title: 'The description Schema', default: '', examples: [ 'dasd' ], pattern: '^(.*)$' } } }, widgets: { id: '#/properties/widgets', type: 'array', title: 'The widgets Schema', items: { id: '#/properties/widgets/items', type: 'object', title: 'The Items Schema', required: [ 'name', 'type', 'icon', 'description', 'stars', 'users' ], properties: { name: { id: '#/properties/widgets/items/properties/name', type: 'string', title: 'The Name Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, type: { id: '#/properties/widgets/items/properties/type', type: 'string', title: 'The type Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, icon: { id: '#/properties/widgets/items/properties/icon', type: 'string', title: 'The icon Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, description: { id: '#/properties/widgets/items/properties/description', type: 'string', title: 'The description Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, stars: { id: '#/properties/widgets/items/properties/stars', type: 'integer', title: 'The stars Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, users: { id: '#/properties/widgets/items/properties/users', type: 'integer', title: 'The users Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' } } } }, filterWgt: { id: '#/properties/filterWgt', type: 'array', title: 'The filterWgt Schema', items: { id: '#/properties/filterWgt/items', type: 'object', title: 'The Items Schema', required: [ 'name', 'type', 'icon', 'description', 'stars', 'users' ], properties: { name: { id: '#/properties/filterWgt/items/properties/name', type: 'string', title: 'The Name Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, type: { id: '#/properties/filterWgt/items/properties/type', type: 'string', title: 'The type Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, icon: { id: '#/properties/filterWgt/items/properties/icon', type: 'string', title: 'The icon Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, description: { id: '#/properties/filterWgt/items/properties/description', type: 'string', title: 'The description Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, stars: { id: '#/properties/filterWgt/items/properties/stars', type: 'integer', title: 'The stars Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' }, users: { id: '#/properties/filterWgt/items/properties/users', type: 'integer', title: 'The users Schema', default: '', examples: [ 'dsadsa' ], pattern: '^(.*)$' } } } } } }; _100131_api_HelperMidia._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_HelperMidia = _100131_api_HelperMidia; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_L4StyleSheetsFonts extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_L4StyleSheetsFonts._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_L4StyleSheetsFonts = _100131_api_L4StyleSheetsFonts; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_add extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_add = _100131_api_add; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_create_project_after extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_create_project_after = _100131_api_create_project_after; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_getHelpers extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_getHelpers._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_getHelpers = _100131_api_getHelpers; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_getMidia extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_getMidia = _100131_api_getMidia; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_getMidiaUnsplash extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_getMidiaUnsplash = _100131_api_getMidiaUnsplash; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_helperMenuF7 extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_helperMenuF7._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_helperMenuF7 = _100131_api_helperMenuF7; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_helper_add extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_helper_add._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_helper_add = _100131_api_helper_add; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_helper_class extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_helper_class._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_helper_class = _100131_api_helper_class; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_helper_icons extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_helper_icons = _100131_api_helper_icons; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_helper_l5_org_verify extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_helper_l5_org_verify = _100131_api_helper_l5_org_verify; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_indexPackage extends l2_html.Base { constructor() { super(...arguments); this.componentsProject = new l2_fieldTypes.Input(this, { group: 'principal', name: 'componentsProject', desc: 'Project number of components', type: 'text' }); } render() { super.createEL('null'); return this.el; } } l2_html._100131_api_indexPackage = _100131_api_indexPackage; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l4_helper_text extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l4_helper_text = _100131_api_l4_helper_text; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_actions extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_l5_actions._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_l5_actions = _100131_api_l5_actions; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_changeLog_project extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_changeLog_project = _100131_api_l5_changeLog_project; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_desc_org extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_desc_org = _100131_api_l5_desc_org; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_desc_project extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_desc_project = _100131_api_l5_desc_project; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_details_project extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_details_project = _100131_api_l5_details_project; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_feed_errors extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_feed_errors = _100131_api_l5_feed_errors; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_feed_project extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_feed_project = _100131_api_l5_feed_project; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_info_project extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_info_project = _100131_api_l5_info_project; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_org_manage_teams extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_org_manage_teams = _100131_api_l5_org_manage_teams; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_org_manage_users extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_org_manage_users = _100131_api_l5_org_manage_users; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_prj_manage_dependences extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_prj_manage_dependences = _100131_api_l5_prj_manage_dependences; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_prj_manage_teams extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l5_prj_manage_teams = _100131_api_l5_prj_manage_teams; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_templates_copyProject extends l2_html.Base { render() { super.createEL('null'); return this.el; } } _100131_api_l5_templates_copyProject._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_l5_templates_copyProject = _100131_api_l5_templates_copyProject; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l5_templates_projects extends l2_html.Base { render() { super.createEL('null'); return this.el; } } _100131_api_l5_templates_projects._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_l5_templates_projects = _100131_api_l5_templates_projects; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l6_actions extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_l6_actions._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_l6_actions = _100131_api_l6_actions; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l6_orgs extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l6_orgs = _100131_api_l6_orgs; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_l6_recents_projects extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_l6_recents_projects = _100131_api_l6_recents_projects; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_listWidgetGroup extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_api_listWidgetGroup._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_listWidgetGroup = _100131_api_listWidgetGroup; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_mutation extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } static getMutations(widget) { const arraySameWidget = l2_html['_100167_api_mutation'].findWidgetsSameGroupMutations(widget.getName()); const objRet = { deletions: [], insertions: [], substituitions: [] }; arraySameWidget.forEach((item) => { const search = l2_html[item]._SearchDetails; let exe = search.examples.length > 0 ? search.examples[0] : '{}'; if (!exe.startsWith('{')) exe = '{}'; const json = '{"' + item + '" : ' + exe + '}'; const obj = {}; obj.nameWidget = item; obj.example = json; const arrayType = l2_html['_100167_api_mutation'].compareWidgetInstances(widget, l2_html.BaseHtml.createAndDeserialize(JSON.parse(json))); arrayType.forEach((typ) => { if (objRet[typ]) objRet[typ].push(obj); }); }); return objRet; } static getWidgetExampleMutation(widget) { if (!widget || !l2_html[widget.getName()]._SearchDetails) return undefined; const nameWidget = widget.getName(); const search = l2_html[nameWidget]._SearchDetails; const objRet = { deletions: [], insertions: [], substituitions: [] }; search.examples.forEach((item) => { if (!item || !item.startsWith('{')) return; const obj = {}; const json = '{"' + nameWidget + '" : ' + item + '}'; obj.nameWidget = nameWidget; obj.example = json; const arrayType = l2_html['_100167_api_mutation'].compareWidgetInstances(widget, l2_html.BaseHtml.createAndDeserialize(JSON.parse(json))); arrayType.forEach((typ) => { if (objRet[typ]) objRet[typ].push(obj); }); }); return objRet; } static findWidgetsSameGroupMutations(nameWidget) { if (!nameWidget || !l2_html[nameWidget]) return []; const array = []; const node = l2_html[nameWidget]; const section = node._SearchDetails.section ? node._SearchDetails.section : 99999; const group = node._SearchDetails.group ? node._SearchDetails.group : 'noGroup'; Object.keys(l2_html).forEach((widget) => { if (!widget || !l2_html[widget]._SearchDetails || widget === nameWidget) return; const item = l2_html[widget]._SearchDetails; const widSection = item.section ? item.section : 99999; const widGroup = item.group ? item.group : 'noGroup'; if (section !== widSection || group !== widGroup) return; array.push(widget); }); return array; } static compareWidgetInstances(widgetInstanceSource, widgetInstanceSearch) { let arrayRet = []; if (!widgetInstanceSource || !widgetInstanceSearch) return []; Object.keys(widgetInstanceSource).forEach((prop) => { if (!widgetInstanceSource[prop] || !widgetInstanceSource[prop].value) return; if (!widgetInstanceSearch[prop]) { arrayRet.push('deletions'); return; } arrayRet.push('substituitions'); }); Object.keys(widgetInstanceSearch).forEach((prop) => { if (!widgetInstanceSearch[prop] || !widgetInstanceSearch[prop].value) return; if (widgetInstanceSearch[prop].value && !widgetInstanceSource[prop]) { arrayRet.push('insertions'); return; } arrayRet.push('substituitions'); }); arrayRet = [...new Set(arrayRet)]; return arrayRet; } } _100131_api_mutation._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_api_mutation = _100131_api_mutation; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_orgManageProjects extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_orgManageProjects = _100131_api_orgManageProjects; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_projectTrash extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_projectTrash = _100131_api_projectTrash; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_service_histories extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_service_histories = _100131_api_service_histories; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_api_templatePublish extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_api_templatePublish = _100131_api_templatePublish; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_CSS extends l2_html.Base { render() { super.createEL('null'); return this.el; } static findSelectors(widget, searchChildren, onlyCssPage) { return this._findSelectors(widget, searchChildren, onlyCssPage); } static getPrincipalSelectors(widget, searchChildren, onlyCssPage) { return this._getPrincipalSelectors(widget, searchChildren, onlyCssPage); } static gotoSelector(widget, selector, createIfNotExist) { this._gotoSelector(widget, selector, createIfNotExist); } static updateLESSStyle(originalLESS, className, clearCommentsAndAtRules) { return originalLESS; } static deleteLESSStyle(originalLESS, className, onlyIfNotInUse) { return originalLESS; } static mergeStyles(classList, minimize) { return ''; } static minimizeCSS(moveStylesToClass, mergeStylesInDOM, rename) { } static afterCreateID(widget) { } static afterDeleteID(widget, oldID) { } static afterRenameID(widget, oldID) { } static getPropertiesInUse(propertyName) { return this._getPropertiesInUse(propertyName); } static updateRule(cls, changes) { return this._updateRule(cls, changes); } static addRule(selector) { return this._addRule(selector); } static removeRule(selector) { return this._removeRule(selector); } static updateImport(startsWith, newValue) { return this._updateImport(startsWith, newValue); } static getLines(startsWith, selector) { return this._getLines(startsWith, selector); } static openHelperMenu(tpMenu) { return this._openHelperMenu(tpMenu); } static _openHelperMenu(tpMenu) { return new Promise((resolve, reject) => { const widgets = mls.l2.findWidgets('helper_class_buttons_', [mls.actual[4].project, 100131]); const widgetsTags = widgets.filter((wid) => l2_html[wid] && l2_html[wid].tags && l2_html[wid].tags.includes(tpMenu)); if (!widgetsTags) resolve(undefined); const service = mls.services.servicesList[4].filter((item) => item.path === 'service_CSS'); if (!service || !service[0]['label1']) resolve(undefined); const aService = mls.services.getServiceVisibleNotAllwaysVisible(4); let time = 0; let force = false; if (!aService || aService.instance.constructor.name !== 'service_CSS') { service[0]['label1'].click(); time = 800; force = true; } setTimeout(() => { const l4 = window['l4_html']; if (!l4 || !l4.helper_class_buttons || !l4.helper_class_buttons.state.subInstances) resolve(undefined); const inst = l4.helper_class_buttons.state.subInstances.filter((item) => item.constructor.name === widgetsTags[0]); if (!inst || !inst[0] || !inst[0].onUpdateUI || !inst[0].elItem) resolve(undefined); const isOnpenCl = mls.contributions['lastW1HelperClass']; if (!isOnpenCl || isOnpenCl.constructor.name !== widgetsTags[0] || force) inst[0].elItem.click(); resolve(() => inst[0].onUpdateUI()); }, time); }); } static _getPropertiesInUse(propertyName) { const external_OM = l2_html._100131_automation_CSS_OM_Interface; return external_OM.getPropertiesInUse(propertyName); } static _gotoSelector(widget, selector, createIfNotExist) { const modeActual = mls.actual[4].mode; const last = mls.l4.lastHelperPageName; if (modeActual !== 1 || (last !== '_100131_helper_Class' && modeActual === 1)) { let time = 800; this._openHelperClass(); if (mls.contributions.helpers && mls.contributions.helpers.style && mls.contributions.helpers.style.editor) time = 300; setTimeout(() => { const btn = document.querySelector('#helperClassScenary1 #helperClassBtnClass'); if (btn) btn.click(); this._goToSelector2(widget, selector, createIfNotExist); }, time); } else { this._goToSelector2(widget, selector, createIfNotExist); } } static _openHelperClass() { mls.l4.helpers.loadHelper('_100131_helper_Class', 'Style'); } static _goToSelector2(widget, selector, createIfNotExist) { var _a, _b, _c; let cls = ''; const external_LESSEditor = l2_html._100131_automation_CSS_LESS_Interface; const ed = (_c = (_b = (_a = mls.contributions.helpers) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.editor) === null || _c === void 0 ? void 0 : _c.page; if (selector.startsWith(':')) { const arrayClassState = widget.el.className.split(' '); arrayClassState.forEach((c) => { if (!ed) return; if (external_LESSEditor.gotoSelector(ed, '.' + c + selector, false)) cls = '.' + c + selector; }); if (!cls && widget['id'].value) { const idT = widget['id'].value; if (external_LESSEditor.gotoSelector(ed, '#' + idT + selector, false)) cls = '#' + idT + selector; } } else { cls = selector; } if (cls !== '') { external_LESSEditor.gotoSelector(ed, cls, false); return; } if (!createIfNotExist) return; let id = 'mlsId_' + widget.getName() + '_' + widget.position; if (!widget['id'].value) { widget['id'].value = id; mls.l4.updateAfterWidgetChanges(mls.l4.selectedNode, true, true, true, false, true); } else { id = widget['id'].value; } external_LESSEditor.gotoSelector(ed, '#' + id + selector, true); } static _getPrincipalSelectors(widget, searchChildren, onlyCssPage) { const defSelectors = ['hover', 'active', 'focus']; const otherSelectors = this._findSelectors(widget, searchChildren, onlyCssPage); const otherSelectorsSub = []; otherSelectors.forEach((cls) => { cls = cls.replace(/,/g, ' '); cls.split(' ').forEach((c) => { c = c.trim(); if (!c || c.indexOf('after') > -1 || c.indexOf('before') > -1 || c.indexOf(':') < 0) return; if (c.indexOf('::') > 0) otherSelectorsSub.push(c.split('::')[1]); else otherSelectorsSub.push(c.split(':')[1]); }); }); const allSelectors = [...defSelectors, ...otherSelectorsSub]; return [...new Set([...allSelectors])]; } static _updateRule(cls, changes) { const external_CSSOMinterface = l2_html._100131_automation_CSS_OM_Interface; const external_LESSEditor = l2_html._100131_automation_CSS_LESS_Interface; const ed = this._getEditor(true); external_CSSOMinterface.updateRule(cls, mls.l4.selectedNode.el, changes); external_LESSEditor.gotoSelector(ed, cls, false); external_LESSEditor.updateProperties(ed, changes); } static _addRule(selector) { const external_CSSOMinterface = l2_html._100131_automation_CSS_OM_Interface; const external_LESSEditor = l2_html._100131_automation_CSS_LESS_Interface; const ed = this._getEditor(true); external_CSSOMinterface.addRule(selector); external_LESSEditor.addSelector(ed, selector.replace(/[{}]/g, '')); } static _removeRule(selector) { const external_CSSOMinterface = l2_html._100131_automation_CSS_OM_Interface; const external_LESSEditor = l2_html._100131_automation_CSS_LESS_Interface; const ed = this._getEditor(true); if (!ed) return; external_CSSOMinterface.removeRule(selector); external_LESSEditor.deleteSelector(ed, selector); } static _updateImport(startsWith, newValue) { const external_LESSEditor = l2_html._100131_automation_CSS_LESS_Interface; const ed = this._getEditor(true); if (!ed) return; mls.contributions.helpers.style.fireCommunity = true; external_LESSEditor.updateImport(ed, startsWith, newValue); } static _getLines(startsWith, selector) { const external_LESSEditor = l2_html._100131_automation_CSS_LESS_Interface; const ed = this._getEditor(true); if (!ed) return; return external_LESSEditor.getLines(ed, startsWith, selector); } static _getEditor(page) { const contr = mls.contributions; const active = contr.helpers.style.editorActive; let ed; if (active === 'page' || page) { ed = contr.helpers.style.editor.page; } else if (active === 'this') { ed = contr.helpers.style.editor.style; } else if (active !== '') { ed = contr.helpers.style.editor.other; } return ed; } static _findSelectors(widget, searchChildren, onlyCssPage) { if (!widget || !widget.el) return []; const { el } = widget; let arrayRet = []; const external_CSSOMinterface = l2_html._100131_automation_CSS_OM_Interface; arrayRet = external_CSSOMinterface.getClassInUseInEl(el, onlyCssPage); if (searchChildren) { const els = el.querySelectorAll('*'); els.forEach((c) => { arrayRet = [...arrayRet, ...external_CSSOMinterface.getClassInUseInEl(c)]; }); } arrayRet = [...new Set(arrayRet)]; return arrayRet; } } l2_html._100131_automation_CSS = _100131_automation_CSS; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_CSS_LESS_Interface extends l2_html.Base { render() { super.createEL('null'); return this.el; } static getLineInfo(ed) { return this._getLineInfo(ed); } static gotoSelector(ed, selector, createIfNotExist) { return this._gotoSelector(ed, selector, createIfNotExist); } static addSelector(ed, selector) { return this._gotoSelector(ed, selector, true); } static deleteSelector(ed, selector) { return this._deleteSelector(ed, selector); } static updateProperties(ed, changes) { return this._updateProperties(ed, changes); } static updateImport(ed, startsWith, newValue) { return this._updateImport(ed, startsWith, newValue); } static getLines(ed, startsWith, selector) { return this._getLines(ed, startsWith, selector); } static formatLESS(ed, clearBlankLines = true) { this._formatLESS(ed, clearBlankLines); } static unfold(ed) { this._unfold(ed); } static parseLESS(src) { return this._parseLESS(src); } static addEvents(ed) { this._addEvents(ed); } static fixLess(s) { const regexQuotes = /"([^"\\]|\\.|\\\n)*"|'([^'\\]|\\.|\\\n)*'/g; return s .replace(regexQuotes, (match, group) => match.replace(/;/g, '\0')) .replace(/;\s*;/g, ';') .replace(/\r/g, '') .replace(/,[\s.#\d]*{/g, '{') .replace(/;\s*\n/g, '\f\n') .replace(/;\s*\/\//g, '\f//') .replace(/;\s*\/\*/g, '\f/*') .replace(/;/g, ';\n') .replace(/\f\n/g, ';\n') .replace(/\f\/\*/g, '; /*') .replace(/\f\/\//g, '; //') .replace(/\s*{\n/g, '\f\n') .replace(/\s*{\s*\/\//g, '\f//') .replace(/\s*{\s*\/\*/g, '\f/*') .replace(/\s*{/g, ' {\n') .replace(/\f\n/g, ' {\n') .replace(/\f\/\*/g, ' {\n /*') .replace(/\f\/\//g, ' { //') .replace(/\*\/\s*\n/g, '\f') .replace(/\*\//g, '*/\n') .replace(/\f/g, '*/\n') .replace(/\n(\s*)}/g, '\n$1\f') .replace(/}/g, '\n}') .replace(/\f/g, '}') .replace(/}\s*\n/g, '\f\n') .replace(/}/g, '}\n') .replace(/\f\n/g, '}\n') .replace(/\0/g, ';'); } static fixLessIfNecessary(ed) { const s = ed.getModel().getValue(); const s2 = this.fixLess(s); if (s !== s2) { const change = { range: new monaco.Range(1, 1, 999999, 999999), text: s2 }; ed.executeEdits('fixLess', [change]); return true; } return false; } static _isModelLess(ed) { return (ed && typeof ed.getModel === 'function' && ed.getModel().getModeId() === 'less'); } static _addEvents(ed) { if (!this._isModelLess(ed)) return; if (ed['mlsDidChangeCursor']) ed['mlsDidChangeCursor'].dispose(); ed['mlsDidChangeCursor'] = ed.onDidChangeCursorPosition((e) => { if (e.reason !== monaco.editor.CursorChangeReason.Explicit) return; const { lineNumber } = e.position; this._decorateBlock(ed, lineNumber, false); }); } static _decorateBlock(ed, lineNumber, fold) { const blkLines = this._getBlockInfo(ed, lineNumber); if (!blkLines) decorateBlocksOnCursor(lineNumber, lineNumber); else { decorateBlocksOnCursor(blkLines.firstLine, blkLines.lastLine); if (fold) foldBlkBeforeAndAfter(ed.getModel(), blkLines.firstLine - 1, blkLines.lastLine + 1); } function decorateBlocksOnCursor(firstLine, lastLine) { ed['mlsOldDecorationsBlk'] = ed.deltaDecorations(ed['mlsOldDecorationsBlk'] ? ed['mlsOldDecorationsBlk'] : [], [ { range: new monaco.Range(firstLine, 1, lastLine, 1), options: { isWholeLine: true, linesDecorationsClassName: 'mlsSelectedScroll' } } ]); } function foldBlkBeforeAndAfter(model, str, end) { const rc = []; if (str > 1) rc.push({ start: 1, end: str, kind: monaco.languages.FoldingRangeKind.Region }); if (end < model.getLineCount()) rc.push({ start: end, end: model.getLineCount(), kind: monaco.languages.FoldingRangeKind.Region }); model['mlsFolding'] = rc; if (ed['mlsDisposeFolding']) ed['mlsDisposeFolding'].dispose(); ed['mlsDisposeFolding'] = monaco.languages.registerFoldingRangeProvider('less', { provideFoldingRanges: (md) => (md && md['mlsFolding'] ? md['mlsFolding'] : undefined) }); ed.getAction('editor.unfoldAll').run().then(() => ed.getAction('editor.foldAllMarkerRegions').run()); } } static _parseLESS(src) { src = this.fixLess(src); return { src, blks: this._getLESSBlocks2(src) }; } static _getLESSBlocks(ed) { if (!this._isModelLess(ed)) return []; if (ed.getModel().getVersionId() === ed.getModel()['_lessBlockVersion']) return ed.getModel()['_lessBlockCache']; this.fixLessIfNecessary(ed); const blks = this._getLESSBlocks2(ed.getModel().getValue()); ed.getModel()['_lessBlockVersion'] = ed.getModel().getVersionId(); ed.getModel()['_lessBlockCache'] = blks; return blks; } static _getLESSBlocks2(src) { const lines = ['', ...src.split('\n')]; let ln = 1; let blockIndent = 1; const linesBody = []; const blks = getBlocks(); if (linesBody.length > 0) { blks.unshift({ selector: '@withoutBlocks', comments: [], ranges: linesBody.map((vv) => new monaco.Range(vv, 0, vv, 0)), children: [] }); } return blks; function getBlocks() { let rc = { selector: '', comments: [], ranges: [], children: [] }; const rcs = []; let inBlock = false; let inComment = false; for (let i = ln; i < lines.length; i++) { if (!inComment) { const sc = lines[i].indexOf('/*'); if (sc >= 0) { rc.comments.push(new monaco.Range(i, sc, i, sc)); inComment = true; } } if (inComment) { const se = lines[i].indexOf('*/'); if (se >= 0) { const r1 = rc.comments[rc.comments.length - 1]; rc.comments[rc.comments.length - 1] = new monaco.Range(r1.startLineNumber, r1.startColumn, i, se); inComment = false; if (r1.startLineNumber !== i) { rc.ranges.push(new monaco.Range(ln, 0, r1.startLineNumber, 0)); ln = i + 1; continue; } } else continue; } if (haveEndBlock(lines[i])) { if (inBlock) { addRange(i); inBlock = false; continue; } ln = i - 1; return rcs; } if (!haveStartBlock(lines[i])) { if (!inBlock && blockIndent === 1) linesBody.push(i); continue; } if (inBlock) { rc.ranges.push(new monaco.Range(ln, 0, i - 1, 0)); ln = i; blockIndent += 1; const lnOld = ln; rc.children = rc.children.concat(getBlocks()); blockIndent -= 1; if (ln >= lines.length || haveEndBlock(lines[ln])) ln += 1; if (ln !== lnOld) i = ln - 1; } else { ln = i; rc.selector += getSelector(lines[i]); inBlock = true; } } return rcs; function addRange(i) { rc.ranges.push(new monaco.Range(ln, 0, i, 0)); ln = i + 1; rcs.push(rc); rc = { selector: '', comments: [], ranges: [], children: [] }; } } function getSelector(line) { if (line.indexOf('//') > 0) line = line.substring(0, line.indexOf('//')); if (line.indexOf('/*') > 0) line = line.substring(0, line.indexOf('/*')); return line.replace('{', '').trim(); } function haveStartBlock(line) { return line.indexOf('{') >= 0; } function haveEndBlock(line) { return line.indexOf('}') >= 0; } } static _getLineInfo(ed) { const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1) return undefined; const { lineNumber } = ed.getPosition(); if (lineNumber < 1) return undefined; return this._getInfo(ed.getModel().getLineContent(lineNumber), blks, lineNumber); } static _getInfo(line, blks, lineNumber) { for (let i = 0; i < blks.length; i++) { for (let j = 0; j < blks[i].ranges.length; j++) { const r1 = blks[i].ranges[j]; if (lineNumber >= r1.startLineNumber && lineNumber <= r1.endLineNumber) { const ret = this._getCSSProp(line); return { lineNumber, path: [], selector: blks[i].selector, propName: ret.propName, value: ret.value, isFirstLine: lineNumber === blks[i].ranges[0].startLineNumber, isLastLine: lineNumber === blks[i].ranges[blks[i].ranges.length - 1].endLineNumber }; } } for (let j = 0; j < blks[i].comments.length; j++) { const r1 = blks[i].comments[j]; if (lineNumber >= r1.startLineNumber && lineNumber <= r1.endLineNumber) { return { lineNumber, path: [], selector: blks[i].selector, propName: '', value: '', isFirstLine: false, isLastLine: false }; } } const r2 = this._getInfo(line, blks[i].children, lineNumber); if (r2) { r2.path.unshift(blks[i].selector); return r2; } } return undefined; } static _getBlockInfo(ed, lineNumber) { const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1) return undefined; const info = this._getInfo(ed.getModel().getLineContent(lineNumber), blks, lineNumber); if (info) { const blk = this._findSelector(info.path, info.selector, blks); if (blk) { const firstLine = blk.ranges[0].startLineNumber; const lastLine = blk.ranges[blk.ranges.length - 1].endLineNumber; return { firstLine, lastLine }; } } return undefined; } static _findProperty(ed, blk, propName) { propName = propName.endsWith(':') ? propName.substring(0, propName.length - 1) : propName; propName = propName.trim(); for (let j = 0; j < blk.ranges.length; j++) { for (let k = blk.ranges[j].startLineNumber; k <= blk.ranges[j].endLineNumber; k++) { const line = ed.getModel().getLineContent(k); const ret = this._getCSSProp(line); if (propName === ret.propName) return k; } } return 0; } static _findSelector(path, selector, blks) { for (let i = 0; i < blks.length; i++) { const sel = blks[i].selector; if (path.length > 0) { if (sel === path[0]) return this._findSelector(path.slice(1), selector, blks[i].children); continue; } if (sel === selector) return blks[i]; if (selector.startsWith(sel)) { let nextSelector = selector.substr(sel.length); if (nextSelector.startsWith(' ')) nextSelector = nextSelector.substr(1); else nextSelector = '&' + nextSelector; const blk = this._findSelector([], nextSelector, blks[i].children); if (blk) return blk; } if (sel.indexOf(selector) >= 0) { const sels = sel.split(','); for (let j = 0; j < sels.length; j++) { if (sels[j].trim() === selector) return blks[i]; } } } return undefined; } static _getCSSProp(line) { if (line.indexOf('//') > 0) line = line.substring(0, line.indexOf('//')); if (line.indexOf('/*') > 0) line = line.substring(0, line.indexOf('/*')); line = line.trim(); const s1 = line.indexOf(':'); if (s1 > 0) { return { propName: line.substring(0, s1), value: line.endsWith(';') ? line.substring(s1 + 1, line.length - 1) : line.substring(s1 + 1) }; } return { propName: '', value: '' }; } static _updateProperties(ed, changes) { if (!this._isModelLess(ed)) return false; const { lineNumber } = ed.getPosition(); if (lineNumber < 1) return false; const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1) return false; const info = this._getInfo(ed.getModel().getLineContent(lineNumber), blks, lineNumber); if (!info) return false; const blk = this._findSelector(info.path, info.selector, blks); if (!blk) return false; const that = this; const lastLine = blk.ranges[blk.ranges.length - 1].endLineNumber; let indent = ''; if (lastLine > 1) indent = ed.getModel().getLineContent(lastLine - 1).match(/^\s*/)['0']; const opChanges = []; const opRemoves = []; changes.forEach((change) => makeChange(change)); opRemoves.sort().reverse().forEach((ln) => deleteProp(ln)); if (opChanges.length > 0) return ed.executeEdits('updateProps', opChanges); return false; function makeChange(change) { const { newValue } = change; const propName = change.pName.endsWith(':') ? change.pName : change.pName + ':'; const ln = that._findProperty(ed, blk, propName); if (ln < 1) addProp(propName, newValue); else if (!newValue) opRemoves.push(ln); else replaceProp(ln, propName, newValue); } function addProp(propName, newValue) { if (!newValue) return; opChanges.push({ range: new monaco.Range(lastLine, 1, lastLine, 1), text: indent + propName + ' ' + newValue + ';\n' }); } function replaceProp(ln, propName, newValue) { const line = ed.getModel().getLineContent(ln); const c1 = line.indexOf(propName) + propName.length; const prefix = line.substring(0, c1) + ' '; const c2a = line.indexOf(';', c1); const c2b = line.indexOf('//', c1); const c2 = c2a > c1 ? Math.min(c2a, c2b > c1 ? c2b : c2a) : c2b; let sufix = c2 < c1 ? ';' : line.substring(c2); sufix = sufix.indexOf(';') === 0 ? sufix : ';' + sufix; opChanges.push({ range: new monaco.Range(ln, 1, ln, 999999), text: prefix + newValue + sufix }); } function deleteProp(ln) { opChanges.push({ range: new monaco.Range(ln, 1, ln + 1, 1), text: null }); } } static _updateImport(ed, startsWith, newValue) { if (!this._isModelLess(ed)) return false; let edPos = ed.getPosition(); if (!edPos) edPos = new monaco.Position(1, 1); if (newValue && !newValue.endsWith('\n')) newValue += '\n'; const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1 || blks[0].selector !== '@withoutBlocks') return false; for (let i = 0; i < blks[0].ranges.length; i++) { const lineNumber = blks[0].ranges[i].startLineNumber; const line = ed.getModel().getLineContent(lineNumber); if (startsWith && line && line.startsWith(startsWith)) return repLine(lineNumber, lineNumber + 1); } if (newValue) return repLine(1, 1); return false; function repLine(ln, le) { const opChanges = [{ range: new monaco.Range(ln, 1, le, 1), text: newValue }]; return ed.executeEdits('updateImport', opChanges); } } static _getLines(ed, startsWith, selector) { if (!this._isModelLess(ed)) return []; const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1) return []; const blk = this._findSelector([], selector, blks); if (!blk || !blk.ranges) return []; const lines = []; for (let i = 0; i < blk.ranges.length; i++) { const { startLineNumber, endLineNumber } = blk.ranges[i]; for (let lineNumber = startLineNumber; lineNumber <= endLineNumber; lineNumber++) { const line = ed.getModel().getLineContent(lineNumber); if (line && line.startsWith(startsWith)) lines.push(line); } } return lines; } static _formatLESS(ed, clearBlankLines) { const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1) return; let lines = ed.getModel().getValue().split('\n'); for (let i = 0; i < lines.length; i++) { const lineNumber = i + 1; const info = this._getInfo(lines[i], blks, lineNumber); if (!info) continue; const indent = info.path.length + ((info.selector) ? 1 : 0) + ((info.isFirstLine || info.isLastLine) ? -1 : 0); lines[i] = lines[i].trim(); if (indent > 0 && lines[i].length > 0) lines[i] = (' '.repeat(indent)) + lines[i]; } if (clearBlankLines === true) lines = lines.filter((ln) => ln.length > 0); const opChanges = [ { range: new monaco.Range(1, 1, 999999, 999999), text: lines.join('\n') } ]; ed.executeEdits('formatLess', opChanges); } static _gotoSelector(ed, selector, createIfNotExist) { const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1) return addEnd(); const blk = this._findSelector([], selector, blks); const that = this; if (!blk || !blk.ranges) { return addEnd(); } goto(blk.ranges[0].startLineNumber); return true; function goto(ln) { ed.setScrollLeft(1); ed.setPosition(new monaco.Position(ln, 1)); ed.revealLineInCenter(ln, monaco.editor.ScrollType.Smooth); that._decorateBlock(ed, ln, true); } function addEnd() { if (!createIfNotExist) return false; const ln = ed.getModel().getLineCount() + 1; const opChanges = [ { range: new monaco.Range(ln, 1, 999999, 999999), text: selector + ' {\n\n}\n' } ]; ed.executeEdits('add', opChanges); goto(ln); that._decorateBlock(ed, ln, true); return true; } } static _unfold(ed) { ed.getAction('editor.unfoldAll').run(); } static _deleteSelector(ed, selector) { const blks = this._getLESSBlocks(ed); if (!blks || blks.length < 1) return false; const blk = this._findSelector([], selector, blks); if (!blk || !blk.ranges) return false; const firstLine = blk.ranges[0].startLineNumber; const lastLine = blk.ranges[blk.ranges.length - 1].endLineNumber; const opChanges = [ { range: new monaco.Range(firstLine, 1, lastLine + 1, 1), text: '' } ]; return ed.executeEdits('del', opChanges); } } l2_html._100131_automation_CSS_LESS_Interface = _100131_automation_CSS_LESS_Interface; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_CSS_OM_Interface extends l2_html.Base { static getClassInUse() { return this._getClassInUse(); } static getClassInUseInEl(el, onlyCssPage) { return this._getClassInUseInEl(el, onlyCssPage); } static minifyStyles(renameClassName, level, deleteOthersAndUpdatePreview) { return ''; } static getPropertiesInUse(propertyName) { return this._getPropertiesInUse(propertyName); } static getCssOMEl(cls, el) { return this._getCssOMEl(cls, el); } static addRule(cssText, callBack) { this._addRule(cssText, callBack); } static removeRule(selectorTex, callBack) { this._removeRule(selectorTex, callBack); } static updateRule(cls, el, changes, callBack) { if (!cls || !el || !changes) return; this._updateRule(cls, el, changes, callBack); } static getCSSStyleRuleClassName(selector) { if (selector === 'this') return []; if (!selector.startsWith('.')) selector = '.' + selector; const sheets = mls.l4.toolbar.pageDOC.styleSheets; const myRules = []; for (const i in sheets) { try { if (!sheets[i]) continue; const rules = sheets[i]['rules'] || sheets[i]['cssRules']; for (const r in rules) { const nameCls = rules[r]['selectorText']; const clsText = rules[r]['cssText']; if (nameCls && (clsText.indexOf(selector + ' ') > -1 || clsText.indexOf(selector + ',') > -1)) myRules.push(rules[r]); } } catch (e) { continue; } } return myRules; } static _getClassInUse() { if (!mls.l4.toolbar.pageDOC) { console.log('No l4 found'); return []; } const el = mls.l4.toolbar.pageDOC.querySelector('body'); let rulesArray = []; rulesArray = this.getRulesStyleInEl(el, rulesArray); rulesArray = [...new Set(rulesArray)]; return this.forRulesToIClassesInUse(rulesArray); } static getCssPage() { if (!mls.l4.toolbar.pageDOC) return undefined; const sheets = mls.l4.toolbar.pageDOC.styleSheets; let cssPage; for (const i in sheets) { if (cssPage) continue; const el = sheets[i].ownerNode; if (!el) continue; if (el.getAttribute('origin') && el.getAttribute('origin') === 'cssPage') { cssPage = sheets[i]; } } return cssPage; } static getRulesStyleInEl(el, rulesArray) { rulesArray = rulesArray.concat(this.getRulesStyleInEl2(el)); rulesArray = [...new Set(rulesArray)]; for (let i = 0; i < el.children.length; i++) { const array = this.getRulesStyleInEl(el.children[i], rulesArray); rulesArray = rulesArray.concat(array); } return rulesArray; } static getRulesStyleInEl2(elNode) { const sheets = mls.l4.toolbar.pageDOC.styleSheets; const myRules = []; for (const i in sheets) { const rules = sheets[i]['rules'] || sheets[i]['cssRules']; for (const r in rules) { if (elNode.matches(rules[r]['selectorText'])) myRules.push(rules[r]); } } return myRules; } static forRulesToIClassesInUse(array) { const obj = {}; const ret = []; array.forEach((item) => { const href = item.parentStyleSheet.href ? item.parentStyleSheet.href : 'cssPage'; if (obj[item.selectorText]) { obj[item.selectorText].origins.push(href); } else { obj[item.selectorText] = { origins: [href] }; } }); Object.keys(obj).forEach((item) => { const objClass = {}; objClass.className = item; objClass.origins = obj[item].origins; ret.push(objClass); }); return ret; } static _getPropertiesInUse(propertyName) { if (!mls.l4.toolbar.pageDOC) { console.log('No l4 found'); return []; } if (!propertyName) return []; let arrayRet = []; arrayRet = this.getRulePropertiesInEl(propertyName); return arrayRet; } static getRulePropertiesInEl(prop) { const sheets = mls.l4.toolbar.pageDOC.styleSheets; const els = mls.l4.toolbar.pageDOC.body.querySelectorAll('*'); const arrayRules = []; const arrayRet = []; const obj = {}; const addObj = (propName, style) => { const vl = style[propName]; obj[vl] = obj[vl] ? obj[vl] + 1 : 1; }; for (const i in sheets) { const rules = sheets[i]['rules'] || sheets[i]['cssRules']; for (const r in rules) { if (!rules[r]['style']) continue; const style = rules[r]['style']; const v = style[prop] ? style[prop] : ''; if (v.length > 0) arrayRules.push(rules[r]); } } els.forEach((el) => { if (!(el instanceof HTMLElement)) return; if (el.style[prop] !== '') { addObj(prop, el.style); } arrayRules.forEach((rule) => { if (rule.selectorText && el.matches(rule.selectorText)) { addObj(prop, rule.style); arrayRules.forEach((r) => { if (r.selectorText && r.selectorText.indexOf(rule.selectorText + ':') >= 0) addObj(prop, r.style); }); } }); }); Object.keys(obj).forEach((item) => { arrayRet.push({ value: item, counter: obj[item] }); }); return arrayRet; } static _getCssOMEl(cls, el) { if (!cls || !el) return undefined; const sheets = mls.l4.toolbar.pageDOC.styleSheets; let sheetRet; let sheetRetState; let stateCls; let clsState; if (cls === 'this') return el.style; cls = cls.startsWith('.') ? cls : '.' + cls; if (cls.indexOf(':') > -1) { stateCls = cls.split(':')[1] ? cls.split(':')[1].trim() : undefined; clsState = cls.split(':')[0] ? cls.split(':')[0].trim() : undefined; clsState = clsState.startsWith('.') ? clsState : '.' + clsState; } for (const i in sheets) { try { if (sheetRet) continue; const rules = sheets[i]['rules'] || sheets[i]['cssRules']; for (const r in rules) { if (sheetRet || !rules[r]['selectorText']) continue; const clsText = rules[r]['cssText']; const clsName = rules[r]['selectorText']; if (clsName.indexOf(cls) > -1 && (clsText.indexOf(cls + ' ') > -1 || clsText.indexOf(cls + ',') > -1)) { sheetRet = rules[r]['style']; } if ((clsText.indexOf(clsState + ' ') > -1 || clsText.indexOf(clsState + ',') > -1 || clsText.indexOf(clsState + ':') > -1) && clsName.indexOf(stateCls) > -1) { sheetRet = rules[r]['style']; } } } catch (e) { continue; } } if (!sheetRet && sheetRetState && cls.indexOf(':') > -1) sheetRet = sheetRetState; return sheetRet; } static _addRule(cssText, callBack) { if (!cssText || !mls.l4.toolbar.pageDOC) return; mls.l2.compileLess(cssText).then((out) => { const cssPage = this.getCssPage(); if (cssPage) cssPage.insertRule(cssText); }).catch((e) => { }); } static _removeRule(selectorTex, callBack) { if (!selectorTex || !mls.l4.toolbar.pageDOC) return; let indexDel; const cssPage = this.getCssPage(); if (!cssPage) return; for (let i = 0; i < cssPage.rules.length; i++) { const item = cssPage.rules[i]; if (item.selectorText && item.selectorText === selectorTex) indexDel = i; } if (cssPage && indexDel !== undefined) cssPage.removeRule(indexDel); } static _updateRule(cls, el, changes, callBack) { if (!cls || !el || !changes) return; if (cls === 'this') { changes.forEach((change) => { if (!change.pName) return; el.style[change.pName] = change.newValue; }); return; } const css = this.getCssOMEl(cls, el); if (!css) return; changes.forEach((change) => { if (!change.pName) return; css[change.pName] = change.newValue; }); } static _getClassInUseInEl(el, onlyCssPage) { if (!el) return []; const sheets = mls.l4.toolbar.pageDOC.styleSheets; const arraySub = []; const arrayCls = el.className.split(' '); const arrayRet = []; for (const i in sheets) { if (onlyCssPage && sheets[i]['href']) continue; const rules = sheets[i]['rules'] || sheets[i]['cssRules']; for (const r in rules) { const rule = rules[r]; if (rule.selectorText && rule.selectorText.indexOf(':') > -1) { arraySub.push(rule.selectorText); } } } arrayCls.forEach((cls) => { cls = cls.startsWith('.') ? cls : '.' + cls; arraySub.forEach((s) => { if (s.indexOf(cls + ':') > -1) arrayRet.push(s); }); arrayRet.push(cls); }); return arrayRet; } } l2_html._100131_automation_CSS_OM_Interface = _100131_automation_CSS_OM_Interface; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_Community extends l2_html.Base { static createItensCommunity(prefix, isAddClassWidget) { return this._createItensCommunity(prefix, isAddClassWidget); } static addCssTextAndClass(cssText, clsName, arrayList) { this._addCssTextAndClass(cssText, clsName, arrayList); } static clearClassAndRemoveEditor(arrayDel) { this._clearClassAndRemoveEditor(arrayDel); } static createItensCommunityByName(prefix, widName) { return this._createItensCommunityByName(prefix, widName); } static _createItensCommunity(prefix, isAddClassWidget) { if (!mls.l4.selectedNode) return document.createElement('div'); if (prefix === '_100167_block') { prefix = mls.l4.selectedNode['origin'].value.trim(); } const widName = isAddClassWidget ? mls.l4.selectedNode.getName() : ''; let array = this._getSharedFiles(mls.actual[4].project, widName); array = this._filterClassPrefix(array, prefix, widName); const div = this._createElementCommunity(array); return div; } static _createItensCommunityByName(prefix, widName) { if (!widName) return; let array = this._getSharedFiles(mls.actual[4].project, widName); array = this._filterClassPrefix(array, prefix, widName); const div = this._createElementCommunity(array); return div; } static _getSharedFiles(prjID, widget) { const rc = []; const rcControl = []; mls.l5.getProjectDependencies(prjID, true).forEach((prjDepID) => { mls.actual[0].project = prjDepID; mls.actual[0].path = 'shared'; if (rcControl.indexOf(mls.actual[0].getFullName()) > -1) return; rc.push(this._getSharedFile(mls.actual[0].getFullName())); rcControl.push(mls.actual[0].getFullName()); }); if (widget) rc.unshift(this._getSharedFile(widget)); return rc.filter((o2) => o2 != null); } static _getSharedFile(styleName) { const cache = this._getCache(styleName); if (cache) return cache; if (!mls.l4.styles[styleName]) return undefined; const external_CSSLESS = l2_html._100131_automation_CSS_LESS_Interface; const objInfoBlock = external_CSSLESS.parseLESS(mls.l4.styles[styleName]); const arraySelector = objInfoBlock.blks; const obj = { styleName, childrens: [] }; arraySelector.forEach((itemCls) => { const start = itemCls.ranges[0].startLineNumber - 1; const end = itemCls.ranges[itemCls.ranges.length - 1].endLineNumber - 1; obj.childrens.push({ selector: itemCls.selector, start, end }); }); this._setCache(obj); mls.l4.styles[styleName] = objInfoBlock.src; return obj; } static _setCache(obj) { mls.l4.stylesRootSelectors[obj.styleName] = obj.childrens.map((o2) => o2.selector + ';' + o2.start + ';' + o2.end); } static _getCache(styleName) { if (!mls.l4.stylesRootSelectors[styleName]) return undefined; const obj = { styleName, childrens: [] }; mls.l4.stylesRootSelectors[styleName].forEach((item) => { const array = item.split(';'); obj.childrens.push({ selector: array[0], start: +array[1], end: +array[2] }); }); return obj; } static _filterClassPrefix(array, prefix, widget) { return array .map((objShared) => { const newPrefix = (widget && objShared.styleName === widget) ? '_shared_' : prefix; objShared.childrens = objShared.childrens.filter((c2) => c2.selector.replace(/./, '').startsWith(newPrefix)); return objShared; }) .filter((objShared) => objShared.childrens.length > 0); } static _createElementCommunity(array) { const div = document.createElement('div'); div.className = 'list-group'; div.style.paddingRight = '5px'; div.style.outline = 'none'; div.tabIndex = 0; array.forEach((item) => { if (!item) return; item.childrens.forEach((cls) => { const a = document.createElement('a'); a.innerText = item.styleName + cls.selector.replace('.', '_').replace('__', '_'); a['prj'] = item.styleName; a['cls'] = cls.selector; a.onclick = () => this._onclickItemCommunity(a, a['prj'], a['cls']); a.className = 'list-group-item list-group-item-actiond-flex'; a.style.cssText = 'cursor: pointer; overflow: hidden; text-overflow: ellipsis; width: 100%; min-height:50px'; div.appendChild(a); }); }); div.onkeydown = (ev) => { ev.preventDefault(); let pos = 0; const act = div.querySelector('.activeCommunity'); if (act) pos = Array.prototype.indexOf.call(div.children, act); else { div.children[pos].click(); return; } if (ev.keyCode === 40 && (pos + 1) < div.children.length) { pos += 1; div.children[pos].click(); div.children[pos]['scrollIntoViewIfNeeded'](); } else if (ev.keyCode === 38 && (pos - 1) >= 0) { pos -= 1; div.children[pos].click(); div.children[pos]['scrollIntoViewIfNeeded'](); } }; return div; } static _onclickItemCommunity(el, prjName, clsName) { if (!el) return; const arrayList = this._getListClass(el); if (!prjName || !clsName || !mls.l4.styles[prjName] || !mls.l4.stylesRootSelectors[prjName]) return; clsName = this._addSharedClass(el, prjName, clsName); this._updateClassName(clsName, arrayList); } static _getListClass(el) { if (!el) return []; const parent = el.parentElement; const arrayList = []; if (parent) { const act = parent.querySelector('.activeCommunity'); if (act) act.classList.remove('activeCommunity'); for (let i = 0; i < parent.children.length; i++) { const child = parent.children[i]; if (child) arrayList.push(child.innerText.trim()); } } el.classList.add('activeCommunity'); return arrayList; } static _addCssTextAndClass(cssText, clsName, arrayList) { if (!cssText || !clsName) return; const external_automation = l2_html._100131_automation_CSS_LESS_Interface; const ed = mls.contributions.helpers.style.editor.page; const ret = external_automation.gotoSelector(ed, clsName, false); if (!ret) { const model = ed.getModel(); const text = model.getValue() + '\n' + cssText; model.setValue(text); } this._updateClassName(clsName, arrayList); } static _addSharedClass(el, prjName, clsName) { const external_automation = l2_html._100131_automation_CSS_LESS_Interface; const ed = mls.contributions.helpers.style.editor.page; let strRet = this._getTextShared(el, prjName, clsName); const ret = external_automation.gotoSelector(ed, '.' + el.innerText, false); strRet = strRet.replace(clsName, '.' + el.innerText); clsName = '.' + el.innerText; if (!ret) { const model = ed.getModel(); const text = model.getValue() + '\n' + strRet; model.setValue(text); } return clsName; } static _getTextShared(el, prjName, clsName) { if (!el) return ''; if (!prjName || !clsName || !mls.l4.styles[prjName] || !mls.l4.stylesRootSelectors[prjName]) return ''; let cssText = ''; let start; let end; const arrayLine = mls.l4.styles[prjName].split('\n'); mls.l4.stylesRootSelectors[prjName].forEach((item) => { if (item.indexOf(clsName + ';') < 0) return; const strArray = item.split(';'); start = +strArray[1]; end = +strArray[2]; }); if (start === undefined || end === undefined || start > end) return ''; for (let i = start; i <= end; i++) { cssText += arrayLine[i]; } return cssText; } static _updateClassName(clsName, arrayList) { const classes = Array.from(mls.l4.selectedNode.el.classList); const { el } = mls.l4.selectedNode; clsName = clsName.startsWith('.') ? clsName.substr(1) : clsName; let arrayDel = []; let isExist = false; classes.forEach((cls) => { if (cls === clsName) { el.classList.remove(cls); arrayDel.push(cls.trim()); isExist = true; } if (arrayList.indexOf(cls.trim()) > -1) { el.classList.remove(cls.trim()); arrayDel.push(cls.trim()); } if (clsName.indexOf('_shared_block_') >= 0) { arrayList.forEach((cls2) => { if (cls2.indexOf(cls.trim()) > -1) { el.classList.remove(cls.trim()); arrayDel.push(cls.trim()); } }); } }); arrayDel = [...new Set(arrayDel)]; if (!isExist) { el.classList.add(clsName); } else { clsName = undefined; } const stcClss = mls.l4.selectedNode.el.className.replace('mlsNodeSelected', ''); if (mls.contributions.funcCommunityClass) mls.contributions.funcCommunityClass([clsName], arrayDel); arrayDel.forEach((item) => this._deleteUnusedSelector(item)); } static _clearClassAndRemoveEditor(arrayDel) { if (mls.contributions.funcCommunityClass) mls.contributions.funcCommunityClass([], arrayDel); arrayDel.forEach((item) => this._deleteUnusedSelector(item)); } static _deleteUnusedSelector(clsName) { clsName = clsName.startsWith('.') ? clsName : '.' + clsName; const doc = mls.l4.toolbar.pageDOC; if (doc.querySelectorAll(clsName).length <= 0) { const external_automation = l2_html._100131_automation_CSS_LESS_Interface; const ed = mls.contributions.helpers.style.editor.page; external_automation.deleteSelector(ed, clsName); } } } l2_html._100131_automation_Community = _100131_automation_Community; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_converterHtml extends l2_html.Base { render() { super.createEL('null'); return this.el; } } _100131_automation_converterHtml._SearchDetails = { section: l2_html.PCategories.internal, group: 'js', desc: 'script for converterhtml', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_automation_converterHtml = _100131_automation_converterHtml; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_build extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async build(content, fileName, project, level, variation, percent, el, logsDetails) { const buildW3Service = this.children[0]; const minifyService = this.children[1]; const elBuild = el.querySelector('section').querySelectorAll('.section-services')[1]; const elBuildW3 = elBuild.querySelectorAll('.service-progress')[0]; const elBuildMinify = elBuild.querySelectorAll('.service-progress')[1]; const buildW3Ret = await buildW3Service.buildFile(content, fileName, project, level, variation, percent, elBuildW3, logsDetails); const strRet = await minifyService.minify(buildW3Ret.content, fileName, project, level, buildW3Ret === null || buildW3Ret === void 0 ? void 0 : buildW3Ret.root, percent, elBuildMinify, logsDetails); return strRet; } } _100131_automation_publish_build.title = 'Build'; _100131_automation_publish_build._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishBuildBase'], childrenTags: ['PublishBuildService'], examples: ['{}'] }; l2_html._100131_automation_publish_build = _100131_automation_publish_build; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_build_buildW3 extends l2_html._100131_automation_publish_services_Base { buildFile(content, fileName, project, level, variation, percent, el, logsDetails) { return new Promise((resolve, reject) => { if (level === 4) { this.doBuildL4(content, fileName, project, variation).then((res) => { el.style.cssText = `--i:${percent}%`; this.createLogLine(`L4 building file completed successfully: ${fileName}`, logsDetails); const newHtml = this.replaceVersion(res.dst_HTML); resolve({ content: newHtml, root: res.dst_rootWidget }); }).catch((err) => { this.createLogLine(`L4 building file failed: ${fileName}`, logsDetails); reject(err); }); } else if (level === 3) { const filePath = `/l3/_${project}_` + fileName; this.doBuildL3(filePath).then((res) => { this.createLogLine(`L3 building file completed successfully: ${fileName}`, logsDetails); el.style.cssText = `--i:${percent}%`; resolve({ content: res }); }).catch((err) => { this.createLogLine(`L3 building file failed: ${fileName}`, logsDetails); reject(err); }); } else { reject(new Error('Invalid level')); } }); } replaceVersion(str) { return str['replaceAll']('[mlsVersion]', new Date().getTime().toString()); } async doBuildL4(contents, fileName, pagePrj, variationN) { var _a, _b; const h = ((_a = contents[0]) === null || _a === void 0 ? void 0 : _a.content) || ''; const j = ((_b = contents[1]) === null || _b === void 0 ? void 0 : _b.content) || ''; const options = { pageName: fileName.replace('.html', ''), prjID: pagePrj, variationIndex: variationN, optionalL4TS: j, src_JSON: h }; const compile = await mls.l4.compile(options); return compile; } async doBuildL3(fileName) { return new Promise((resolve, reject) => { const arrayBufferToBinary = (buffer) => { let binary = ''; const bytes = [].slice.call(new Uint8Array(buffer)); bytes.forEach((b) => binary += String.fromCharCode(b)); return binary; }; fetch(fileName).then((response) => { response.arrayBuffer().then((buffer) => { const content = arrayBufferToBinary(buffer); resolve(content); }); }); }); } } _100131_automation_publish_build_buildW3.title = 'Build - Copy L4 Files'; _100131_automation_publish_build_buildW3.desc = 'This action build process all html pages from your project'; _100131_automation_publish_build_buildW3.image = '/l3/_100131_/images/addon_WebGeral/build.png'; _100131_automation_publish_build_buildW3._SearchDetails = { desc: 'BuildW3', section: l2_html.PCategories.internal, parentTags: ['PublishBuildBase'], tags: ['PublishBuildService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_build_buildW3 = _100131_automation_publish_build_buildW3; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_build_buildW3_mls2 extends l2_html._100131_automation_publish_services_Base { buildFile(content, fileName, project, level, variation, percent, el, logsDetails) { return new Promise((resolve, reject) => { if (level === 4) { this.doBuildL4(content, fileName, project, variation).then((res) => { el.style.cssText = `--i:${percent}%`; this.createLogLine(`L4 building file completed successfully: ${fileName}`, logsDetails); const newHtml = this.replaceVersion(res.dst_HTML); resolve({ content: newHtml, root: res.dst_rootWidget }); }).catch((err) => { this.createLogLine(`L4 building file failed: ${fileName}`, logsDetails); reject(err); }); } else if (level === 3) { const filePath = `/l3/_${project}_` + fileName; this.doBuildL3(filePath).then((res) => { this.createLogLine(`L3 building file completed successfully: ${fileName}`, logsDetails); el.style.cssText = `--i:${percent}%`; resolve({ content: res }); }).catch((err) => { this.createLogLine(`L3 building file failed: ${fileName}`, logsDetails); reject(err); }); } else { reject(new Error('Invalid level')); } }); } replaceVersion(str) { return str['replaceAll']('[mlsVersion]', new Date().getTime().toString()); } async doBuildL4(contents, fileName, pagePrj, variationN) { var _a, _b; const h = ((_a = contents[0]) === null || _a === void 0 ? void 0 : _a.content) || ''; const j = ((_b = contents[1]) === null || _b === void 0 ? void 0 : _b.content) || ''; const options = { pageName: fileName.replace('.html', ''), prjID: pagePrj, variationIndex: variationN, optionalL4TS: j, src_JSON: h }; const compile = await mls.l4.compile(options); return compile; } async doBuildL3(fileName) { return new Promise((resolve, reject) => { const arrayBufferToBinary = (buffer) => { let binary = ''; const bytes = [].slice.call(new Uint8Array(buffer)); bytes.forEach((b) => binary += String.fromCharCode(b)); return binary; }; fetch(fileName).then((response) => { response.arrayBuffer().then((buffer) => { const content = arrayBufferToBinary(buffer); resolve(content); }); }); }); } } _100131_automation_publish_build_buildW3_mls2.title = 'Build - Copy L4 Files'; _100131_automation_publish_build_buildW3_mls2.desc = 'This action build process all html pages from your project'; _100131_automation_publish_build_buildW3_mls2.image = '/l3/_100131_/images/addon_WebGeral/build.png'; _100131_automation_publish_build_buildW3_mls2._SearchDetails = { desc: 'BuildW3', section: l2_html.PCategories.internal, parentTags: ['PublishBuildBase'], tags: ['PublishBuildService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_build_buildW3_mls2 = _100131_automation_publish_build_buildW3_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_build_minify extends l2_html._100131_automation_publish_services_Base { constructor() { super(...arguments); this.unusedCss = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'enabled/disabled unused css', elType: 'none', }); this.ignoreList = new l2_fieldTypes.Input(this, { desc: '(string[]): provide a list of selectors that should not be removed by UnCSS.', type: 'text', group: 'principal', }); this.minifyHtml = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'enabled/disabled minify html. Obs: If disabled, its not possible to reduce css', elType: 'none', }); this.minifyJs = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'enabled/disabled minify javascript', elType: 'none', }); this.minifyCss = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'enabled/disabled minify css', elType: 'none', }); } minify(htmlStr, fileName, project, level, root, percent, el, logsDetails) { return new Promise((resolve, reject) => { if (level !== 4) { el.style.cssText = `--i:${percent}%`; resolve(htmlStr); return; } this.execMinify(htmlStr, project, root).then((res) => { el.style.cssText = `--i:${percent}%`; this.createLogLine(`L4 minify file completed successfully: ${fileName}`, logsDetails); resolve(res); }).catch((err) => { this.createLogLine(`L4 minify file failed: ${fileName}`, logsDetails); reject(err); }); }); } async execMinify(htmlStr, project, root) { var _a, _b; const ignoreList = this.ignoreList.value ? this.ignoreList.value : '[]'; const libs = ((_b = (_a = root === null || root === void 0 ? void 0 : root.children[0]) === null || _a === void 0 ? void 0 : _a['_libs']) === null || _b === void 0 ? void 0 : _b.css) || []; const joinCss = libs.map((lib) => lib.href); const args = { cssStyleList: JSON.stringify(joinCss), ignoreList, minifyJs: this.minifyJs.value === '' ? true : this.minifyJs.value, minifyCss: this.minifyCss.value === '' ? true : this.minifyCss.value, minifyHTML: this.minifyHtml.value === '' ? true : this.minifyHtml.value, unusedCss: this.unusedCss.value === '' ? true : this.unusedCss.value, module: 'l4', project, html: htmlStr, comm: 'minifyHTML' }; return new Promise((resolve, reject) => { mls.services.execServerTasks('minify', args).then((response) => { resolve(response); }).catch((reason) => { reject(reason); }); }); } } _100131_automation_publish_build_minify.title = 'Minify HTML'; _100131_automation_publish_build_minify.desc = 'This action removes unused CSS from your stylesheets and minify HTML,Javascript and CSS'; _100131_automation_publish_build_minify.image = '/l3/_100131_/images/addon_WebGeral/minifier.jpg'; _100131_automation_publish_build_minify._SearchDetails = { desc: 'BuildW3Minify', section: l2_html.PCategories.internal, parentTags: ['PublishBuildBase'], tags: ['PublishBuildService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_build_minify = _100131_automation_publish_build_minify; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_build_mls2 extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async build(content, fileName, project, level, variation, percent, el, logsDetails) { const buildW3Service = this.children[0]; const elBuild = el.querySelector('section').querySelectorAll('.section-services')[1]; const elBuildW3 = elBuild.querySelectorAll('.service-progress')[0]; const buildW3Ret = await buildW3Service.buildFile(content, fileName, project, level, variation, percent, elBuildW3, logsDetails); return buildW3Ret.content; } } _100131_automation_publish_build_mls2.title = 'Build'; _100131_automation_publish_build_mls2._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishBuildBase'], childrenTags: ['PublishBuildService'], examples: ['{}'] }; l2_html._100131_automation_publish_build_mls2 = _100131_automation_publish_build_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_build_uncss extends l2_html._100131_automation_publish_services_Base { constructor() { super(...arguments); this.enabled = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'enabled/disabled uncss', elType: 'none', }); this.ignoreList = new l2_fieldTypes.Input(this, { desc: '(string[]): provide a list of selectors that should not be removed by UnCSS.', type: 'text', group: 'principal', }); } uncss(htmlStr, fileName, project, level, root, percent, el, logsDetails) { return new Promise((resolve, reject) => { if (!this.enabled) { resolve(htmlStr); return; } if (level !== 4) { el.style.cssText = `--i:${percent}%`; console.info('N�o � um arquivo L4'); resolve(htmlStr); return; } this.execUncss(htmlStr, project, root).then((res) => { el.style.cssText = `--i:${percent}%`; this.createLogLine(`L4 uncss file completed successfully: ${fileName}`, logsDetails); console.info('Novo html'); console.info(res); resolve(res); }).catch((err) => { this.createLogLine(`L4 uncss file failed: ${fileName}`, logsDetails); reject(err); }); }); } async execUncss(htmlStr, project, root) { var _a, _b; const ignoreList = this.ignoreList.value ? this.ignoreList.value : '[]'; const libs = ((_b = (_a = root === null || root === void 0 ? void 0 : root.children[0]) === null || _a === void 0 ? void 0 : _a['_libs']) === null || _b === void 0 ? void 0 : _b.css) || []; const joinCss = libs.map((lib) => lib.href); console.info(JSON.stringify(joinCss)); const args = { html: htmlStr, cssStyleList: JSON.stringify(joinCss), ignoreList, module: 'l4', path: '', project, comm: 'purgeCss' }; return new Promise((resolve, reject) => { mls.services.execServerTasks('purgeCSS', args).then((response) => { resolve(response); }).catch((reason) => { reject(reason); }); }); } } _100131_automation_publish_build_uncss.title = 'Uncss - Remove CSS unused'; _100131_automation_publish_build_uncss.desc = 'This action removes unused CSS from your stylesheets'; _100131_automation_publish_build_uncss.image = '/l3/_100131_/images/addon_WebGeral/unusedCss.jpg'; _100131_automation_publish_build_uncss._SearchDetails = { desc: 'BuildW3', section: l2_html.PCategories.internal, parentTags: ['PublishBuildBase'], tags: ['PublishBuildService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_build_uncss = _100131_automation_publish_build_uncss; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_delete_amazonS3_mls2 extends l2_html._100131_automation_publish_services_Base { constructor() { super(...arguments); this.enabled = new l2_fieldTypes.EnumList(this, { desc: 'enabled verified olds version check. Default:false', list: ['true', 'false'], group: 'principal', }); this.timeToCheck = new l2_fieldTypes.Input(this, { desc: 'Define the time default in hours to check older versions to delete. Default: 24', type: 'number', group: 'principal', }); this._s3 = {}; this._lastBucketValidate = []; } async getListObjectToDeleteAndRemove(el, logsDetails) { const progress = el === null || el === void 0 ? void 0 : el.querySelectorAll('.service-progress')[1]; if (this.enabled.value === 'false' || this.enabled.value === '') { if (progress) progress.style.cssText = `--i:100%`; return; } await this.connect('', logsDetails); const list = await this.getListObjectToDelete2(logsDetails); const totalFiles = list.length; this.createLogLine(`Total files to remove: ${totalFiles} `, logsDetails); if (totalFiles === 0) { if (progress) progress.style.cssText = `--i:100%`; return; } let totalAtual = 0; for (const key of list) { await this.removeFileOnS3('', key, logsDetails); totalAtual += 1; const percent = (100 / totalFiles) * (totalAtual); if (progress) progress.style.cssText = `--i:${percent}%`; } } async connect(subdom, logsDetails) { const infoAwsS3 = mls.l5['pageNodes'].children[0].children[2].children[0]; const bucket = subdom + infoAwsS3.domain.value; await this.getAwsSDK(); this.setConnectionConfig(infoAwsS3.accessKeyId.value, infoAwsS3.secretAccessKey.value, bucket, infoAwsS3.region.value); return new Promise((resolve, reject) => { if (this._lastBucketValidate.includes(bucket)) { resolve(); return; } this.checkBucketExist(bucket).then(async () => { this._lastBucketValidate.push(bucket); this.createLogLine(`Connect on bucket: ${bucket}`, logsDetails); resolve(); }).catch((err) => { this.createLogLine(`Error on connect to bucket: ${bucket}`, logsDetails); reject(new Error('Error on connect to bucket: ' + bucket)); }); }); } getAwsSDK() { const req = window['require']; req.config({ paths: { AWS: 'https://sdk.amazonaws.com/js/aws-sdk-2.283.1.min', } }); return new Promise((resolve, reject) => { if (!window['AWS']) { req(['AWS'], () => { resolve(); }); } else { resolve(); } }); } setConnectionConfig(accessKeyId, secretAccessKey, bucket, region) { window['AWS'].config.update({ accessKeyId, secretAccessKey }); this._s3 = new window['AWS'].S3({ apiVersion: '2006-03-01', region, params: { Bucket: bucket } }); console.info(this._s3); } checkBucketExist(bucket) { const options = { Bucket: bucket, }; return new Promise((resolve, reject) => { this._s3.headBucket(options, (err, data) => { if (err) reject(err); else resolve(); }); }); } async getListObjectToDelete2(logsDetails) { const infoAwsS3 = mls.l5['pageNodes'].children[0].children[2].children[0]; const listParams = { Prefix: 'www', Bucket: infoAwsS3.domain.value }; return new Promise((resolve, reject) => { const list = []; this._s3.listObjectsV2(listParams, (err, data) => { if (err) { this.createLogLine(`List Object failed: ${listParams.Bucket} : ${err.message}`, logsDetails); resolve(list); } data.Contents.forEach((obj) => { const rc = this.extractDate(obj.Key); if (rc) { const expired = this.convertAndCheck24Hours(rc); if (expired) list.push(obj.Key); } }); this.createLogLine(`List Object completed successfully: ${listParams.Bucket}`, logsDetails); resolve(list); }); }); } removeFileOnS3(subdomain, key, logsDetails) { const infoAwsS3 = mls.l5['pageNodes'].children[0].children[2].children[0]; const deleteParams = { Key: key, Bucket: subdomain + infoAwsS3.domain.value }; return new Promise((resolve, reject) => { this._s3.deleteObject(deleteParams, (err, data) => { if (err) { this.createLogLine(`Remove file failed: ${key} : ${err.message}`, logsDetails); reject(err); } else if (data) { this.createLogLine(`Remove file completed successfully: ${key}`, logsDetails); resolve(data); } }); }); } extractDate(key) { const url = key; const regex = /(\d{14})/; const correspondencia = url.match(regex); if (correspondencia && correspondencia.length > 1) { const data = correspondencia[1]; return data; } return undefined; } convertAndCheck24Hours(dataString) { const year = parseInt(dataString.substr(0, 4), 10); const mounth = parseInt(dataString.substr(4, 2), 10) - 1; const day = parseInt(dataString.substr(6, 2), 10); const hour = parseInt(dataString.substr(8, 2), 10); const minute = parseInt(dataString.substr(10, 2), 10); const seconds = parseInt(dataString.substr(12, 2), 10); const date = new Date(year, mounth, day, hour, minute, seconds); const dateActual = new Date(); const diffInMl = dateActual.getTime() - date.getTime(); const diffInHours = diffInMl / (1000 * 60 * 60); const timeToCheck = this.timeToCheck ? Number.parseInt(this.timeToCheck.value, 10) : 24; return diffInHours >= timeToCheck; } } _100131_automation_publish_delete_amazonS3_mls2.title = 'Amazon S3 - Verified and Delete Older Versions'; _100131_automation_publish_delete_amazonS3_mls2.desc = 'If enabled, the bucket will be analyzed and old versions will be deleted.'; _100131_automation_publish_delete_amazonS3_mls2.image = '/l3/_100131_/images/addon_WebGeral/amazon-s3-logo.png'; _100131_automation_publish_delete_amazonS3_mls2._SearchDetails = { desc: 'S3', section: l2_html.PCategories.internal, parentTags: ['PublishUploadBase'], tags: ['PublishUploadService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_delete_amazonS3_mls2 = _100131_automation_publish_delete_amazonS3_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_finish extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async finish(prepare, manifest, time, detFinish) { this.createLogLine(`Publish finish: <b>${time}</b> milliseconds`, detFinish); prepare.variations.forEach((item) => { const bucket = mls.l5['pageNodes'].children[0].children[2].children[0]['domain'].value; const region = mls.l5['pageNodes'].children[0].children[2].children[0]['region'].value; const dir = mls.l5['pageNodes'].children[0].children[2].children[0]['directory'].value; let _path = item.language.path.endsWith('/') ? item.language.path.substr(0, item.language.path.length - 1) : item.language.path; _path = (!_path.startsWith('/') && _path !== '') ? '/' + _path : _path; const _bucket = bucket.endsWith('/') ? bucket.substr(0, bucket.length - 1) : bucket; let _dir = dir.endsWith('/') ? dir.substr(0, dir.length - 1) : dir; _dir = (!_dir.startsWith('/') && _dir !== '') ? '/' + _dir : _dir; const site = `http://${item.language.path + _bucket}.s3-website-${region}.amazonaws.com${_dir}${_path}`; const endPt = `End Point site: <b>${item.language.path + _bucket}${_dir}${_path}</b> <a target='_blank' href='${site}'>${site}</a>`; this.createLogLine(endPt, detFinish); }); detFinish.open = true; detFinish.scrollIntoView(); await this.saveManifest(manifest); } saveManifest(manifest) { const blob = new Blob([JSON.stringify(manifest)], { type: 'text/plain;charset-utf-8' }); const obj = { ucontent: blob, project: mls.actual[mls.actualLevel].project.toString(), module: 'l3', path: 'addon_Drive.json' }; return new Promise((resolve, reject) => { mls.l3.addOnUploadFile('/settings/manifest.json', obj).then(() => { resolve(); }).catch((err) => { reject(err); }); }); } } _100131_automation_publish_finish.title = 'Finish'; _100131_automation_publish_finish._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishFinishBase'], childrenTags: ['PublishFinishService'], examples: ['{}'] }; l2_html._100131_automation_publish_finish = _100131_automation_publish_finish; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_finish_mls2 extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async finish(prepare, manifest, time, detFinish) { this.createLogLine(`Publish finish: <b>${time}</b> milliseconds`, detFinish); prepare.variations.forEach((item) => { const bucket = mls.l5['pageNodes'].children[0].children[2].children[0]['domain'].value; const region = mls.l5['pageNodes'].children[0].children[2].children[0]['region'].value; const dir = mls.l5['pageNodes'].children[0].children[2].children[0]['directory'].value; let _path = item.language.path.endsWith('/') ? item.language.path.substr(0, item.language.path.length - 1) : item.language.path; _path = (!_path.startsWith('/') && _path !== '') ? '/' + _path : _path; const _bucket = bucket.endsWith('/') ? bucket.substr(0, bucket.length - 1) : bucket; let _dir = dir.endsWith('/') ? dir.substr(0, dir.length - 1) : dir; _dir = (!_dir.startsWith('/') && _dir !== '') ? '/' + _dir : _dir; const site = `http://${item.language.path + _bucket}.s3-website-${region}.amazonaws.com${_dir}${_path}`; const endPt = `End Point site: <b>${item.language.path + _bucket}${_dir}${_path}</b> <a target='_blank' href='${site}'>${site}</a>`; this.createLogLine(endPt, detFinish); }); detFinish.open = true; detFinish.scrollIntoView(); await this.saveManifest(manifest); } saveManifest(manifest) { const blob = new Blob([JSON.stringify(manifest)], { type: 'text/plain;charset-utf-8' }); const obj = { ucontent: blob, project: mls.actual[mls.actualLevel].project.toString(), module: 'l3', path: 'addon_Drive.json' }; return new Promise((resolve, reject) => { mls.l3.addOnUploadFile('/settings/manifest.json', obj).then(() => { resolve(); }).catch((err) => { reject(err); }); }); } } _100131_automation_publish_finish_mls2.title = 'Finish'; _100131_automation_publish_finish_mls2._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishFinishBase'], childrenTags: ['PublishFinishService'], examples: ['{}'] }; l2_html._100131_automation_publish_finish_mls2 = _100131_automation_publish_finish_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_prepare extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async prepare(level, project, path, el, det, platFormsToPublish) { const serviceLanguages = this.children[0]; const servicePrepareFiles = this.children[1]; const elPrepare = el.querySelector('section').querySelectorAll('.section-services')[0]; const progressLanguage = elPrepare.querySelectorAll('.service-progress')[0]; const progressPrepareFiles = elPrepare.querySelectorAll('.service-progress')[1]; progressLanguage.style.cssText = `--i:${10}%`; const variations = await serviceLanguages.getLanguages(det); progressLanguage.style.cssText = `--i:${100}%`; this.createLogLine('Prepare files to publish', det); progressPrepareFiles.style.cssText = `--i:${10}%`; const ret = await servicePrepareFiles.prepareFiles(variations, level, project, path, det, platFormsToPublish); progressPrepareFiles.style.cssText = `--i:${100}%`; return ret; } } _100131_automation_publish_prepare.title = 'Prepare'; _100131_automation_publish_prepare._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishPrepareBase'], childrenTags: ['PublishPrepareService'], examples: ['{}'] }; l2_html._100131_automation_publish_prepare = _100131_automation_publish_prepare; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_prepare_files extends l2_html._100131_automation_publish_services_Base { constructor() { super(...arguments); this.ignorePrepare = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'If true, ignore file verify and publish all files', elType: 'none', }); this._ignoreFiles = ['settings/manifest.json']; } async prepareFiles(variations, level, project, path, fdet, platFormsToPublish) { const allFilesString = await this.readFilesInfo(project); const filesProjectBase = await this.getFilesLib(project); const l4AllPages = await mls.l4.loadAllPages(project); const prjFiles = JSON.parse(allFilesString); const prjFilesBase = JSON.parse(filesProjectBase); const ret = { config: { name: '', short_name: '', start_url: '', display: '', background_color: '', description: '', icons: [], publish: {} }, variations: [] }; const hasSettings = prjFiles.find((item) => item.prefix === 'L3' && item.name === 'settings/manifest.json'); if (hasSettings) { ret.config = await this.readFileManifest(); } if (level === 5) { variations.languages.forEach((language, index) => { const newPublishPrep = {}; newPublishPrep.language = Object.assign({}, language); newPublishPrep.l3 = this.prepareL3Files(prjFiles, newPublishPrep.language.variationNumber, platFormsToPublish, ret.config); newPublishPrep.libs = this.prepareLibs(prjFilesBase, newPublishPrep.language.variationNumber, platFormsToPublish, ret.config); newPublishPrep.l4 = this.prepareL4Files(l4AllPages, prjFiles, newPublishPrep.language.variationNumber, platFormsToPublish, ret.config); ret.variations.push(newPublishPrep); }); } return ret; } prepareLibs(prjBaseFiles, variation, platFormsToPublish, config) { const libs = prjBaseFiles .filter((item) => item.prefix === 'L3') .filter((file) => file.name.startsWith('libs/')) .map((item) => { const obj = { mtime: item.mtime, name: item.name, prefix: item.prefix, size: item.size, needPublish: { amazonS3: false }, }; platFormsToPublish.forEach((plat) => { if (!config.publish || !config.publish[plat] || this.ignorePrepare.value === 'true') { obj.needPublish[plat] = true; } else { const manifestOnLanguage = config.publish[plat].find((manConfig) => manConfig.variation === variation); const actualItem = manifestOnLanguage.libs.find((manifestItem) => manifestItem.name === item.name); if (actualItem) obj.needPublish[plat] = this.checkFileNeedUploadComparingDate(item.mtime, actualItem.mtime); else obj.needPublish[plat] = true; } }); return obj; }); return libs; } prepareL3Files(prjFiles, variation, platFormsToPublish, config) { const l3 = prjFiles .filter((item) => item.prefix === 'L3') .filter((file) => file.name.split('/').length > 1 && (!this._ignoreFiles.includes(file.name))) .map((item) => { const obj = { mtime: item.mtime, name: item.name, prefix: item.prefix, size: item.size, needPublish: { amazonS3: false }, }; platFormsToPublish.forEach((plat) => { if (!config.publish || !config.publish[plat] || this.ignorePrepare.value === 'true') { obj.needPublish[plat] = true; } else { const manifestOnLanguage = config.publish[plat].find((manConfig) => manConfig.variation === variation); const actualItem = manifestOnLanguage.l3.find((manifestItem) => manifestItem.name === item.name); if (actualItem) obj.needPublish[plat] = this.checkFileNeedUploadComparingDate(item.mtime, actualItem.mtime); else obj.needPublish[plat] = true; } }); return obj; }); return l3; } prepareL4Files(l4AllPages, prjFiles, variation, platFormsToPublish, config) { const l4 = prjFiles .filter((item) => item.prefix === 'L4') .map((item) => { const content = l4AllPages.find((itemContent) => itemContent.filename === item.name.split('.').shift()); const obj = { mtime: item.mtime, name: item.name.split('.').shift().concat('.html'), prefix: item.prefix, size: item.size, content: content.contents, needPublish: { amazonS3: false }, }; platFormsToPublish.forEach((plat) => { if (!config.publish || !config.publish[plat] || this.ignorePrepare.value === 'true') { obj.needPublish[plat] = true; } else { const manifestOnLanguage = config.publish[plat].find((manConfig) => manConfig.variation === variation); const actualItem = manifestOnLanguage.l4.find((manifestItem) => manifestItem.name === item.name.split('.').shift().concat('.html')); if (actualItem) obj.needPublish[plat] = this.checkFileNeedUploadComparingDate(item.mtime, actualItem.mtime); else obj.needPublish[plat] = true; } }); return obj; }); return l4; } checkFileNeedUploadComparingDate(dateActual, dateManifest) { const d1 = new Date(dateActual); const d2 = new Date(dateManifest); return d1.getTime() > d2.getTime(); } async readFilesInfo(project) { return new Promise((resolve, reject) => { const args = { arg: 'getFilesToPublish', module: 'l3', project, }; mls.services.execServerTasks('publishWeb', args) .then((retFiles) => { resolve(retFiles); }).catch((error) => { reject(error); }); }); } getFilesLib(project) { const [projectBase] = mls.l5.getProjectDependencies(project, false); return new Promise((resolve, reject) => { const args = { arg: 'getFilesToPublish', module: 'l3', project: projectBase, }; mls.services.execServerTasks('publishWeb', args) .then((retFiles) => { resolve(retFiles); }).catch((error) => { reject(error); }); }); } async readFileManifest() { return new Promise((resolve, reject) => { fetch(`l3/_${mls.actual[mls.actualLevel].project.toString()}_settings/manifest.json`).then((response) => { if (!response.ok) { reject(new Error('Error on read Manifest.json')); return; } response.json().then((json) => { resolve(json); }); }); }); } } _100131_automation_publish_prepare_files.title = 'Prepare files'; _100131_automation_publish_prepare_files.desc = 'This action checks which files need upload'; _100131_automation_publish_prepare_files.image = '/l3/_100131_images/addon_WebGeral/prepare_files.png'; _100131_automation_publish_prepare_files._SearchDetails = { desc: 'Languages', section: l2_html.PCategories.internal, parentTags: ['PublishPrepareBase'], tags: ['PublishPrepareService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_prepare_files = _100131_automation_publish_prepare_files; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_prepare_files_mls2 extends l2_html._100131_automation_publish_services_Base { constructor() { super(...arguments); this.ignorePrepare = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'If true, ignore file verify and publish all files', elType: 'none', }); this._ignoreFiles = ['settings/manifest.json']; } async prepareFiles(variations, level, project, path, fdet, platFormsToPublish) { const allFilesString = await this.readFilesInfo(project); const filesProjectBase = await this.getFilesLib(project); const l4AllPages = await mls.l4.loadAllPages(project); const prjFiles = JSON.parse(allFilesString); const prjFilesBase = JSON.parse(filesProjectBase); const ret = { config: { name: '', short_name: '', start_url: '', display: '', background_color: '', description: '', icons: [], publish: {} }, variations: [] }; const hasSettings = prjFiles.find((item) => item.prefix === 'L3' && item.name === 'settings/manifest.json'); if (hasSettings) { ret.config = await this.readFileManifest(); } if (level === 5) { variations.languages.forEach((language, index) => { const newPublishPrep = {}; newPublishPrep.language = Object.assign({}, language); newPublishPrep.l3 = this.prepareL3Files(prjFiles, newPublishPrep.language.variationNumber, platFormsToPublish, ret.config); newPublishPrep.libs = this.prepareLibs(prjFilesBase, newPublishPrep.language.variationNumber, platFormsToPublish, ret.config); newPublishPrep.l4 = this.prepareL4Files(l4AllPages, prjFiles, newPublishPrep.language.variationNumber, platFormsToPublish, ret.config); ret.variations.push(newPublishPrep); }); } return ret; } prepareLibs(prjBaseFiles, variation, platFormsToPublish, config) { const libs = prjBaseFiles .filter((item) => item.prefix === 'L3') .filter((file) => file.name.startsWith('libs/')) .map((item) => { const obj = { mtime: item.mtime, name: item.name, prefix: item.prefix, size: item.size, needPublish: { amazonS3: false }, }; platFormsToPublish.forEach((plat) => { if (!config.publish || !config.publish[plat] || this.ignorePrepare.value === 'true') { obj.needPublish[plat] = true; } else { const manifestOnLanguage = config.publish[plat].find((manConfig) => manConfig.variation === variation); const actualItem = manifestOnLanguage.libs.find((manifestItem) => manifestItem.name === item.name); if (actualItem) obj.needPublish[plat] = this.checkFileNeedUploadComparingDate(item.mtime, actualItem.mtime); else obj.needPublish[plat] = true; } }); return obj; }); return libs; } prepareL3Files(prjFiles, variation, platFormsToPublish, config) { const l3 = prjFiles .filter((item) => item.prefix === 'L3') .filter((file) => file.name.split('/').length > 1 && (!this._ignoreFiles.includes(file.name))) .map((item) => { const obj = { mtime: item.mtime, name: item.name, prefix: item.prefix, size: item.size, needPublish: { amazonS3: false }, }; platFormsToPublish.forEach((plat) => { if (!config.publish || !config.publish[plat] || this.ignorePrepare.value === 'true') { obj.needPublish[plat] = true; } else { const manifestOnLanguage = config.publish[plat].find((manConfig) => manConfig.variation === variation); const actualItem = manifestOnLanguage.l3.find((manifestItem) => manifestItem.name === item.name); if (actualItem) obj.needPublish[plat] = this.checkFileNeedUploadComparingDate(item.mtime, actualItem.mtime); else obj.needPublish[plat] = true; } }); return obj; }); return l3; } prepareL4Files(l4AllPages, prjFiles, variation, platFormsToPublish, config) { const l4 = prjFiles .filter((item) => item.prefix === 'L4') .map((item) => { const content = l4AllPages.find((itemContent) => itemContent.filename === item.name.split('.').shift()); const obj = { mtime: item.mtime, name: item.name.split('.').shift().concat('.html'), prefix: item.prefix, size: item.size, content: content.contents, needPublish: { amazonS3: false }, }; platFormsToPublish.forEach((plat) => { if (!config.publish || !config.publish[plat] || this.ignorePrepare.value === 'true') { obj.needPublish[plat] = true; } else { const manifestOnLanguage = config.publish[plat].find((manConfig) => manConfig.variation === variation); const actualItem = manifestOnLanguage.l4.find((manifestItem) => manifestItem.name === item.name.split('.').shift().concat('.html')); if (actualItem) obj.needPublish[plat] = this.checkFileNeedUploadComparingDate(item.mtime, actualItem.mtime); else obj.needPublish[plat] = true; } }); return obj; }); return l4; } checkFileNeedUploadComparingDate(dateActual, dateManifest) { const d1 = new Date(dateActual); const d2 = new Date(dateManifest); return d1.getTime() > d2.getTime(); } async readFilesInfo(project) { return new Promise((resolve, reject) => { const args = { arg: 'getFilesToPublish', module: 'l3', project, }; mls.services.execServerTasks('publishWeb', args) .then((retFiles) => { resolve(retFiles); }).catch((error) => { reject(error); }); }); } getFilesLib(project) { const [projectBase] = mls.l5.getProjectDependencies(project, false); return new Promise((resolve, reject) => { const args = { arg: 'getFilesToPublish', module: 'l3', project: projectBase, }; mls.services.execServerTasks('publishWeb', args) .then((retFiles) => { resolve(retFiles); }).catch((error) => { reject(error); }); }); } async readFileManifest() { return new Promise((resolve, reject) => { fetch(`l3/_${mls.actual[mls.actualLevel].project.toString()}_settings/manifest.json`).then((response) => { if (!response.ok) { reject(new Error('Error on read Manifest.json')); return; } response.json().then((json) => { resolve(json); }); }); }); } } _100131_automation_publish_prepare_files_mls2.title = 'Prepare files'; _100131_automation_publish_prepare_files_mls2.desc = 'This action checks which files need upload'; _100131_automation_publish_prepare_files_mls2.image = '/l3/_100131_images/addon_WebGeral/prepare_files.png'; _100131_automation_publish_prepare_files_mls2._SearchDetails = { desc: 'Languages', section: l2_html.PCategories.internal, parentTags: ['PublishPrepareBase'], tags: ['PublishPrepareService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_prepare_files_mls2 = _100131_automation_publish_prepare_files_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_prepare_languages extends l2_html._100131_automation_publish_services_Base { constructor() { super(); this._state = { languages: [] }; this.firstLanguage = [ { language: 'pt-BR', path: '/', variations: [ { type: 'master', enabled: true, subdomain: '', designSystem: '', variation: 0 } ] } ]; this._state.languages = this.getVariations(); this._state.languages.forEach((item) => { const name = `${item.subdomain}${item.language}${item.path}`; this[name] = new l2_fieldTypes.Boolean(this, { sectionName: 'Languages', desc: 'Languages for publish', group: 'principal', }); }); } getLanguages(det) { return new Promise((resolve, reject) => { const ret = { languages: [] }; this._state.languages.forEach((item) => { var _a; const name = `${item.subdomain}${item.language}${item.path}`; if (((_a = this[name]) === null || _a === void 0 ? void 0 : _a.value) === 'true') ret.languages.push(item); }); this.createLogLine(`Prepare variations to publish`, det); resolve(ret); }); } getVariations() { const variations = this.loadLanguages(); const newVariations = []; variations.forEach((lang) => { lang.variations.forEach((vari) => { if (!vari || !vari.enabled) return; const obj = { variationNumber: vari.variation, language: lang.language, path: lang.path, designSystem: vari.designSystem, subdomain: vari.subdomain }; newVariations.push(obj); }); }); return newVariations; } loadLanguages() { const prjDetails = mls.l5.getProjectDetails(mls.actual[mls.actualLevel].project); const userPreferenceValue = (prjDetails === null || prjDetails === void 0 ? void 0 : prjDetails.value) ? JSON.parse(prjDetails.value) : undefined; let languages = this.firstLanguage; if (userPreferenceValue) languages = userPreferenceValue.l5_actionPrjSettings.languages && userPreferenceValue.l5_actionPrjSettings.languages.length > 0 ? JSON.parse(userPreferenceValue.l5_actionPrjSettings.languages) : this.firstLanguage; return languages; } } _100131_automation_publish_prepare_languages.title = 'Languages'; _100131_automation_publish_prepare_languages.desc = 'This action configure languages and sites to publish'; _100131_automation_publish_prepare_languages.image = '/l3/_100131_images/addon_WebGeral/language.png'; _100131_automation_publish_prepare_languages._SearchDetails = { desc: 'Languages', section: l2_html.PCategories.internal, parentTags: ['PublishPrepareBase'], tags: ['PublishPrepareService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_prepare_languages = _100131_automation_publish_prepare_languages; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_prepare_languages_mls2 extends l2_html._100131_automation_publish_services_Base { constructor() { super(); this._state = { languages: [] }; this.firstLanguage = [ { language: 'pt-BR', path: '/', variations: [ { type: 'master', enabled: true, subdomain: '', designSystem: '', variation: 0 } ] } ]; this._state.languages = this.getVariations(); this._state.languages.forEach((item) => { const name = `${item.subdomain}${item.language}${item.path}`; this[name] = new l2_fieldTypes.Boolean(this, { sectionName: 'Languages', desc: 'Languages for publish', group: 'principal', }); }); } getLanguages(det) { return new Promise((resolve, reject) => { const ret = { languages: [] }; this._state.languages.forEach((item) => { var _a; const name = `${item.subdomain}${item.language}${item.path}`; if (((_a = this[name]) === null || _a === void 0 ? void 0 : _a.value) === 'true') ret.languages.push(item); }); this.createLogLine(`Prepare variations to publish`, det); resolve(ret); }); } getVariations() { const variations = this.loadLanguages(); const newVariations = []; variations.forEach((lang) => { lang.variations.forEach((vari) => { if (!vari || !vari.enabled) return; const obj = { variationNumber: vari.variation, language: lang.language, path: lang.path, designSystem: vari.designSystem, subdomain: vari.subdomain }; newVariations.push(obj); }); }); return newVariations; } loadLanguages() { const prjDetails = mls.l5.getProjectDetails(mls.actual[mls.actualLevel].project); const userPreferenceValue = (prjDetails === null || prjDetails === void 0 ? void 0 : prjDetails.value) ? JSON.parse(prjDetails.value) : undefined; let languages = this.firstLanguage; if (userPreferenceValue) languages = userPreferenceValue.l5_actionPrjSettings.languages && userPreferenceValue.l5_actionPrjSettings.languages.length > 0 ? JSON.parse(userPreferenceValue.l5_actionPrjSettings.languages) : this.firstLanguage; return languages; } } _100131_automation_publish_prepare_languages_mls2.title = 'Languages'; _100131_automation_publish_prepare_languages_mls2.desc = 'This action configure languages and sites to publish'; _100131_automation_publish_prepare_languages_mls2.image = '/l3/_100131_images/addon_WebGeral/language.png'; _100131_automation_publish_prepare_languages_mls2._SearchDetails = { desc: 'Languages', section: l2_html.PCategories.internal, parentTags: ['PublishPrepareBase'], tags: ['PublishPrepareService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_prepare_languages_mls2 = _100131_automation_publish_prepare_languages_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_prepare_languages_old extends l2_html._100131_automation_publish_services_Base { constructor() { super(); this._state = { sites: [], languages: [] }; this._state.languages = this.getVariations(); this._state.sites = this.getSites(); this._state.languages.forEach((item) => { this[item.language] = new l2_fieldTypes.Boolean(this, { sectionName: 'Languages', desc: 'Languages for publish', group: 'principal', }); }); this._state.sites.forEach((item) => { this[item.name] = new l2_fieldTypes.Boolean(this, { sectionName: 'Site', desc: 'Sites for publish', group: 'principal', }); }); } getLanguages(det) { return new Promise((resolve, reject) => { const ret = { sites: [], languages: [] }; this._state.languages.forEach((item) => { var _a; if (((_a = this[item.language]) === null || _a === void 0 ? void 0 : _a.value) === 'true') { ret.languages.push(item); } }); this._state.sites.forEach((item) => { var _a; if (((_a = this[item.name]) === null || _a === void 0 ? void 0 : _a.value) === 'true') { ret.sites.push(item); } }); this.createLogLine(`Prepare languages and sites to publish`, det); resolve(ret); }); } getVariations() { const variations = mls.l5.getProjectVariations(mls.actual[mls.actualLevel].project); const newVariations = []; for (let i = 0; i < variations.length; i++) { const split = variations[i].split(':'); if (split[3] === 'A') { const obj = { variationNumber: Number.parseInt(split[0], 10), language: split[1], path: split[2], statusVariation: split[3], }; newVariations.push(obj); } } return newVariations; } getSites() { var _a; const userPreferenceValue = mls.l5.getProjectDetails(mls.actual[5].project).value ? JSON.parse(mls.l5.getProjectDetails(mls.actual[5].project).value) : {}; let multiSites; const multiSitesRet = []; if (userPreferenceValue) { const rc = (_a = userPreferenceValue.l5_actionPrjSettings) === null || _a === void 0 ? void 0 : _a.environments; if (typeof rc === 'string' && rc.startsWith('{')) { multiSites = JSON.parse(rc); } else { multiSites = rc || {}; } } Object.keys(multiSites).forEach((name) => { const obj = { name, path: multiSites[name].path, }; multiSitesRet.push(obj); }); return multiSitesRet; } } _100131_automation_publish_prepare_languages_old.title = 'Languages'; _100131_automation_publish_prepare_languages_old.desc = 'This action configure languages and sites to publish'; _100131_automation_publish_prepare_languages_old.image = '/l3/_100131_images/addon_WebGeral/language.png'; _100131_automation_publish_prepare_languages_old._SearchDetails = { desc: 'Languages', section: l2_html.PCategories.internal, parentTags: ['PublishPrepareBase'], tags: ['PublishPrepareService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_prepare_languages_old = _100131_automation_publish_prepare_languages_old; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_prepare_mls2 extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async prepare(level, project, path, el, det, platFormsToPublish) { const serviceLanguages = this.children[0]; const servicePrepareFiles = this.children[1]; const elPrepare = el.querySelector('section').querySelectorAll('.section-services')[0]; const progressLanguage = elPrepare.querySelectorAll('.service-progress')[0]; const progressPrepareFiles = elPrepare.querySelectorAll('.service-progress')[1]; progressLanguage.style.cssText = `--i:${10}%`; const variations = await serviceLanguages.getLanguages(det); progressLanguage.style.cssText = `--i:${100}%`; this.createLogLine('Prepare files to publish', det); progressPrepareFiles.style.cssText = `--i:${10}%`; const ret = await servicePrepareFiles.prepareFiles(variations, level, project, path, det, platFormsToPublish); progressPrepareFiles.style.cssText = `--i:${100}%`; return ret; } } _100131_automation_publish_prepare_mls2.title = 'Prepare'; _100131_automation_publish_prepare_mls2._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishPrepareBase'], childrenTags: ['PublishPrepareService'], examples: ['{}'] }; l2_html._100131_automation_publish_prepare_mls2 = _100131_automation_publish_prepare_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_schedule extends l2_html._100131_automation_publish_services_Base { constructor() { super(...arguments); this.sitesToPublish = []; this._platFormsToPublish = ['amazonS3']; this._totalFiles = 0; this._totalActual = 0; } static open(el, node) { if (el) el.innerHTML = 'Loading...'; if (!mls.actual[4].project) { const msg = 'Please, enter on L4 first, and try again'; el.innerHTML = msg; return; } _100131_automation_publish_schedule.createPublishPage(node, el); } static getPublishNode(project) { return new Promise((resolve, reject) => { const detOfProject = mls.l5.getProjectDetails(project); if (!detOfProject.value) return; const j1 = JSON.parse(detOfProject.value); if (!j1.l5_actionPrjSettings) return; if (!j1.l5_actionPrjSettings.publishNode) { reject(new Error('No publish template selected, please configure on project settings')); } else { resolve(j1.l5_actionPrjSettings.publishNode); } }); } static async createPublishPage(str, el, project) { if (!str) { str = await _100131_automation_publish_schedule.getPublishNode(project); } const options = { pageName: 'template_publish_1', prjID: 100131, useModelT2: true, variationIndex: 0, optionalL4TS: '', src_JSON: str, }; const rc = await mls.l4.compile(options); if (el) { el.innerHTML = ''; rc.dst_rootWidget.renderHTML(); el.appendChild(rc.dst_rootWidget.el); const style = document.createElement('style'); style.innerText = rc.dst_Styles; el.appendChild(style); } mls.l5['pageNodes'] = rc.dst_rootWidget; } static async uploadFile(project, fileName, path, content) { await _100131_automation_publish_schedule.createPublishPage(undefined, undefined, project); const serviceUpload = mls.l5['pageNodes'].children[0].children[2]; await serviceUpload.upload(fileName, '', path, content, undefined, undefined, undefined); } static async deleteFile(project, fileName, path) { await _100131_automation_publish_schedule.createPublishPage(undefined, undefined, project); const serviceUpload = mls.l5['pageNodes'].children[0].children[2]; await serviceUpload.deleteFile(fileName, '', path, undefined, undefined, undefined); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); this.renderChildrens(); return this.el; } renderHTML() { const el = this.render(); return el; } renderChildrens() { this._main = document.createElement('section'); this._config = this.renderSectionConfig(); this.children.forEach((item, index) => { if (index === 3) { const section = document.createElement('section'); section.appendChild(this.renderContentButtonExecute()); const hr = document.createElement('hr'); section.appendChild(hr); this._main.appendChild(section); } const section = document.createElement('section'); section.className = 'section-services'; const title = document.createElement('h3'); title.innerText = l2_html[item.getName()].title; const ul = document.createElement('ul'); if (this.children.length - 1 === index) { ul.classList.add('ul-logs'); } section.appendChild(title); section.appendChild(ul); item.children.forEach((child) => { const li = this.createUlItemService(child); ul.appendChild(li); }); this._main.appendChild(section); }); this.el.appendChild(this._main); this.el.appendChild(this._config); } createUlItemService(child) { const li = document.createElement('li'); li.onclick = () => { this.onLiClick(child); }; const divImg = document.createElement('div'); const img = document.createElement('img'); img.src = l2_html[child.getName()].image; divImg.appendChild(img); const divTxt = document.createElement('div'); const text = document.createElement('h5'); text.innerText = l2_html[child.getName()].title; const subtext = document.createElement('small'); subtext.innerText = l2_html[child.getName()].desc; divTxt.appendChild(text); divTxt.appendChild(subtext); const divAction = document.createElement('div'); const buttonConfig = document.createElement('a'); buttonConfig.href = '#'; const iconConfig = document.createElement('i'); const textConfig = document.createElement('span'); textConfig.innerHTML = 'Settings'; iconConfig.className = 'fa fa-cog ml-1'; buttonConfig.appendChild(textConfig); buttonConfig.appendChild(iconConfig); divAction.appendChild(buttonConfig); const divProgress = document.createElement('div'); divProgress.className = 'service-progress'; divProgress.setAttribute('style', '--i:0%'); li.appendChild(divImg); li.appendChild(divTxt); li.appendChild(divAction); li.appendChild(divProgress); return li; } renderSectionConfig() { const config = document.createElement('section'); config.classList.add('d-none'); const div = document.createElement('div'); const back = document.createElement('a'); back.href = '#'; back.innerText = 'Back'; back.onclick = (e) => { e.preventDefault(); this.setScenery(1); }; const divProps = document.createElement('div'); divProps.id = 'level500PropertyDiv'; const btnSave = document.createElement('button'); btnSave.className = 'btn btn-primary'; btnSave.innerText = 'Save'; btnSave.onclick = () => { this.onBtnSaveClick(btnSave); }; div.appendChild(back); div.appendChild(divProps); div.append(btnSave); config.appendChild(div); return config; } renderContentButtonExecute() { const div = document.createElement('div'); div.className = 'd-flex justify-content-center'; const button = document.createElement('button'); button.className = 'btn btn-secondary'; button.innerText = 'Execute'; button.onclick = () => { this.onExecute().then(() => { }).catch((err) => { console.error(err); }); }; div.appendChild(button); return div; } onLiClick(node) { this.setScenery(2); mls.l4.selectedNode = node; mls.l4.updatePropertyPage(500, (name, value) => false); } onBtnSaveClick(el) { var _a, _b; const detOfProject = mls.l5.getProjectDetails(mls.actual[5].project); const index = mls.l5.actualOrg.toString() + ';' + mls.actual[5].project.toString() + ';' + detOfProject.name; if (!detOfProject.value) return; const j1 = JSON.parse(detOfProject.value); j1.l5_actionPrjSettings.publishNode = ((_a = mls.l5['pageNodes'].children[1]) === null || _a === void 0 ? void 0 : _a.serialize()) || ((_b = mls.l5['pageNodes'].children[0]) === null || _b === void 0 ? void 0 : _b.serialize()); el.innerText = 'Saving...'; const ref = 'Publish preferences changed'; mls.l5.saveSettings('api/saveprjp', document.createElement('button'), JSON.stringify(j1), index, ref).then((ret) => { el.innerText = 'Save ok'; setTimeout(() => { el.innerText = 'Save'; }, 2000); }).catch((err) => { console.error('Error on save settings', err); }); } setScenery(nr) { this._main.classList.toggle('d-none', nr !== 1); this._config.classList.toggle('d-none', nr !== 2); } async onExecute() { var _a, _b; const prepare = this.children[0]; this.clearLogs(); this.clearProgress(); const t0 = performance.now(); const level = mls.actualLevel; const { path, project } = mls.actual[level]; const logsUL = (_b = (_a = this.el.querySelector('section')) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.section-services')[3]) === null || _b === void 0 ? void 0 : _b.querySelector('ul'); const detPrepare = this.createLogDetails('Prepare...', logsUL); const prepareRet = await prepare.prepare(level, project, path, this.el, detPrepare, this._platFormsToPublish); console.info(prepareRet); this._totalFiles = this.calculeTotalFilesToPublish(prepareRet.variations); this.createLogLine(`Total files to publish: <b>${this._totalFiles} </b>`, detPrepare); if (this._totalFiles === 0) { this.createLogLine(`Publish finish, no files to publish`, detPrepare); return; } this.sitesToPublish = prepareRet.variations; const detPublish = this.createLogDetails('Build/Publish Init...', logsUL); const manifest = await this.initBuild(prepareRet, project, detPublish); const t1 = performance.now(); const timeTotal = Math.round(t1 - t0); await this.execFinish(prepareRet, manifest, timeTotal, logsUL); } async initBuild(obj, project, det) { this.createLogLine(`Sites remaind : <b> ${this.sitesToPublish.length} </b>`, det); if (this.sitesToPublish.length > 0) { const actualVariationToPublish = this.sitesToPublish.shift(); const ul = document.createElement('ul'); det.appendChild(ul); const detSite = this.createLogDetails(`Build/Publish Variation:<b>${actualVariationToPublish.language.language}</b>`, ul); const filesL4 = actualVariationToPublish.l4; const filesL3 = actualVariationToPublish.l3; const filesLibs = actualVariationToPublish.libs; const [depBase] = mls.l5.getProjectDependencies(project, false); await this.loadAllDeps(filesL4, project); await this.buildFile(filesL4, project, actualVariationToPublish.language.variationNumber, actualVariationToPublish.language.path, actualVariationToPublish.language.subdomain, 4, detSite, obj.config); await this.buildFile(filesL3, project, actualVariationToPublish.language.variationNumber, actualVariationToPublish.language.path, actualVariationToPublish.language.subdomain, 3, detSite, obj.config); await this.buildFile(filesLibs, depBase, actualVariationToPublish.language.variationNumber, actualVariationToPublish.language.path, actualVariationToPublish.language.subdomain, 3, detSite, obj.config, true); await this.initBuild(obj, project, det); } return obj.config; } async buildFile(files, prjId, variation, path, subdomain, level, logsDetails, config, isLibs) { if (files.length > 0) { const file = files.shift(); if (file.needPublish.amazonS3) { const fileName = file.name; this._totalActual += 1; const percent = (100 / this._totalFiles) * (this._totalActual); const newPath = level === 4 ? path : ((path !== '' && path !== '/') ? path + '/' : '') + `l3/_${prjId}_`; const str = await this.execBuild(file.content, fileName, prjId, level, variation, percent, logsDetails); await this.execUpload(fileName, file.mtime, subdomain, newPath, str, percent, logsDetails, config, variation, level, file.needPublish, isLibs); } await this.buildFile(files, prjId, variation, path, subdomain, level, logsDetails, config, isLibs); } } async execFinish(prepare, manifest, time, logsUL) { const serviceFinish = this.children[3]; const detFinish = this.createLogDetails('Finish...', logsUL); await serviceFinish.finish(prepare, manifest, time, detFinish); } async execBuild(content, fileName, prjId, level, variation, percent, logsDetails) { const serviceBuild = this.children[1]; const build = await serviceBuild.build(content, fileName, prjId, level, variation, percent, this.el, logsDetails); return build; } async execUpload(fileName, date, subdom, path, content, percent, logsDetails, config, variation, level, needPublish, isLibs) { const serviceUpload = this.children[2]; if (needPublish.amazonS3) { await serviceUpload.upload(fileName, subdom, path, content, percent, this.el, logsDetails); this.updateOrCreateElementOnManifest(config, variation, fileName, date, level, 'amazonS3', isLibs); } } updateOrCreateElementOnManifest(config, variation, fileName, date, level, platform, isLibs) { if (!config.publish[platform]) config.publish[platform] = []; let objActual = config.publish[platform].find((item) => item.variation === variation); if (!objActual) { objActual = { variation, libs: [], l3: [], l4: [] }; config.publish[platform].push(objActual); } const key = isLibs ? 'libs' : `l${level}`; if (!objActual[key]) objActual[key] = []; let fileActual = objActual[key].find((file) => file.name === fileName); if (!fileActual) { fileActual = { name: fileName, mtime: date }; objActual[key].push(fileActual); } else { fileActual.mtime = date; } } clearLogs() { var _a, _b; const logsUL = (_b = (_a = this.el.querySelector('section')) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.section-services')[3]) === null || _b === void 0 ? void 0 : _b.querySelector('ul'); logsUL.innerHTML = ''; } clearProgress() { const allProgress = this.el.querySelectorAll('.service-progress'); allProgress.forEach((item) => { item.style.cssText = `--i:${0}%`; }); } calculeTotalFilesToPublish(variations) { let total = 0; variations.forEach((item) => { const modules = ['l4', 'l3', 'libs']; modules.forEach((mod) => { item[mod].forEach((file) => { const keys = Object.keys(file.needPublish); const hasPublish = keys.filter((key) => file.needPublish[key] === true); if (hasPublish.length > 0) total += 1; }); }); }); return total; } async loadAllDeps(pages, project) { var _a; function mergePagesJson(listPages) { const hs = ['{ "Page_Html": {"HtmlType":"SPA"} }']; listPages.forEach((i1) => { i1.content.forEach((i2) => { if (i2.type === 'h') hs.push(i2.content); }); }); for (let i = 0; i < hs.length; i++) { if (hs[i].startsWith('[')) hs[i] = hs[i].substr(1, hs[i].length - 2); } return '[' + hs.join(',\n') + ']'; } const nameOfFirstPage = (_a = pages[0]) === null || _a === void 0 ? void 0 : _a.name.replace('.html', ''); if (!nameOfFirstPage) return; const options = { pageName: nameOfFirstPage, prjID: project, variationIndex: 0, src_JSON: mergePagesJson(pages), onlyLoadDeps: true }; await mls.l4.compile(options); } } _100131_automation_publish_schedule._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, tags: ['PublishSchedule'], childrenTags: ['PublishPrepareBase', 'PublishBuildBase', 'PublishUploadBase', 'PublishFinishBase'], examples: ['{}'] }; l2_html._100131_automation_publish_schedule = _100131_automation_publish_schedule; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_schedule_mls2 extends l2_html._100131_automation_publish_services_Base { constructor() { super(...arguments); this.sitesToPublish = []; this._platFormsToPublish = ['amazonS3']; this._totalFiles = 0; this._totalActual = 0; } static open(el, node) { if (el) el.innerHTML = 'Loading...'; if (!mls.actual[4].project) { const msg = 'Please, enter on L4 first, and try again'; el.innerHTML = msg; return; } _100131_automation_publish_schedule_mls2.createPublishPage(node, el); } static getPublishNode(project) { return new Promise((resolve, reject) => { const detOfProject = mls.l5.getProjectDetails(project); if (!detOfProject.value) return; const j1 = JSON.parse(detOfProject.value); if (!j1.l5_actionPrjSettings) return; if (!j1.l5_actionPrjSettings.publishNode) { reject(new Error('No publish template selected, please configure on project settings')); } else { resolve(j1.l5_actionPrjSettings.publishNode); } }); } static async createPublishPage(str, el, project) { if (!str) { str = await _100131_automation_publish_schedule_mls2.getPublishNode(project); } const options = { pageName: 'template_publish_1', prjID: 100131, useModelT2: true, variationIndex: 0, optionalL4TS: '', src_JSON: str, }; const rc = await mls.l4.compile(options); if (el) { el.innerHTML = ''; rc.dst_rootWidget.renderHTML(); el.appendChild(rc.dst_rootWidget.el); const style = document.createElement('style'); style.innerText = rc.dst_Styles; el.appendChild(style); } mls.l5['pageNodes'] = rc.dst_rootWidget; const awsKeys = JSON.parse(localStorage.getItem('aws-publish-key') || '{}'); const prj = mls.actual[mls.actualLevel].project; if (awsKeys[prj]) { const node = mls.l5['pageNodes'].children[1] || mls.l5['pageNodes'].children[0]; node.children[2].children[0].accessKeyId.value = awsKeys[prj].accessKeyId; node.children[2].children[0].secretAccessKey.value = awsKeys[prj].secretAccessKey; } ; } static async uploadFile(project, fileName, path, content) { await _100131_automation_publish_schedule_mls2.createPublishPage(undefined, undefined, project); const serviceUpload = mls.l5['pageNodes'].children[0].children[2]; await serviceUpload.upload(fileName, '', path, content, undefined, undefined, undefined); } static async deleteFile(project, fileName, path) { await _100131_automation_publish_schedule_mls2.createPublishPage(undefined, undefined, project); const serviceUpload = mls.l5['pageNodes'].children[0].children[2]; await serviceUpload.deleteFile(fileName, '', path, undefined, undefined, undefined); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); this.renderChildrens(); return this.el; } renderHTML() { const el = this.render(); return el; } renderChildrens() { this._main = document.createElement('section'); this._config = this.renderSectionConfig(); this.children.forEach((item, index) => { if (index === 3) { const section = document.createElement('section'); section.appendChild(this.renderContentButtonExecute()); const hr = document.createElement('hr'); section.appendChild(hr); this._main.appendChild(section); } const section = document.createElement('section'); section.className = 'section-services'; const title = document.createElement('h3'); title.innerText = l2_html[item.getName()].title; const ul = document.createElement('ul'); if (this.children.length - 1 === index) { ul.classList.add('ul-logs'); } section.appendChild(title); section.appendChild(ul); item.children.forEach((child) => { const li = this.createUlItemService(child); ul.appendChild(li); }); this._main.appendChild(section); }); this.el.appendChild(this._main); this.el.appendChild(this._config); } createUlItemService(child) { const li = document.createElement('li'); li.onclick = () => { this.onLiClick(child); }; const divImg = document.createElement('div'); const img = document.createElement('img'); img.src = l2_html[child.getName()].image; divImg.appendChild(img); const divTxt = document.createElement('div'); const text = document.createElement('h5'); text.innerText = l2_html[child.getName()].title; const subtext = document.createElement('small'); subtext.innerText = l2_html[child.getName()].desc; divTxt.appendChild(text); divTxt.appendChild(subtext); const divAction = document.createElement('div'); const buttonConfig = document.createElement('a'); buttonConfig.href = '#'; const iconConfig = document.createElement('i'); const textConfig = document.createElement('span'); textConfig.innerHTML = 'Settings'; iconConfig.className = 'fa fa-cog ml-1'; buttonConfig.appendChild(textConfig); buttonConfig.appendChild(iconConfig); divAction.appendChild(buttonConfig); const divProgress = document.createElement('div'); divProgress.className = 'service-progress'; divProgress.setAttribute('style', '--i:0%'); li.appendChild(divImg); li.appendChild(divTxt); li.appendChild(divAction); li.appendChild(divProgress); return li; } renderSectionConfig() { const config = document.createElement('section'); config.classList.add('d-none'); const div = document.createElement('div'); const back = document.createElement('a'); back.href = '#'; back.innerText = 'Back'; back.onclick = (e) => { e.preventDefault(); this.setScenery(1); }; const divProps = document.createElement('div'); divProps.id = 'level500PropertyDiv'; const btnSave = document.createElement('button'); btnSave.className = 'btn btn-primary'; btnSave.innerText = 'Save'; btnSave.onclick = () => { this.onBtnSaveClick(btnSave); }; div.appendChild(back); div.appendChild(divProps); div.append(btnSave); config.appendChild(div); return config; } renderContentButtonExecute() { const div = document.createElement('div'); div.className = 'd-flex justify-content-center'; const button = document.createElement('button'); button.className = 'btn btn-secondary'; button.innerText = 'Execute'; button.onclick = () => { this.onExecute().then(() => { }).catch((err) => { console.error(err); }); }; div.appendChild(button); return div; } onLiClick(node) { this.setScenery(2); mls.l4.selectedNode = node; mls.l4.updatePropertyPage(500, (name, value) => false); } getAwsKeys() { const awsKeys = JSON.parse(localStorage.getItem('aws-publish-key') || '{}'); return awsKeys; } onBtnSaveClick(el) { const detOfProject = mls.l5.getProjectDetails(mls.actual[5].project); const index = mls.l5.actualOrg.toString() + ';' + mls.actual[5].project.toString() + ';' + detOfProject.name; if (!detOfProject.value) return; const j1 = JSON.parse(detOfProject.value); const node = mls.l5['pageNodes'].children[1] || mls.l5['pageNodes'].children[0]; const accessKeyId = node.children[2].children[0].accessKeyId.value; const secretAccessKey = node.children[2].children[0].secretAccessKey.value; const { project } = mls.actual[mls.actualLevel]; node.children[2].children[0].accessKeyId.value = ''; node.children[2].children[0].secretAccessKey.value = ''; const awsKeys = this.getAwsKeys(); if (!awsKeys[project]) awsKeys[project] = { accessKeyId: '', secretAccessKey: '' }; awsKeys[project].secretAccessKey = secretAccessKey; awsKeys[project].accessKeyId = accessKeyId; localStorage.setItem('aws-publish-key', JSON.stringify(awsKeys)); j1.l5_actionPrjSettings.publishNode = node.serialize(); el.innerText = 'Saving...'; const ref = 'Publish preferences changed'; mls.l5.saveSettings('api/saveprjp', document.createElement('button'), JSON.stringify(j1), index, ref).then((ret) => { el.innerText = 'Save ok'; setTimeout(() => { el.innerText = 'Save'; node.children[2].children[0].accessKeyId.value = accessKeyId; node.children[2].children[0].secretAccessKey.value = secretAccessKey; }, 2000); }).catch((err) => { console.error('Error on save settings', err); }); } setScenery(nr) { this._main.classList.toggle('d-none', nr !== 1); this._config.classList.toggle('d-none', nr !== 2); } async onExecute() { var _a, _b; const prepare = this.children[0]; this.clearLogs(); this.clearProgress(); const t0 = performance.now(); const level = mls.actualLevel; const { path, project } = mls.actual[level]; const logsUL = (_b = (_a = this.el.querySelector('section')) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.section-services')[3]) === null || _b === void 0 ? void 0 : _b.querySelector('ul'); const detPrepare = this.createLogDetails('Prepare...', logsUL); const prepareRet = await prepare.prepare(level, project, path, this.el, detPrepare, this._platFormsToPublish); console.info(prepareRet); this._totalFiles = this.calculeTotalFilesToPublish(prepareRet.variations); this.createLogLine(`Total files to publish: <b>${this._totalFiles} </b>`, detPrepare); if (this._totalFiles === 0) { this.createLogLine(`Publish finish, no files to publish`, detPrepare); return; } this.sitesToPublish = prepareRet.variations; const detPublish = this.createLogDetails('Build/Publish Init...', logsUL); this.datePublish = this.formatDateToyyyyMMddHHmmss(); const manifest = await this.initBuild(prepareRet, project, detPublish); await this.updateLatestJSON(this.datePublish, detPublish); await this.deleteNotUsedFiles(detPublish); const t1 = performance.now(); const timeTotal = Math.round(t1 - t0); await this.execFinish(prepareRet, manifest, timeTotal, logsUL); } async initBuild(obj, project, det) { this.createLogLine(`Sites remaind : <b> ${this.sitesToPublish.length} </b>`, det); if (this.sitesToPublish.length > 0) { const actualVariationToPublish = this.sitesToPublish.shift(); const ul = document.createElement('ul'); det.appendChild(ul); const detSite = this.createLogDetails(`Build/Publish Variation:<b>${actualVariationToPublish.language.language}</b>`, ul); const filesL4 = actualVariationToPublish.l4; const filesL3 = actualVariationToPublish.l3; const filesLibs = actualVariationToPublish.libs; const [depBase] = mls.l5.getProjectDependencies(project, false); await this.loadAllDeps(filesL4, project); await this.buildFile(filesL4, project, actualVariationToPublish.language.variationNumber, actualVariationToPublish.language.path, actualVariationToPublish.language.subdomain, 4, detSite, obj.config); await this.buildFile(filesL3, project, actualVariationToPublish.language.variationNumber, actualVariationToPublish.language.path, actualVariationToPublish.language.subdomain, 3, detSite, obj.config); await this.buildFile(filesLibs, depBase, actualVariationToPublish.language.variationNumber, actualVariationToPublish.language.path, actualVariationToPublish.language.subdomain, 3, detSite, obj.config, true); await this.initBuild(obj, project, det); } return obj.config; } async buildFile(files, prjId, variation, path, subdomain, level, logsDetails, config, isLibs) { if (files.length > 0) { const file = files.shift(); if (file.needPublish.amazonS3) { const fileName = file.name; this._totalActual += 1; const percent = (100 / this._totalFiles) * (this._totalActual); const newPath = level === 4 ? path : ((path !== '' && path !== '/') ? path + '/' : '') + `l3/_${prjId}_`; const str = await this.execBuild(file.content, fileName, prjId, level, variation, percent, logsDetails); await this.execUpload(prjId, fileName, file.mtime, subdomain, newPath, str, percent, logsDetails, config, variation, level, file.needPublish, isLibs); } await this.buildFile(files, prjId, variation, path, subdomain, level, logsDetails, config, isLibs); } } async execFinish(prepare, manifest, time, logsUL) { const serviceFinish = this.children[3]; const detFinish = this.createLogDetails('Finish...', logsUL); await serviceFinish.finish(prepare, manifest, time, detFinish); } async execBuild(content, fileName, prjId, level, variation, percent, logsDetails) { const serviceBuild = this.children[1]; const build = await serviceBuild.build(content, fileName, prjId, level, variation, percent, this.el, logsDetails); return build; } async execUpload(prjID, fileName, date, subdom, path, content, percent, logsDetails, config, variation, level, needPublish, isLibs) { const serviceUpload = this.children[2]; if (needPublish.amazonS3) { await serviceUpload.upload(this.datePublish, prjID, fileName, subdom, path, content, percent, this.el, logsDetails); this.updateOrCreateElementOnManifest(config, variation, fileName, date, level, 'amazonS3', isLibs); } } updateOrCreateElementOnManifest(config, variation, fileName, date, level, platform, isLibs) { if (!config.publish[platform]) config.publish[platform] = []; let objActual = config.publish[platform].find((item) => item.variation === variation); if (!objActual) { objActual = { variation, libs: [], l3: [], l4: [] }; config.publish[platform].push(objActual); } const key = isLibs ? 'libs' : `l${level}`; if (!objActual[key]) objActual[key] = []; let fileActual = objActual[key].find((file) => file.name === fileName); if (!fileActual) { fileActual = { name: fileName, mtime: date }; objActual[key].push(fileActual); } else { fileActual.mtime = date; } } clearLogs() { var _a, _b; const logsUL = (_b = (_a = this.el.querySelector('section')) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.section-services')[3]) === null || _b === void 0 ? void 0 : _b.querySelector('ul'); logsUL.innerHTML = ''; } clearProgress() { const allProgress = this.el.querySelectorAll('.service-progress'); allProgress.forEach((item) => { item.style.cssText = `--i:${0}%`; }); } calculeTotalFilesToPublish(variations) { let total = 0; variations.forEach((item) => { const modules = ['l4', 'l3', 'libs']; modules.forEach((mod) => { item[mod].forEach((file) => { const keys = Object.keys(file.needPublish); const hasPublish = keys.filter((key) => file.needPublish[key] === true); if (hasPublish.length > 0) total += 1; }); }); }); return total; } async loadAllDeps(pages, project) { var _a; function mergePagesJson(listPages) { const hs = ['{ "Page_Html": {"HtmlType":"SPA"} }']; listPages.forEach((i1) => { i1.content.forEach((i2) => { if (i2.type === 'h') hs.push(i2.content); }); }); for (let i = 0; i < hs.length; i++) { if (hs[i].startsWith('[')) hs[i] = hs[i].substr(1, hs[i].length - 2); } return '[' + hs.join(',\n') + ']'; } const nameOfFirstPage = (_a = pages[0]) === null || _a === void 0 ? void 0 : _a.name.replace('.html', ''); if (!nameOfFirstPage) return; const options = { pageName: nameOfFirstPage, prjID: project, variationIndex: 0, src_JSON: mergePagesJson(pages), onlyLoadDeps: true }; await mls.l4.compile(options); } formatDateToyyyyMMddHHmmss() { const now = new Date(); const year = now.getFullYear(); const month = String(now.getMonth() + 1).padStart(2, '0'); const day = String(now.getDate()).padStart(2, '0'); const hours = String(now.getHours()).padStart(2, '0'); const minutes = String(now.getMinutes()).padStart(2, '0'); const seconds = String(now.getSeconds()).padStart(2, '0'); const formattedDate = `${year}${month}${day}${hours}${minutes}${seconds}`; return formattedDate; } async updateLatestJSON(date, logsDetails) { const serviceUpload = this.children[2]; await serviceUpload.updateLatestJSON(date, logsDetails); } async deleteNotUsedFiles(logsDetails) { const serviceUpload = this.children[2]; await serviceUpload.deleteNotUsedFiles(this.el, logsDetails); } } _100131_automation_publish_schedule_mls2._SearchDetails = { desc: 'Prepare', section: l2_html.PCategories.internal, tags: ['PublishSchedule'], childrenTags: ['PublishPrepareBase', 'PublishBuildBase', 'PublishUploadBase', 'PublishFinishBase'], examples: ['{}'] }; l2_html._100131_automation_publish_schedule_mls2 = _100131_automation_publish_schedule_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_upload extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async upload(filename, subdom, path, content, percent, el, logsDetails) { const uploadAmazonS3 = this.children[0]; const elUpload = el === null || el === void 0 ? void 0 : el.querySelector('section').querySelectorAll('.section-services')[2]; await uploadAmazonS3.publishS3(subdom, path, filename, content, percent, elUpload, logsDetails); } async deleteFile(filename, subdom, path, percent, el, logsDetails) { const uploadAmazonS3 = this.children[0]; const elUpload = el === null || el === void 0 ? void 0 : el.querySelector('section').querySelectorAll('.section-services')[2]; await uploadAmazonS3.deleteFileS3(subdom, path, filename, percent, elUpload, logsDetails); } } _100131_automation_publish_upload.title = 'Upload'; _100131_automation_publish_upload._SearchDetails = { desc: 'Upload', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishUploadBase'], childrenTags: ['PublishUploadService'], examples: ['{}'] }; l2_html._100131_automation_publish_upload = _100131_automation_publish_upload; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_upload_amazonS3 extends l2_html._100131_automation_publish_services_Base { constructor() { super(); this.domain = new l2_fieldTypes.Input(this, { desc: 'Address of your domain ex: mysite.com', type: 'text', group: 'principal', }); this.directory = new l2_fieldTypes.Input(this, { desc: 'Set a specific directory inside bucket to publish ex: /mySyte', type: 'text', group: 'principal', }); this.region = new l2_fieldTypes.EnumList(this, { desc: 'The region to send service requests to.', group: 'principal', list: ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-east-1', 'ap-south-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'eu-north-1', 'me-south-1', 'sa-east-1'] }); this.configureBucketAsWebsite = new l2_fieldTypes.EnumList(this, { desc: 'configure bucket as a website', list: ['enabled'], group: 'principal', }); this.pageIndex = new l2_fieldTypes.Input(this, { desc: 'The site page index name Ex: index.html', type: 'text', group: 'principal', }); this.pageError = new l2_fieldTypes.Input(this, { desc: 'The site page error name Ex: error.html', type: 'text', group: 'principal', }); this.cache = new l2_fieldTypes.Input(this, { desc: 'Define cache of page in ms.', type: 'text', group: 'principal', }); this.accessKeyId = new l2_fieldTypes.Input(this, { desc: 'Your AWS access key ID.', type: 'text', group: 'principal', }); this.secretAccessKey = new l2_fieldTypes.Input(this, { desc: 'Your AWS secret access key.', type: 'text', group: 'principal', }); this._s3 = {}; this._lastBucketValidate = []; this.configureBucketAsWebsite.value = 'enabled'; } async publishS3(subdom, path, filename, content, percent, el, logsDetails) { await this.connect(subdom, logsDetails); await this.addFileOnS3(content, path, filename, this.cache.value, logsDetails); if (el) el.querySelector('.service-progress').style.cssText = `--i:${percent}%`; } async deleteFileS3(subdom, path, filename, percent, el, logsDetails) { await this.connect(subdom, logsDetails); await this.removeFileOnS3(subdom, path, filename, logsDetails); if (el) el.querySelector('.service-progress').style.cssText = `--i:${percent}%`; } async connect(subdom, logsDetails) { const bucket = subdom + this.domain.value; await this.getAwsSDK(); this.setConnectionConfig(this.accessKeyId.value, this.secretAccessKey.value, bucket, this.region.value); return new Promise((resolve, reject) => { if (this._lastBucketValidate.includes(bucket)) { resolve(); return; } this.checkBucketExist(bucket).then(async () => { this._lastBucketValidate.push(bucket); this.createLogLine(`Connect on bucket: ${bucket}`, logsDetails); await this.setBucketAsWebsite(bucket); this.createLogLine(`Configure bucket: ${bucket} as a website`, logsDetails); resolve(); }).catch((err) => { this.createLogLine(`Error on connect to bucket: ${bucket}`, logsDetails); reject(new Error('Error on connect to bucket: ' + bucket)); }); }); } getAwsSDK() { const req = window['require']; req.config({ paths: { AWS: 'https://sdk.amazonaws.com/js/aws-sdk-2.283.1.min', } }); return new Promise((resolve, reject) => { if (!window['AWS']) { req(['AWS'], () => { resolve(); }); } else { resolve(); } }); } setConnectionConfig(accessKeyId, secretAccessKey, bucket, region) { window['AWS'].config.update({ accessKeyId, secretAccessKey }); this._s3 = new window['AWS'].S3({ apiVersion: '2006-03-01', region, params: { Bucket: bucket } }); } checkBucketExist(bucket) { const options = { Bucket: bucket, }; return new Promise((resolve, reject) => { this._s3.headBucket(options, (err, data) => { if (err) reject(err); else resolve(); }); }); } setBucketAsWebsite(bucket) { const staticHostParams = { Bucket: bucket, WebsiteConfiguration: { ErrorDocument: { Key: this.pageError.value !== '' ? this.pageError.value : 'error.html' }, IndexDocument: { Suffix: this.pageIndex.value !== '' ? this.pageIndex.value : 'index.html' }, } }; return new Promise((resolve, reject) => { this._s3.putBucketWebsite(staticHostParams, (err, data) => { if (err) reject(err); else resolve(); }); }); } removeFileOnS3(subdomain, album, fileName, logsDetails) { const deleteParams = { Key: album + fileName, Bucket: subdomain + this.domain.value }; return new Promise((resolve, reject) => { this._s3.deleteObject(deleteParams, (err, data) => { if (err) { this.createLogLine(`Remove file failed: ${fileName} : ${err.message}`, logsDetails); reject(err); } else if (data) { this.createLogLine(`Remove file completed successfully: ${fileName}`, logsDetails); resolve(data); } }); }); } addFileOnS3(fileContent, album, fileName, cache, logsDetails) { const extn = fileName.split('.').pop(); let contentType = 'application/octet-stream'; if (extn === 'html') { contentType = 'text/html; charset=utf-8'; } if (extn === 'ico') { contentType = 'image/x-icon'; } if (extn === 'css') { contentType = 'text/css'; } if (extn === 'js') { contentType = 'application/javascript'; } if (extn === 'json') { contentType = 'application/json'; } if (extn === 'png' || extn === 'jpg' || extn === 'gif') { contentType = 'image/' + extn; } if (extn === 'html') fileContent = unescape(encodeURIComponent(fileContent)); const fileContentBlob = this.convertBinaryToUtf8(fileContent, contentType); album = album.startsWith('/') ? album.substr(1, album.length) : album; album = album.endsWith('/') ? album.substr(0, album.length - 1) : album; fileName = fileName.startsWith('/') ? fileName.substr(1, fileName.length) : fileName; let dir = this.directory.value !== '' ? this.directory.value : ''; dir = dir.endsWith('/') || dir === '' ? dir : dir + '/'; dir += (album !== '' ? album + '/' + fileName : fileName); const uploadParams = { Key: dir, ACL: 'public-read', ContentType: contentType, Body: fileContentBlob, CacheControl: 'max-age=' + (cache !== '' ? cache : '3600') }; return new Promise((resolve, reject) => { this._s3.upload(uploadParams, (err, data) => { if (err) { this.createLogLine(`Upload file failed: ${fileName} : ${err.message}`, logsDetails); reject(err); } else if (data) { this.createLogLine(`Upload file completed successfully: ${fileName}`, logsDetails); resolve(data); } }); }); } convertBinaryToUtf8(content, contentType) { const bytes = content.length; const myArr = new Uint8Array(bytes); for (let i = 0; i < bytes; i++) { myArr[i] = content.charCodeAt(i); } return new Blob([new Uint8Array(myArr)], { type: contentType }); } } _100131_automation_publish_upload_amazonS3.title = 'Amazon S3'; _100131_automation_publish_upload_amazonS3.desc = 'Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.'; _100131_automation_publish_upload_amazonS3.image = '/l3/_100131_/images/addon_WebGeral/amazon-s3-logo.png'; _100131_automation_publish_upload_amazonS3._SearchDetails = { desc: 'S3', section: l2_html.PCategories.internal, parentTags: ['PublishUploadBase'], tags: ['PublishUploadService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_upload_amazonS3 = _100131_automation_publish_upload_amazonS3; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_upload_amazonS3_mls2 extends l2_html._100131_automation_publish_services_Base { constructor() { super(); this.domain = new l2_fieldTypes.Input(this, { desc: 'Address of your domain ex: mysite.com', type: 'text', group: 'principal', }); this.directory = new l2_fieldTypes.Input(this, { desc: 'Set a specific directory inside bucket to publish ex: /mySyte', type: 'text', group: 'principal', }); this.region = new l2_fieldTypes.EnumList(this, { desc: 'The region to send service requests to.', group: 'principal', list: ['us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ap-east-1', 'ap-south-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'eu-west-3', 'eu-north-1', 'me-south-1', 'sa-east-1'] }); this.configureBucketAsWebsite = new l2_fieldTypes.EnumList(this, { desc: 'configure bucket as a website', list: ['enabled'], group: 'principal', }); this.pageIndex = new l2_fieldTypes.Input(this, { desc: 'The site page index name Ex: index.html', type: 'text', group: 'principal', }); this.pageError = new l2_fieldTypes.Input(this, { desc: 'The site page error name Ex: error.html', type: 'text', group: 'principal', }); this.cache = new l2_fieldTypes.Input(this, { desc: 'Define cache of page in ms.', type: 'text', group: 'principal', }); this.accessKeyId = new l2_fieldTypes.Input(this, { desc: 'Your AWS access key ID.', type: 'text', group: 'principal', }); this.secretAccessKey = new l2_fieldTypes.Input(this, { desc: 'Your AWS secret access key.', type: 'text', group: 'principal', }); this._s3 = {}; this._lastBucketValidate = []; this._MLSTAGVERSION = '[mlsPublishVersion]'; this._MLSTAGLANGUAGE = '[mlsPublishLanguage]'; this.configureBucketAsWebsite.value = 'enabled'; } async publishS3(date, prjID, subdom, path, filename, content, percent, el, logsDetails) { await this.connect(subdom, logsDetails); await this.addFileOnS3(date, prjID, content, path, filename, this.cache.value, logsDetails); if (el) el.querySelector('.service-progress').style.cssText = `--i:${percent}%`; } async deleteFileS3(subdom, path, filename, percent, el, logsDetails) { await this.connect(subdom, logsDetails); await this.removeFileOnS3(subdom, path, filename, logsDetails); if (el) el.querySelector('.service-progress').style.cssText = `--i:${percent}%`; } async updateLatestJSON(date, logsDetails) { await this.connect('', logsDetails); const data = await this.readFileOnS3('', '', 'latest.json', logsDetails); let latestJson; if (data) { latestJson = JSON.parse(data); latestJson.www = date; } else { latestJson = { www: date }; } await this.addFileOnS3(date, undefined, JSON.stringify(latestJson), '', 'latest.json', '31536000', logsDetails); } async connect(subdom, logsDetails) { const bucket = subdom + this.domain.value; await this.getAwsSDK(); this.setConnectionConfig(this.accessKeyId.value, this.secretAccessKey.value, bucket, this.region.value); return new Promise((resolve, reject) => { if (this._lastBucketValidate.includes(bucket)) { resolve(); return; } this.checkBucketExist(bucket).then(async () => { this._lastBucketValidate.push(bucket); this.createLogLine(`Connect on bucket: ${bucket}`, logsDetails); await this.setBucketAsWebsite(bucket); this.createLogLine(`Configure bucket: ${bucket} as a website`, logsDetails); resolve(); }).catch((err) => { this.createLogLine(`Error on connect to bucket: ${bucket}`, logsDetails); reject(new Error('Error on connect to bucket: ' + bucket)); }); }); } getAwsSDK() { const req = window['require']; req.config({ paths: { AWS: 'https://sdk.amazonaws.com/js/aws-sdk-2.283.1.min', } }); return new Promise((resolve, reject) => { if (!window['AWS']) { req(['AWS'], () => { resolve(); }); } else { resolve(); } }); } setConnectionConfig(accessKeyId, secretAccessKey, bucket, region) { window['AWS'].config.update({ accessKeyId, secretAccessKey }); this._s3 = new window['AWS'].S3({ apiVersion: '2006-03-01', region, params: { Bucket: bucket } }); } checkBucketExist(bucket) { const options = { Bucket: bucket, }; return new Promise((resolve, reject) => { this._s3.headBucket(options, (err, data) => { if (err) reject(err); else resolve(); }); }); } setBucketAsWebsite(bucket) { const staticHostParams = { Bucket: bucket, WebsiteConfiguration: { ErrorDocument: { Key: this.pageError.value !== '' ? this.pageError.value : 'error.html' }, IndexDocument: { Suffix: this.pageIndex.value !== '' ? this.pageIndex.value : 'index.html' }, } }; return new Promise((resolve, reject) => { this._s3.putBucketWebsite(staticHostParams, (err, data) => { if (err) reject(err); else resolve(); }); }); } readFileOnS3(subdomain, album, fileName, logsDetails) { const readParams = { Key: album + fileName, Bucket: subdomain + this.domain.value }; return new Promise((resolve, reject) => { this._s3.getObject(readParams, (err, data) => { if (err) { if (err.statusCode === 404) { resolve(undefined); } this.createLogLine(`Read file failed: ${fileName} : ${err.message}`, logsDetails); reject(err); } else if (data) { this.createLogLine(`Read file completed successfully: ${fileName}`, logsDetails); resolve(data.Body.toString()); } }); }); } removeFileOnS3(subdomain, album, fileName, logsDetails) { const deleteParams = { Key: album + fileName, Bucket: subdomain + this.domain.value }; return new Promise((resolve, reject) => { this._s3.deleteObject(deleteParams, (err, data) => { if (err) { this.createLogLine(`Remove file failed: ${fileName} : ${err.message}`, logsDetails); reject(err); } else if (data) { this.createLogLine(`Remove file completed successfully: ${fileName}`, logsDetails); resolve(data); } }); }); } async addFileOnS3(date, prjID, fileContent, album, fileName, cache, logsDetails) { const extn = fileName.split('.').pop(); let contentType = 'application/octet-stream'; if (extn === 'html') { contentType = 'text/html; charset=utf-8'; } if (extn === 'ico') { contentType = 'image/x-icon'; } if (extn === 'css') { contentType = 'text/css'; } if (extn === 'js') { contentType = 'application/javascript'; } if (extn === 'json') { contentType = 'application/json'; } if (extn === 'png' || extn === 'jpg' || extn === 'gif') { contentType = 'image/' + extn; } if (extn === 'html') fileContent = unescape(encodeURIComponent(fileContent)); if (album === '/') album = '/pt'; if (album.startsWith('l3/')) album = '/pt/' + album; const rootFiles = ['latest.json', this.pageIndex.value]; const isRootDirectoryFile = rootFiles.includes(fileName); const isIndex = fileName === this.pageIndex.value; if (isIndex) { fileContent = await this.insertScripts(fileContent); } if (isRootDirectoryFile) { fileContent = this.replaceVersion(fileContent, date, album); } const fileContentBlob = this.convertBinaryToUtf8(fileContent, contentType); album = album.startsWith('/') ? album.substr(1, album.length) : album; album = album.endsWith('/') ? album.substr(0, album.length - 1) : album; fileName = fileName.startsWith('/') ? fileName.substr(1, fileName.length) : fileName; let dir = this.directory.value !== '' ? this.directory.value : ''; dir = dir.endsWith('/') || dir === '' ? dir : dir + '/'; if (isRootDirectoryFile) { dir += fileName; } else { dir += (album !== '' ? album + '/' + fileName : fileName); } const prefix = `www/${date}/`; const uploadParams = { Key: isRootDirectoryFile ? dir : prefix + dir, ACL: 'public-read', ContentType: contentType, Body: fileContentBlob, }; if (!isRootDirectoryFile) { uploadParams.CacheControl = 'max-age=' + (cache !== '' ? cache : '3600'); } else { uploadParams.CacheControl = 'max-age=300'; } return new Promise((resolve, reject) => { this._s3.upload(uploadParams, (err, data) => { if (err) { this.createLogLine(`Upload file failed: ${fileName} : ${err.message}`, logsDetails); reject(err); } else if (data) { this.createLogLine(`Upload file completed successfully: ${fileName}`, logsDetails); resolve(data); } }); }); } async insertScripts(str) { const projectWorkspace = [100131, 100143, 100529]; const args = { project: 100529, module: 'l2', path: '', strJC: projectWorkspace.join(','), strH: [] }; return new Promise((resolve, reject) => { mls.api.post('api/getw', args, true, (event) => { const parser = new DOMParser(); const domDocument = parser.parseFromString(str, 'text/html'); const head = domDocument.querySelector('head'); const files = event.split('\f'); files.forEach((line) => { const l2 = document.createElement('mlsscript'); l2.style.display = 'none'; const fn = line.substr(0, line.indexOf('\t')); const prj = fn.substr(0, fn.length - 13); l2.textContent = line.split('\"use strict";\n')[1]; l2.setAttribute('data-prj', prj); head.appendChild(l2); }); resolve(domDocument.documentElement.outerHTML); }); }); } replaceVersion(content, version, language) { const newStr = content.replace(this._MLSTAGVERSION, version).replace(this._MLSTAGLANGUAGE, language.replace(/\//g, '')); return newStr; } convertBinaryToUtf8(content, contentType) { const bytes = content.length; const myArr = new Uint8Array(bytes); for (let i = 0; i < bytes; i++) { myArr[i] = content.charCodeAt(i); } return new Blob([new Uint8Array(myArr)], { type: contentType }); } convertAndCheck24Hours(dataString) { const year = parseInt(dataString.substr(0, 4), 10); const mounth = parseInt(dataString.substr(4, 2), 10) - 1; const day = parseInt(dataString.substr(6, 2), 10); const hour = parseInt(dataString.substr(8, 2), 10); const minute = parseInt(dataString.substr(10, 2), 10); const seconds = parseInt(dataString.substr(12, 2), 10); const date = new Date(year, mounth, day, hour, minute, seconds); const dateActual = new Date(); const diffInMl = dateActual.getTime() - date.getTime(); const diffInHours = diffInMl / (1000 * 60 * 60); return diffInHours >= 24; } } _100131_automation_publish_upload_amazonS3_mls2.title = 'Amazon S3'; _100131_automation_publish_upload_amazonS3_mls2.desc = 'Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.'; _100131_automation_publish_upload_amazonS3_mls2.image = '/l3/_100131_/images/addon_WebGeral/amazon-s3-logo.png'; _100131_automation_publish_upload_amazonS3_mls2._SearchDetails = { desc: 'S3', section: l2_html.PCategories.internal, parentTags: ['PublishUploadBase'], tags: ['PublishUploadService'], childrenTags: ['!'], examples: ['{}'] }; l2_html._100131_automation_publish_upload_amazonS3_mls2 = _100131_automation_publish_upload_amazonS3_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_publish_upload_mls2 extends l2_html._100131_automation_publish_services_Base { render() { super.createEL('null'); return this.el; } async upload(date, prjID, filename, subdom, path, content, percent, el, logsDetails) { const uploadAmazonS3 = this.children[0]; const elUpload = el === null || el === void 0 ? void 0 : el.querySelector('section').querySelectorAll('.section-services')[2]; await uploadAmazonS3.publishS3(date, prjID, subdom, path, filename, content, percent, elUpload, logsDetails); } async deleteNotUsedFiles(el, logsDetails) { const deleteAmazons3 = this.children[1]; const elUpload = el === null || el === void 0 ? void 0 : el.querySelector('section').querySelectorAll('.section-services')[2]; await deleteAmazons3.getListObjectToDeleteAndRemove(elUpload, logsDetails); } async updateLatestJSON(date, logsDetails) { const uploadAmazonS3 = this.children[0]; await uploadAmazonS3.updateLatestJSON(date, logsDetails); } async deleteFile(filename, subdom, path, percent, el, logsDetails) { const uploadAmazonS3 = this.children[0]; const elUpload = el === null || el === void 0 ? void 0 : el.querySelector('section').querySelectorAll('.section-services')[2]; await uploadAmazonS3.deleteFileS3(subdom, path, filename, percent, elUpload, logsDetails); } } _100131_automation_publish_upload_mls2.title = 'Upload'; _100131_automation_publish_upload_mls2._SearchDetails = { desc: 'Upload', section: l2_html.PCategories.internal, parentTags: ['PublishSchedule'], tags: ['PublishUploadBase'], childrenTags: ['PublishUploadService'], examples: ['{}'] }; l2_html._100131_automation_publish_upload_mls2 = _100131_automation_publish_upload_mls2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_automation_routes extends l2_html.Base { constructor() { super(); this.myRoutes = new Map(); this.createRotes(); } static showLeft(param) { return this._showLeft(param); } static _showLeft(param) { let routes = new l2_html._100131_automation_routes(); const f = routes.myRoutes.get(param); if (!f) { routes = undefined; return new Promise((resolve, reject) => resolve(undefined)); } return f(param); } createRotes() { this.myRoutes.set('size', this._openHelperMenu.bind(this)); this.myRoutes.set('margin', this._openHelperMenu.bind(this)); this.myRoutes.set('padding', this._openHelperMenu.bind(this)); this.myRoutes.set('navigator', this._openServiceMenu.bind(this)); } _openServiceMenu(tpService) { return new Promise((resolve, reject) => { const widgets = mls.l2.findWidgets('service', [1]); const widgetsTags = widgets.filter((wid) => l2_html[wid] && l2_html[wid].tags && l2_html[wid].tags.includes(tpService)); if (!widgetsTags) resolve(undefined); const service = mls.services.servicesList[4].filter((item) => item.path === widgetsTags[0]); this.activeToolbar(widgetsTags[0]); service[0]['label1'].click(); return resolve(undefined); }); } activeToolbar(path) { const isToolbar = mls.services.getServiceAllwaysVisible(4); if (!isToolbar) return; const div = isToolbar.div1; if (!div) return; const btnAct = div.querySelector('.activeServiceToolbar'); if (btnAct) btnAct.classList.remove('activeServiceToolbar'); const active = div.querySelector(`button[path="${path}"]`); if (active) active.classList.add('activeServiceToolbar'); } _openHelperMenu(tpMenu) { return new Promise((resolve, reject) => { const widgets = mls.l2.findWidgets('helper_class_buttons_', [mls.actual[4].project, 100131]); const widgetsTags = widgets.filter((wid) => l2_html[wid] && l2_html[wid].tags && l2_html[wid].tags.includes(tpMenu)); if (!widgetsTags) resolve(undefined); const service = mls.services.servicesList[4].filter((item) => item.path === 'service_CSS'); if (!service || !service[0]['label1']) resolve(undefined); const aService = mls.services.getServiceVisibleNotAllwaysVisible(4); let time = 0; let force = false; if (!aService || aService.instance.constructor.name !== 'service_CSS') { this.activeToolbar('service_CSS'); service[0]['label1'].click(); time = 800; force = true; } setTimeout(() => { const l4 = window['l4_html']; if (!l4 || !l4.helper_class_buttons || !l4.helper_class_buttons.state.subInstances) resolve(undefined); const inst = l4.helper_class_buttons.state.subInstances.filter((item) => item.constructor.name === widgetsTags[0]); if (!inst || !inst[0] || !inst[0].onUpdateUI || !inst[0].elItem) resolve(undefined); const isOnpenCl = mls.contributions['lastW1HelperClass']; if (!isOnpenCl || isOnpenCl.constructor.name !== widgetsTags[0] || force) inst[0].elItem.click(); resolve(() => inst[0].onUpdateUI()); }, time); }); } } l2_html._100131_automation_routes = _100131_automation_routes; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_colors extends l2_html.Base { render() { super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = 'row m-0 p-0 colors'; return this.el; } } _100131_colors._SearchDetails = { section: l2_html.PCategories.Media, desc: 'Color gallery widget', tags: ['colors'], childrenTags: ['colors_item'], examples: [ '{ }' ] }; l2_html._100131_colors = _100131_colors; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_colors_item extends l2_html.Base { constructor() { super(...arguments); this.background = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Defines background color', type: 'text' }); } render() { super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = 'colors_item'; this.el.style.background = this.background.value; return this.el; } } _100131_colors_item._SearchDetails = { section: l2_html.PCategories.Media, group: 'Media', desc: 'Widget item color gallery', parentTags: ['colors'], tags: ['colors_item'], childrenTags: ['!'], examples: [ '{ }' ] }; l2_html._100131_colors_item = _100131_colors_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_editorQuill extends l2_html.Base { constructor() { super(...arguments); this.theme = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'Themes allow you to easily make your editor look good with minimal effort.', list: ['snow', 'bubble'], }); this.withHistories = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'This module is responsible for handling undo and redo for Quill ', help: 'https://quilljs.com/docs/modules/history/', }); this.placeholder = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Placeholder text to show when editor is empty.', }); this.toolbarJson = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'The Toolbar module allow users to easily format Quills contents.', help: 'https://quilljs.com/docs/modules/toolbar/', }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); if (this.id.value === '') this.id.value = `editor_quill_${this.position}`; l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_editorQuill._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'editor', desc: 'Editor Quill', tags: ['editor'], childrenTags: ['!'], examples: [ '{"theme":"snow","withHistories":"true","placeholder":"Compose an epic...","toolbarJson":"[ \\t\\t\\t[\\"bold\\", \\"italic\\", \\"underline\\", \\"strike\\"], \\t\\t\\t[{ \\"list\\": \\"ordered\\" }, { \\"list\\": \\"bullet\\" }], \\t\\t\\t[{ \\"indent\\": \\"-1\\" }, { \\"indent\\": \\"+1\\" }], \\t\\t\\t[{ \\"size\\": [\\"small\\", false, \\"large\\", \\"huge\\"] }], \\t\\t\\t[{ \\"color\\": [] }, { \\"background\\": [] }], \\t\\t\\t[{ \\"align\\": [] }], \\t\\t\\t[\\"clean\\"] \\t\\t]"}', '{"theme":"snow","withHistories":"false","placeholder":"Compose an epic...","toolbarJson":"[ \\t\\t\\t[\\"bold\\", \\"italic\\", \\"underline\\", \\"strike\\"], \\t\\t\\t[\\"blockquote\\", \\"code-block\\"], \\t\\t\\t[{ \\"list\\": \\"ordered\\" }, { \\"list\\": \\"bullet\\" }], \\t\\t\\t[{ \\"script\\": \\"sub\\" }, { \\"script\\": \\"super\\" }], \\t\\t\\t[{ \\"indent\\": \\"-1\\" }, { \\"indent\\": \\"+1\\" }], \\t\\t\\t[{ \\"direction\\": \\"rtl\\" }], \\t\\t\\t[{ \\"size\\": [\\"small\\", false, \\"large\\", \\"huge\\"] }], \\t\\t\\t[{ \\"header\\": [1, 2, 3, 4, 5, 6, false] }], \\t\\t\\t[{ \\"color\\": [] }, { \\"background\\": [] }], \\t\\t\\t[{ \\"font\\": [] }], \\t\\t\\t[{ \\"align\\": [] }], \\t\\t\\t[\\"image\\", \\"video\\"], \\t\\t\\t[\\"clean\\"] \\t\\t]"}', '{"theme":"bubble","withHistories":"true","placeholder":"Compose an epic...","toolbarJson":"[ \\t\\t\\t[\\"bold\\", \\"italic\\", \\"underline\\", \\"strike\\"], \\t\\t\\t[{ \\"list\\": \\"ordered\\" }, { \\"list\\": \\"bullet\\" }], \\t\\t\\t[{ \\"indent\\": \\"-1\\" }, { \\"indent\\": \\"+1\\" }], \\t\\t\\t[{ \\"size\\": [\\"small\\", false, \\"large\\", \\"huge\\"] }], \\t\\t\\t[{ \\"color\\": [] }, { \\"background\\": [] }], \\t\\t\\t[{ \\"align\\": [] }], \\t\\t\\t[\\"clean\\"] \\t\\t]"}' ] }; l2_html._100131_editorQuill = _100131_editorQuill; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_editor_markdown extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } l2_html._100131_editor_markdown = _100131_editor_markdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_Class extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_Class._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_Class = _100131_helper_Class; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_OfHelper extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_OfHelper._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_OfHelper = _100131_helper_OfHelper; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_animation extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_animation = _100131_helper_animation; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_animation_createCSSAnimation extends l2_html.Base { constructor() { super(...arguments); this._newSrc = ''; this.preprocessStyle = (src) => { this.init(); this.getWidgetAnimation(mls.l4.pageNodes); this.generateOutput(src); return this._newSrc; }; } render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } init() { this._widgetAnimation = []; } getWidgetAnimation(node) { if ((!node) || (!node.el)) { console.error('error on getAllHandleBars, element invalid, ignored: ', node); return; } const fields = l2_fieldTypes.getExtensions(node); let count = 0; for (let i = 0; i < fields.length; i++) { const field = fields[i]; let value = field.value; if (value.indexOf('mlsAnimation') < 0) { continue; } const filterValue = value.split(' '); filterValue.forEach((item) => { if (item.indexOf('mlsAnimation') >= 0) { value = item; } }); const clsName = value.split('-'); this._widgetAnimation.push({ index: count++, widget: node, animation: clsName[1], time: clsName[2], repeat: clsName[3], clsName: value, }); } for (let i = 0; i < node.children.length; i++) { this.getWidgetAnimation(node.children[i]); } } generateOutput(src) { let blocksAnimations = this._widgetAnimation.map((handle) => handle.animation); blocksAnimations = [...new Set(blocksAnimations)]; blocksAnimations.forEach((ani) => { this.replaceBloc(src, ani); }); let blocksCustomAnimations = this._widgetAnimation.map((handle) => handle.clsName); blocksCustomAnimations = [...new Set(blocksCustomAnimations)]; blocksCustomAnimations.forEach((ani) => { this._newSrc = this._newSrc + ' \n ' + this.createCustomClass(ani, ani.split('-')); }); } replaceBloc(src, cls) { const str = '////start-' + cls; const end = '////end-' + cls; const i1 = src.indexOf(str); const i2 = src.indexOf(end); if (i1 >= 0 && i2 >= 0) { const block = src.substr(i1, (i2 - i1)); this._newSrc = this._newSrc + ' ' + block; } } createCustomClass(nameClass, arrayClass) { let customClass = ''; customClass = '.' + nameClass + ' {' + '-webkit-animation-name: ' + arrayClass[1] + '; ' + 'animation-name: ' + arrayClass[1] + '; ' + '-webkit-animation-duration: ' + arrayClass[2] + '; ' + 'animation-duration: ' + arrayClass[2] + '; ' + '-webkit-animation-iteration-count: ' + arrayClass[3] + '; ' + 'animation-iteration-count: ' + arrayClass[3] + '; ' + '}'; return customClass; } } l2_html._100131_helper_animation_createCSSAnimation = _100131_helper_animation_createCSSAnimation; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_Api_filterClipPath extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_Api_filterClipPath.jsonSchema = { definitions: { name: '', icon: 'fa--o', description: '', className: '', useRepeat: false }, id: 'root.properties', type: 'object', title: 'The Root Schema', description: 'An explanation about the purpose of this instance.', required: [ 'nome', 'clip' ], properties: { nome: { id: '#/properties/nome', type: 'string', title: 'The nome Schema', description: 'An explanation about the purpose of this instance.', default: '', examples: [ '' ] }, clip: { id: '#/properties/clip', type: 'string', title: 'The clip Schema', description: 'An explanation about the purpose of this instance.', default: '', examples: [ '' ] } } }; l2_html._100131_helper_class_Api_filterClipPath = _100131_helper_class_Api_filterClipPath; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_addItemDynamic extends l2_html.Base { constructor() { super(...arguments); this.value = new l2_fieldTypes.Input(this, { name: 'value', desc: 'text', type: 'text', elType: 'none' }); this.prefixs = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field' }); this.title = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'title for field', elType: 'none' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); if (!this.id.value) this.id.value = 'hcAddItemDynamic' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.el.setAttribute('title', this.title.value); this.el.classList.add('hc_addItemDynamic'); const div = document.createElement('div'); const input = document.createElement('input'); input.type = 'number'; input.min = '0'; input.max = '12'; div.classList.add('hc_addItemDynamicContent'); input.className = '_5'; input.style.marginLeft = '0px'; input.style.width = '150px'; this.generateLi(div); input.value = this.value.value; this.el.appendChild(input); this.el.appendChild(div); this.el.style.height = 'max-content'; this.el.style.paddingTop = '5px'; return this.el; } generateLi(el) { let tot = this.value.value ? +this.value.value : 0; tot = tot > 12 ? 12 : tot; for (let i = 0; i < tot; i++) { const div = document.createElement('div'); const span = document.createElement('span'); const input = document.createElement('input'); div.className = 'contItemHCGrid'; span.innerText = '#' + (i + 1); div.appendChild(span); div.appendChild(input); el.appendChild(div); } } } _100131_helper_class_addItemDynamic._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_addItemDynamic = _100131_helper_class_addItemDynamic; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_background extends l2_html.Base { render() { super.createEL('null'); return this.el; } } _100131_helper_class_background._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_background = _100131_helper_class_background; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_boarding extends l2_html.Base { constructor() { super(...arguments); this.pageName = new l2_fieldTypes.Input(this, { desc: 'Type the text', type: 'text', group: 'principal', elName: 'pageName' }); this.title = new l2_fieldTypes.Input(this, { desc: 'Type the text', type: 'text', group: 'principal', elName: 'title' }); } renderHTML() { const el = this.render(); return el; } render() { super.createEL('div'); const details = document.createElement('details'); const summary = document.createElement('summary'); const body = document.createElement('div'); summary.innerText = this.title.value ? this.title.value : ' Boarding'; details.appendChild(summary); details.appendChild(body); this.id.value = this.id.value ? this.id.value : 'hc_boarding' + this.position; this.children.forEach((item) => this.prepareChildren(body, item)); this.el.appendChild(details); l2_fieldTypes.renderAllFields(this.el, this); this.el.classList.add('my_helper_class_boarding'); return this.el; } prepareChildren(content, children) { content.appendChild(children.renderHTML()); } } _100131_helper_class_boarding._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['!elChild', '!restricted'], examples: [ '{}' ] }; l2_html._100131_helper_class_boarding = _100131_helper_class_boarding; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_border extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_border._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'widget', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_border = _100131_helper_class_border; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_borderRadius extends l2_html.Base { render() { super.createEL("null"); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_borderRadius._SearchDetails = { section: l2_html.PCategories.dataManagement, group: "js", desc: "description here", tags: ["l2"], childrenTags: ["!"], examples: [] }; l2_html._100131_helper_class_borderRadius = _100131_helper_class_borderRadius; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_boxShadows extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_boxShadows._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_boxShadows = _100131_helper_class_boxShadows; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons extends l2_html.BaseHtml { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_buttons._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_buttons = _100131_helper_class_buttons; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttonsDS extends l2_html.BaseHtml { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_buttonsDS._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_buttonsDS = _100131_helper_class_buttonsDS; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Design extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } icon() { return { h_index: 200, groupName: 'subGroup', title: 'Design', iconText: 'fa-tint' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastHelper'] = 'Design'; this.state.divHelper.style.display = ''; this.state.addToolBarSub('helper_class_buttons_Design_', true, this.state.divHelper); } } l2_html._100131_helper_class_buttons_Design = _100131_helper_class_buttons_Design; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Design_BackGround extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_background'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 100, groupName: 'style', title: 'BackGround', iconText: 'fa-square' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Background'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_background', true); } } l2_html._100131_helper_class_buttons_Design_BackGround = _100131_helper_class_buttons_Design_BackGround; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Design_Border extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_border'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 300, groupName: 'style', title: 'Border', iconText: 'fa-window-restore' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Border'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_border', true); } } l2_html._100131_helper_class_buttons_Design_Border = _100131_helper_class_buttons_Design_Border; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Editor extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; this.startClass = ''; this.decoration = []; this.oldCssText = ''; this.change = ''; this.divStyle = document.createElement('div'); this.divPage = document.createElement('div'); this.divPageCommunity = document.createElement('div'); this.divOther = document.createElement('div'); this.oldModel = { page: '', style: '', }; } onButtonClick(ev) { this.preparePageForClick(); } icon() { return { h_index: 100, groupName: 'all', title: 'Editor', iconText: 'fa-code' }; } onToolBarChange() { const elSub = this.apiHelperClass.docParent.querySelector('#helperClassUlMySubClass'); const elState = this.apiHelperClass.docParent.querySelector('#helperClassBtnDefaultState'); if (elSub) elSub.style.display = ''; if (elState) elState.parentElement.style.display = ''; } onSelectedChange() { } preparePageForClick() { if (!this.apiHelperClass.state.className) return; this.init(); const elSub = this.apiHelperClass.docParent.querySelector('#helperClassUlMySubClass'); const elState = this.apiHelperClass.docParent.querySelector('#helperClassBtnDefaultState'); if (elSub) elSub.style.display = 'none'; if (elState) elState.parentElement.style.display = 'none'; } init() { this.state.divHelper.style.display = ''; this.state.divHelper.style.width = '100%'; this.state.divHelper.style.height = 'calc(100vh - 100px)'; this.createEditor(); } createEditor() { const contr = mls.contributions; if (!contr.helpers || !contr.helpers.style) { if (!contr.helpers) contr.helpers = {}; contr.helpers.style = { editorActive: '', fireCommunity: false, editor: { page: {}, style: {}, others: {} } }; this.state.divHelper.innerHTML = ''; } this.divOther.style.cssText = 'display:none; height: calc(100vh - 100px);'; this.divPage.style.cssText = 'display:none; height: calc(100vh - 100px);'; this.divPageCommunity.style.cssText = 'display:none;'; this.divStyle.style.cssText = 'display:none; height: calc(100vh - 100px);'; if (this.apiHelperClass.state.className === '#allClassCssPage' || this.apiHelperClass.state.origin === 'cssPage') { this.divPage.style.display = ''; } else if (this.apiHelperClass.state.className === 'this') { this.divStyle.style.display = ''; } if (this.state.divHelper.children.length === 0) { this.state.divHelper.appendChild(this.divStyle); this.state.divHelper.appendChild(this.divPage); this.state.divHelper.appendChild(this.divPageCommunity); this.state.divHelper.appendChild(this.divOther); if (this.apiHelperClass.state.origin === 'cssPageDS') { this.createEditorPageDS(); } else { this.createEditorPage(); this.createEditorStyle(); } } if (this.apiHelperClass.state.origin === 'cssPageDS') { this.divPage.style.display = ''; contr.helpers.style.editorActive = 'page'; if (contr.helpers.style.editor.page) contr.helpers.style.editor.page.layout(); } else if (this.apiHelperClass.state.className === '#allClassCssPage' || this.apiHelperClass.state.origin === 'cssPage') { contr.helpers.style.editorActive = 'page'; if (contr.helpers.style.editor.page) contr.helpers.style.editor.page.layout(); } else if (this.apiHelperClass.state.className === 'this') { contr.helpers.style.editorActive = 'this'; if (contr.helpers.style.editor.style) contr.helpers.style.editor.style.layout(); } else { this.divOther.style.display = ''; contr.helpers.style.editorActive = 'other'; this.createEditorOther(); } this.updateModel(); } updateModel() { const contr = mls.contributions; const active = contr.helpers.style.editorActive; let textCss = ''; let model; if (active === 'page') { contr.helpers.style.editor.page.getModel().setEOL(0); } else if (active === 'this') { textCss = 'element.style {\n\n' + ' ' + mls.l4.selectedNode.el.style.cssText.replace(/' '/g, '').split(';').join(';\n ') + '\n}'; model = contr.helpers.style.editor.style.getModel(); } else if (active !== '') { textCss = this.getCssText(); textCss = '// Read-Only, origen: ' + this.apiHelperClass.state.origin.split('/').pop() + '\n' + textCss; model = contr.helpers.style.editor.other.getModel(); } if (!model) return; model.setValue(textCss); } setCommunityEditor() { if (!mls.l4.selectedNode) return; const external_Commnunity = l2_html['_100131_automation_Community']; const el = external_Commnunity.createItensCommunity(mls.l4.selectedNode.getName(), true); if (!el || el.children.length <= 0) { el.innerHTML = '<h6>Do you want to be part of our community? <a href="#">Click here</a> to learn how!!</h6>'; } el.style.overflow = 'hidden'; el.style.overflowY = 'auto'; el.style.height = 'calc(100% - 50px)'; el.classList.add('scroll-custom'); this.divPageCommunity.innerHTML = '<h5 class="mt-3">Community</h5>'; this.divPageCommunity.appendChild(el); this.divPageCommunity.style.display = ''; } createEditorStyle() { const contr = mls.contributions; let textCss = ''; let timeoutStyle; const _readOnly = false; contr.helpers.style.editor.style = mls.common.editor.createMonaco('4', '', this.divStyle, 'less', { readOnly: _readOnly }); const model = contr.helpers.style.editor.style.getModel(); textCss = 'element.style {\n\n' + ' ' + mls.l4.selectedNode.el.style.cssText.replace(/' '/g, '').split(';').join(';\n ') + '\n}'; this.oldModel.style = textCss; model.setValue(textCss); model.onDidChangeContent(() => { clearTimeout(timeoutStyle); timeoutStyle = setTimeout(() => { if (this.oldModel.style === model.getValue()) return; this.oldModel.style = model.getValue(); this.saveCss(); }, 900); }); } createEditorPage() { const contr = mls.contributions; let textCss = ''; let timeoutPage; const _readOnly = false; contr.helpers.style.editor.page = mls.common.editor.createMonaco('5', '', this.divPage, 'less', { readOnly: _readOnly, wordWrap: "on", wrappingIndent: "indent", }); const model = contr.helpers.style.editor.page.getModel(); const external_CSSLESS = l2_html['_100131_automation_CSS_LESS_Interface']; model.setEOL(0); if (external_CSSLESS) external_CSSLESS.addEvents(contr.helpers.style.editor.page); textCss = mls.l4.pageNodes.children[0]['cssPage'].value || '// CSS Styles'; this.oldModel.page = textCss; model.setValue(textCss); model.onDidChangeContent(() => { clearTimeout(timeoutPage); timeoutPage = setTimeout(() => { if (this.oldModel.page === model.getValue()) return; this.oldModel.page = model.getValue(); this.saveCssPage(); }, 900); }); } createEditorPageDS() { const contr = mls.contributions; let textCss = contr.apiHelperClass.cssExample; let timeoutPage; const _readOnly = false; contr.helpers.style.editor.page = mls.common.editor.createMonaco('5', '', this.divPage, 'less', { readOnly: _readOnly, wordWrap: "on", wrappingIndent: "indent", }); const model = contr.helpers.style.editor.page.getModel(); const external_CSSLESS = l2_html['_100131_automation_CSS_LESS_Interface']; model.setEOL(0); if (external_CSSLESS) external_CSSLESS.addEvents(contr.helpers.style.editor.page); this.oldModel.page = ''; model.setValue(textCss); model.onDidChangeContent(() => { clearTimeout(timeoutPage); timeoutPage = setTimeout(() => { if (this.oldModel.page === model.getValue()) return; this.oldModel.page = model.getValue(); this.apiHelperClass.updateValues(); }, 900); }); } createEditorOther() { const contr = mls.contributions; let textCss = ''; const _readOnly = true; contr.helpers.style.editor.other = mls.common.editor.createMonaco('6', '', this.divOther, 'less', { readOnly: _readOnly }); const model = contr.helpers.style.editor.other.getModel(); textCss = this.getCssText(); textCss = '// Read-Only, origen: ' + this.apiHelperClass.state.origin.split('/').pop() + '\n' + textCss; model.setValue(textCss); } getCssText() { let cssText = ''; if (!this.apiHelperClass.state.className) return ''; if (this.apiHelperClass.state.className === 'this') { cssText = 'element.style {\n\n' + ' ' + this.apiHelperClass.state.style.cssText.replace(/' '/g, '').split(';').join(';\n ') + '\n}'; this.startClass = 'element.style {'; } else if (this.apiHelperClass.state.rule) { cssText = this.apiHelperClass.state.rule.cssText.replace(/{/g, '{\n\n ').replace(/;/g, ';\n ').replace(/}/g, '\n}'); } return cssText; } saveCss() { var _a, _b; const contr = mls.contributions; const active = contr.helpers.style.editorActive; let model; if (active === 'this') { model = (_a = contr.helpers.style.editor.style) === null || _a === void 0 ? void 0 : _a.getModel(); } else if (active !== '') { model = (_b = contr.helpers.style.editor.other) === null || _b === void 0 ? void 0 : _b.getModel(); } if (!model) return; let cssStyle = model.getValue(); mls.l2.compileLess(cssStyle).then((output) => { if (output === '') { if (this.apiHelperClass.state.className !== 'this') { } else { this.apiHelperClass.state.style.cssText = ''; this.apiHelperClass.updateValues(); } } if (output) { if (this.apiHelperClass.state.className !== 'this') { } else { cssStyle = cssStyle.replace('element.style {', '').replace('}', '').replace(/\n/g, ' '); this.apiHelperClass.state.style.cssText = cssStyle; this.apiHelperClass.updateValues(); } } }, (error) => { }); } saveCssPage() { if (!this.apiHelperClass.state.className || (this.apiHelperClass.state.className === 'this' && !mls.contributions.helpers.style.fireCommunity)) return; const contr = mls.contributions; if (!contr.helpers.style || !contr.helpers.style.editor.page) return; const model = contr.helpers.style.editor.page.getModel(); if (!model) return; const cssStyle = model.getValue(); mls.l2.compileLess(cssStyle).then((output) => { if (output === '') { mls.l4.pageNodes.children[0]['cssPage'].value = ''; mls.l4.onWidgetsChanges(true, true, false); this.apiHelperClass.fetch(); } if (output) { let cssPage = cssStyle; mls.l4.pageNodes.children[0]['cssPage'].value = cssPage; mls.l4.onWidgetsChanges(true, true, true); const arrayEls = document.querySelectorAll('#hcInputClass .spanTag'); setTimeout(() => { this.apiHelperClass.verifyExistRuler(arrayEls, 'label'); }, 900); } if (!this.apiHelperClass.state.rule || this.apiHelperClass.state.origin !== 'cssPage') { this.apiHelperClass.state.className = '#allClassCssPage'; } }, (error) => { }); mls.contributions.helpers.style.fireCommunity = false; } } l2_html._100131_helper_class_buttons_Editor = _100131_helper_class_buttons_Editor; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Effects extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } icon() { return { h_index: 500, groupName: 'subGroup', title: 'Effects', iconText: 'fa-magic' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastHelper'] = 'Effects'; this.state.divHelper.style.display = ''; this.state.addToolBarSub('helper_class_buttons_Effects_', true, this.state.divHelper); } } l2_html._100131_helper_class_buttons_Effects = _100131_helper_class_buttons_Effects; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Effects_ClipPath extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_filterClipPath'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 100, groupName: 'style', title: 'ClipPath', iconText: 'fa-scissors' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'ClipPath'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_filterClipPath', true); } } l2_html._100131_helper_class_buttons_Effects_ClipPath = _100131_helper_class_buttons_Effects_ClipPath; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Effects_FilterImg extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_filterImg'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 200, groupName: 'style', title: 'FilterImg', iconText: 'fa-filter' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'ClipPath'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_filterImg', true); } } l2_html._100131_helper_class_buttons_Effects_FilterImg = _100131_helper_class_buttons_Effects_FilterImg; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Effects_ShadowBox extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_boxShadows'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 300, groupName: 'style', title: 'BoxShadows', iconText: 'fa-window-restore' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'BoxShadows'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_boxShadows', true); } } l2_html._100131_helper_class_buttons_Effects_ShadowBox = _100131_helper_class_buttons_Effects_ShadowBox; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Effects_Transforms extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_transform'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 400, groupName: 'style', title: 'Transforms', iconText: 'fa-magnet' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Transforms'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_transform', true); } } l2_html._100131_helper_class_buttons_Effects_Transforms = _100131_helper_class_buttons_Effects_Transforms; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } icon() { return { h_index: 400, groupName: 'subGroup', title: 'Layout', iconText: 'fa-object-group' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastHelper'] = 'Layout'; this.state.divHelper.style.display = ''; this.state.addToolBarSub('helper_class_buttons_Layout_', true, this.state.divHelper); } } l2_html._100131_helper_class_buttons_Layout = _100131_helper_class_buttons_Layout; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout_BlockSize extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_size'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 100, groupName: 'style', title: 'Size', iconText: 'fa-expand', }; } onToolBarChange() { } onSelectedChange() { } onUpdateUI() { const l4 = window['l4_html']; if (!l4 || !l4.helper_class_size || !l4.helper_class_size.loadHelperValues) return; l4.helper_class_size.loadHelperValues(); } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Size'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_size', true); } } _100131_helper_class_buttons_Layout_BlockSize.tags = ['size', 'width', 'height']; l2_html._100131_helper_class_buttons_Layout_BlockSize = _100131_helper_class_buttons_Layout_BlockSize; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout_FlexContainer extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_flex'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 200, groupName: 'style', title: 'Flex', iconText: 'fa-filter' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Container'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_flex', true); } } l2_html._100131_helper_class_buttons_Layout_FlexContainer = _100131_helper_class_buttons_Layout_FlexContainer; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout_FlexItem extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_flexItem'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 300, groupName: 'style', title: 'FlexItem', iconText: 'fa-sitemap' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'FlexItem'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_flexItem', true); } } l2_html._100131_helper_class_buttons_Layout_FlexItem = _100131_helper_class_buttons_Layout_FlexItem; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout_Grid extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_grid'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 200, groupName: 'style', title: 'Grid', iconText: 'fa-th-large' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Container'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_grid', true); } } l2_html._100131_helper_class_buttons_Layout_Grid = _100131_helper_class_buttons_Layout_Grid; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout_Margin extends l2_html.BaseButton { constructor() { super(...arguments); this.thisProject = 100131; this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_' + this.thisProject + '_helper_class_margin'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 500, groupName: 'style', title: 'Margin', iconText: 'fa-plus' }; } onToolBarChange() { } onSelectedChange() { } onUpdateUI() { const l4 = window['l4_html']; if (!l4 || !l4.helper_class_margin || !l4.helper_class_margin.loadHelperValues) return; l4.helper_class_margin.loadHelperValues(); } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Spacing'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, this.thisProject, 'helper_class_margin', true); } } _100131_helper_class_buttons_Layout_Margin.tags = ['margin']; l2_html._100131_helper_class_buttons_Layout_Margin = _100131_helper_class_buttons_Layout_Margin; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout_Padding extends l2_html.BaseButton { constructor() { super(...arguments); this.thisProject = 100131; this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_' + this.thisProject + '_helper_class_padding'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 500, groupName: 'style', title: 'Padding', iconText: 'fa-home' }; } onToolBarChange() { } onSelectedChange() { } onUpdateUI() { const l4 = window['l4_html']; if (!l4 || !l4.helper_class_padding || !l4.helper_class_padding.loadHelperValues) return; l4.helper_class_padding.loadHelperValues(); } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Spacing'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, this.thisProject, 'helper_class_padding', true); } } _100131_helper_class_buttons_Layout_Padding.tags = ['padding']; l2_html._100131_helper_class_buttons_Layout_Padding = _100131_helper_class_buttons_Layout_Padding; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Layout_Position extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_position'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 400, groupName: 'style', title: 'Position', iconText: 'fa-arrows' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } onUpdateUI() { const l4 = window['l4_html']; if (!l4 || !l4.helper_class_position || !l4.helper_class_position.loadHelperValues) return; l4.helper_class_position.loadHelperValues(); } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Position'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_position', true); } } _100131_helper_class_buttons_Layout_Position.tags = ['position']; l2_html._100131_helper_class_buttons_Layout_Position = _100131_helper_class_buttons_Layout_Position; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Typography extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } icon() { return { h_index: 300, groupName: 'subGroup', title: 'Typography', iconText: 'fa-font' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastHelper'] = 'Typography'; this.state.divHelper.style.display = ''; this.state.addToolBarSub('helper_class_buttons_Typography_', true, this.state.divHelper); } } l2_html._100131_helper_class_buttons_Typography = _100131_helper_class_buttons_Typography; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Typography_Columns extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_columns'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 100, groupName: 'style', title: 'Columns', iconText: 'fa-columns' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Columns'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_columns', true); } } l2_html._100131_helper_class_buttons_Typography_Columns = _100131_helper_class_buttons_Typography_Columns; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Typography_ShadowText extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_textShadows'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 200, groupName: 'style', title: 'TextShadows', iconText: 'fa-font' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'TextShadows'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_textShadows', true); } } l2_html._100131_helper_class_buttons_Typography_ShadowText = _100131_helper_class_buttons_Typography_ShadowText; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_buttons_Typography_Typography extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_100131_helper_class_typography'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 300, groupName: 'style', title: 'Typography', iconText: 'fa-font' }; } onToolBarChange() { } onSelectedChange() { } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Typography'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, 100131, 'helper_class_typography', true); } } l2_html._100131_helper_class_buttons_Typography_Typography = _100131_helper_class_buttons_Typography_Typography; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_color extends l2_html.Base { constructor() { super(...arguments); this.value = new l2_fieldTypes.Input(this, { group: 'principal', name: 'value', elName: 'defaultValue', elType: 'none', desc: 'Value or field' }); this.title = new l2_fieldTypes.Input(this, { group: 'advanced', elType: 'none', name: 'title', desc: 'title for input' }); } render() { if (this.el) { this.el.innerHTML = ''; } return this.RenderInputRange(); } RenderInputRange() { super.createEL('span'); this.mountComponent(); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } mountComponent() { const span = document.createElement('span'); span.innerText = this.title.value; const span2 = document.createElement('span'); span2.className = '_18'; const color = document.createElement('input'); color.value = this.value.value; color.type = 'color'; color.className = '_5'; color.id = 'idInput' + this.position; span2.appendChild(color); this.el.appendChild(span); this.el.appendChild(span2); } } _100131_helper_class_color._SearchDetails = { desc: 'Class ranger helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_color = _100131_helper_class_color; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_columns extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_columns._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_columns = _100131_helper_class_columns; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_container extends l2_html.Base { render() { if (this.el) { this.el.innerHTML = ''; } return this.RenderTemplateContainer(); } RenderTemplateContainer() { super.createEL('table'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = 'helper_class ' + this.class.value; return this.el; } } _100131_helper_class_container._SearchDetails = { desc: 'This component is specific for helperClass', section: l2_html.PCategories.internal, group: 'helper', tags: ['ElhelperClassContainer'], childrenTags: ['ElhelperClassContainerItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_container = _100131_helper_class_container; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_dropdown extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field' }); this.title = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'title for field', elType: 'none' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('select'); this.generateOptions(); this.el.className = '_17 ' + this.class.value; l2_fieldTypes.renderAllFields(this.el, this); this.el.setAttribute('title', this.title.value); return this.el; } generateOptions() { const lines = this.items.value.trim().split(/\n/); for (let i = 0; i < lines.length; i++) { if (lines[i] === 'null') { const option = document.createElement('option'); option.value = ''; option.innerText = ''; option.className = '_12'; this.el.appendChild(option); } else { const option = document.createElement('option'); option.value = lines[i]; option.innerText = lines[i]; option.className = '_12'; this.el.appendChild(option); } } } } _100131_helper_class_dropdown._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_dropdown = _100131_helper_class_dropdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_dropdown2 extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field' }); this.title = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'title for field', elType: 'none' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('select'); this.generateOptions(); this.el.className = '_17 ' + this.class.value; if (!this.id.value) this.id.value = 'hcDropDown' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.el.setAttribute('title', this.title.value); return this.el; } generateOptions() { const lines = this.items.value.trim().split(/\n/); for (let i = 0; i < lines.length; i++) { if (lines[i] === 'null') { const option = document.createElement('option'); option.value = ''; option.innerText = ''; option.className = '_12'; this.el.appendChild(option); } else { const option = document.createElement('option'); option.value = lines[i]; option.innerText = lines[i]; option.className = '_12'; this.el.appendChild(option); } } } } _100131_helper_class_dropdown2._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_dropdown2 = _100131_helper_class_dropdown2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_filterClipPath extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_filterClipPath._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_filterClipPath = _100131_helper_class_filterClipPath; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_filterImg extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } l2_html._100131_helper_class_filterImg = _100131_helper_class_filterImg; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flex extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_flex._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_flex = _100131_helper_class_flex; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexExampleL7_1 extends l2_html.Base { render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTemplateContainer(); } renderTemplateContainer() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_flexExampleL7_1._SearchDetails = { desc: 'This component is specific for helperClass', section: l2_html.PCategories.internal, group: 'helper', tags: ['ElflexExampleL7'], childrenTags: ['!restricted'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexExampleL7_1 = _100131_helper_class_flexExampleL7_1; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexExampleL7_2 extends l2_html.Base { render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTemplateContainer(); } renderTemplateContainer() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_flexExampleL7_2._SearchDetails = { desc: 'This component is specific for helperClass', section: l2_html.PCategories.internal, group: 'helper', tags: ['ElflexExampleL7'], childrenTags: ['!restricted'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexExampleL7_2 = _100131_helper_class_flexExampleL7_2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexGallery extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML', elType: 'none' }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'title', type: 'text', group: 'optional', elType: 'none', helperOptions: 'innerText', helper: '_100131_helper_TextHTML' }); } renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTitle(); } renderTitle() { super.createEL('tr'); l2_fieldTypes.renderAllFields(this.el, this); const td = document.createElement('td'); const div = document.createElement('div'); div.innerText = 'Flex Rows'; div.className = '_97'; td.appendChild(div); this.el.appendChild(td); this.el.className = '_0 ' + this.class.value; let title; title = this.createFlex('flexstart'); this.el.appendChild(title); title = this.createFlex('flexend'); this.el.appendChild(title); title = this.createFlex('center'); this.el.appendChild(title); title = this.createFlex('spacebetween'); this.el.appendChild(title); title = this.createFlex('spacearound'); this.el.appendChild(title); return this.el; } createFlex(id) { const td = document.createElement('td'); const div = document.createElement('div'); div.className = '_40'; div.style.width = '150px'; div.id = id; const divChild1 = document.createElement('div'); const divChild2 = document.createElement('div'); const divChild3 = document.createElement('div'); div.appendChild(divChild1); div.appendChild(divChild2); div.appendChild(divChild3); td.appendChild(div); return td; } } _100131_helper_class_flexGallery._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexGallery = _100131_helper_class_flexGallery; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexGalleryHorizontal extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML', elType: 'none' }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'title', type: 'text', group: 'optional', elType: 'none', helperOptions: 'innerText', helper: '_100131_helper_TextHTML' }); } renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTitle(); } renderTitle() { super.createEL('tr'); const td = document.createElement('td'); td.colSpan = 2; l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 ' + this.class.value; let title; title = this.createFlex(td, 'flexstart'); this.el.appendChild(title); title = this.createFlex(td, 'flexend'); this.el.appendChild(title); title = this.createFlex(td, 'center'); this.el.appendChild(title); title = this.createFlex(td, 'spacebetween'); this.el.appendChild(title); title = this.createFlex(td, 'spacearound'); this.el.appendChild(title); return this.el; } createFlex(element, id) { const div = document.createElement('div'); div.className = '_40'; div.id = id; const divChild1 = document.createElement('div'); const divChild2 = document.createElement('div'); const divChild3 = document.createElement('div'); const divChild4 = document.createElement('div'); div.appendChild(divChild1); div.appendChild(divChild2); div.appendChild(divChild3); div.appendChild(divChild4); element.appendChild(div); return element; } } _100131_helper_class_flexGalleryHorizontal._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexGalleryHorizontal = _100131_helper_class_flexGalleryHorizontal; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexGalleryHorizontal2 extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML', elType: 'none' }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'title', type: 'text', group: 'optional', elType: 'none', helperOptions: 'innerText', helper: '_100131_helper_TextHTML' }); } renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTitle(); } renderTitle() { super.createEL('tr'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 ' + this.class.value; const td = document.createElement('td'); const div = document.createElement('div'); div.innerText = 'Flex Columns'; div.className = '_98'; td.appendChild(div); this.el.appendChild(td); let title; title = this.createFlexColumn('flexstartColumn'); this.el.appendChild(title); title = this.createFlexColumn('centerColumn'); this.el.appendChild(title); title = this.createFlexColumn('flexendColumn'); this.el.appendChild(title); title = this.createFlexColumn('reverseColumn'); this.el.appendChild(title); return this.el; } createFlexColumn(id) { const td = document.createElement('td'); const div = document.createElement('div'); div.className = '_90'; div.id = id; const divChild1 = document.createElement('div'); divChild1.innerText = 'Item 1'; const divChild2 = document.createElement('div'); divChild2.innerText = 'Item 2'; const divChild3 = document.createElement('div'); divChild3.innerText = 'Item 3'; const divChild4 = document.createElement('div'); divChild4.innerText = 'Item 4'; div.appendChild(divChild1); div.appendChild(divChild2); div.appendChild(divChild3); div.appendChild(divChild4); td.appendChild(div); return td; } } _100131_helper_class_flexGalleryHorizontal2._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexGalleryHorizontal2 = _100131_helper_class_flexGalleryHorizontal2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexItem extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_flexItem._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_flexItem = _100131_helper_class_flexItem; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexItemGallery extends l2_html.Base { renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderGaleryFlexItem(); } renderGaleryFlexItem() { super.createEL('tr'); const td = document.createElement('td'); td.className = '_100'; const div = document.createElement('div'); div.innerText = 'Flex basis'; div.className = '_99'; td.appendChild(div); this.el.appendChild(td); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 ' + this.class.value; let title; title = this.createFlex('16%', '16%', '0'); this.el.appendChild(title); title = this.createFlex('25%', '25%', '1'); this.el.appendChild(title); title = this.createFlex('30%', '30%', '2'); this.el.appendChild(title); title = this.createFlex('50%', '50%', '3'); this.el.appendChild(title); return this.el; } createFlex(scale, basis, id) { const td = document.createElement('td'); const div = document.createElement('div'); div.id = 'flexItemGallery' + id; div.style.display = 'flex'; div.style.flexDirection = 'row'; div.style.flexWrap = 'wrap'; div.style.cursor = 'pointer'; const divChild = document.createElement('div'); divChild.id = 'flexItemGalleryChild'; divChild.style.flexGrow = '0'; divChild.style.flexShrink = '0'; divChild.style.flexBasis = basis; const divChild2 = document.createElement('div'); divChild2.style.padding = '.8em 1em 0'; divChild2.style.marginBottom = '1em'; divChild2.style.background = 'rgba(144, 12, 63, 0.2)'; divChild2.style.border = '1px solid #900C3F'; divChild2.style.borderRadius = '3px'; divChild2.innerText = scale; divChild.appendChild(divChild2); div.appendChild(divChild); td.appendChild(div); return td; } } _100131_helper_class_flexItemGallery._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexItemGallery = _100131_helper_class_flexItemGallery; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexItemGallery2 extends l2_html.Base { renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderGaleryFlexItem(); } renderGaleryFlexItem() { super.createEL('tr'); const td = document.createElement('td'); td.colSpan = 2; l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 ' + this.class.value; let title; title = this.createFlex2(td); this.el.appendChild(title); return this.el; } createFlex2(element) { const div = document.createElement('div'); div.id = 'flexItemGallery2'; div.className = '_80'; const divChild1 = document.createElement('div'); divChild1.className = '_81'; divChild1.innerHTML = 'Child One<br>Lorem ipsum<br>dolor sit amet<br>This is a bit longer line'; const divChild2 = document.createElement('div'); divChild2.className = '_82'; divChild2.innerText = 'Two'; div.appendChild(divChild1); div.appendChild(divChild2); element.appendChild(div); return element; } } _100131_helper_class_flexItemGallery2._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexItemGallery2 = _100131_helper_class_flexItemGallery2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flexItemGalleryGrow extends l2_html.Base { renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderGaleryFlexItem(); } renderGaleryFlexItem() { super.createEL('tr'); const td = document.createElement('td'); td.className = '_100'; const div = document.createElement('div'); div.innerText = 'Flex grow'; div.className = '_99'; td.appendChild(div); this.el.appendChild(td); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 ' + this.class.value; let title; title = this.createFlex('1/6', '16%', '5'); this.el.appendChild(title); return this.el; } createFlex(scale, basis, id) { const td = document.createElement('td'); const div = document.createElement('div'); div.id = 'flexItemGallery' + id; div.style.display = 'flex'; div.style.flexDirection = 'row'; div.style.flexWrap = 'wrap'; div.style.cursor = 'pointer'; const divChild3 = document.createElement('div'); divChild3.style.flex = '1 1 0'; const divChild4 = document.createElement('div'); divChild4.style.padding = '.8em 1em 0'; divChild4.style.marginBottom = '1em'; divChild4.style.background = 'rgba(51, 153, 204, 0.2)'; divChild4.style.border = '1px solid #33cccc'; divChild4.style.borderRadius = '3px'; divChild4.innerText = 'grow'; divChild3.appendChild(divChild4); div.appendChild(divChild3); td.appendChild(div); return td; } } _100131_helper_class_flexItemGalleryGrow._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_flexItemGalleryGrow = _100131_helper_class_flexItemGalleryGrow; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_flex_bootstrap extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_class_flex_bootstrap = _100131_helper_class_flex_bootstrap; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_gallery extends l2_html.Base { constructor() { super(...arguments); this.typeGallery = new l2_fieldTypes.EnumList(this, { group: 'principal', name: 'typeGallery', desc: 'max value of number', elType: 'attr', list: ['backGround', 'text', 'custom'] }); this._funcMount = { backGround: this.configComponentBackGround.bind(this), text: this.configComponentText.bind(this), custom: this.configComponentCustom.bind(this) }; } renderHTML() { const el = this.render(); return el; } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); if (!this.id.value) this.id.value = 'contentGallery_' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.el.className += ' my_helper_class_gallery'; this.mountComponent(); return this.el; } mountComponent() { if (!this.typeGallery.value || !this._funcMount[this.typeGallery.value]) return; this._funcMount[this.typeGallery.value](); } configComponentBackGround() { this.children.forEach((item) => { item.renderHTML(); const el = item.el; el.className = 'colors_item hcGalleryItem'; el.innerText = ''; this.el.appendChild(el); }); } configComponentText() { this.children.forEach((item) => { item.renderHTML(); const el = item.el; el.classList.add('hcGalleryItem'); el.classList.remove('colors_item'); this.el.appendChild(el); }); } configComponentCustom() { this.children.forEach((item) => { item.renderHTML(); const el = item.el; el.classList.add('hcGalleryItem'); el.classList.remove('colors_item'); this.el.appendChild(el); }); } } _100131_helper_class_gallery._SearchDetails = { section: l2_html.PCategories.Media, desc: 'Color gallery widget', tags: ['colors', 'ElhelperClassContainerSubItem'], childrenTags: ['colors_item'], examples: [ '{ }' ] }; l2_html._100131_helper_class_gallery = _100131_helper_class_gallery; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_gallery_item extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Defines background color', type: 'text' }); this.nameClass = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Defines background color', type: 'text', elType: 'attr' }); this.styleText = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Defines background color', type: 'text', elType: 'attr' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_gallery_item._SearchDetails = { section: l2_html.PCategories.Media, group: 'Media', desc: 'Widget item color gallery', parentTags: ['colors'], tags: ['colors_item'], childrenTags: ['!elChild', '!restricted'], examples: [ '{ }' ] }; l2_html._100131_helper_class_gallery_item = _100131_helper_class_gallery_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_html extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML', elType: 'none' }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'title', type: 'text', group: 'optional', elType: 'none', helperOptions: 'innerText', helper: '_100131_helper_TextHTML' }); } renderHTML() { if (this.el) this.el.innerHTML = ''; const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTitle(); } prepareChildren(elToRender) { for (let i = 0; i < this.children.length; i++) { this.renderChild(elToRender, this.children[i]); } } renderTitle() { super.createEL('tr'); const td = document.createElement('td'); td.className = '_1'; td.colSpan = 2; td.title = this.title.value; const tdChild = document.createElement('td'); tdChild.colSpan = 2; this.prepareChildren(tdChild); l2_fieldTypes.renderAllFields(this.el, this); this.el.appendChild(tdChild); this.el.className = '_0 ' + this.class.value; return this.el; } renderChild(el, children) { const ex = children; ex.renderHTML(); el.appendChild(ex.el); } } _100131_helper_class_html._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['!elChild', '!restricted'], examples: [ '{}' ] }; l2_html._100131_helper_class_html = _100131_helper_class_html; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_input extends l2_html.Base { constructor() { super(...arguments); this.value = new l2_fieldTypes.Input(this, { group: 'principal', name: 'value', elName: 'defaultValue', desc: 'Value or field' }); this.list = new l2_fieldTypes.Input(this, { group: 'advanced', desc: 'style', elType: 'attr' }); this.accept = new l2_fieldTypes.Input(this, { group: 'principal', name: 'accept', elType: 'string', desc: 'Specifies allowed file types' }); this.max = new l2_fieldTypes.Input(this, { group: 'principal', name: 'max', desc: 'max value of number', elType: 'string', type: 'number' }); this.maxLength = new l2_fieldTypes.Input(this, { group: 'advanced', name: 'maxLength', desc: 'Specifies the maximum number of characters allowed in an input element', min: 0, elType: 'string', type: 'number' }); this.min = new l2_fieldTypes.Input(this, { group: 'principal', name: 'min', desc: 'max value of number', elType: 'string', type: 'number' }); this.step = new l2_fieldTypes.Input(this, { group: 'principal', name: 'step', desc: 'step of number', elType: 'string', type: 'number' }); this.placeholder = new l2_fieldTypes.Input(this, { group: 'principal', name: 'placeholder', desc: 'label for not value' }); this.title = new l2_fieldTypes.Input(this, { group: 'advanced', name: 'title', desc: 'title for input', elType: 'attr' }); this.readOnly = new l2_fieldTypes.Boolean(this, { group: 'advanced', name: 'readOnly', desc: 'true dont allow changes', elType: 'boolean' }); this.disabled = new l2_fieldTypes.Boolean(this, { group: 'advanced', name: 'disabled', desc: 'Specifies that an input element should be disabled', elType: 'boolean', help: 'https://www.w3schools.com/tags/att_input_disabled.asp' }); this.required = new l2_fieldTypes.Boolean(this, { group: 'advanced', name: 'required', desc: 'Specifies that an input field must be filled out before submitting the form', elType: 'boolean', help: 'https://www.w3schools.com/tags/att_input_required.asp' }); this.pattern = new l2_fieldTypes.Input(this, { group: 'advanced', name: 'pattern', desc: " Specifies a regular expression that an <input> element's value is checked against", help: 'https://regex101.com/' }); this.type = new l2_fieldTypes.EnumList(this, { group: 'principal', name: 'type', desc: 'type for consistencies', list: ['text', 'button', 'color', 'checkbox', 'date', 'datetime-local', 'email', 'file', 'hidden', 'month', 'number', 'password', 'range', 'radio', 'search', 'tel', 'time', 'url', 'week'], onChange: () => { this.max.visible = ['month', 'number', 'range'].indexOf(this.type.value) >= 0; this.min.visible = ['month', 'number', 'range'].indexOf(this.type.value) >= 0; this.step.visible = ['range'].indexOf(this.type.value) >= 0; this.checked.visible = ['checkbox', 'radio'].indexOf(this.type.value) >= 0; } }); this.checked = new l2_fieldTypes.EnumList(this, { group: 'advanced', name: 'checked', desc: 'checked', elType: 'attr', list: ['checked'] }); } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderInput(); } renderInput() { super.createEL('input'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_input._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_input = _100131_helper_class_input; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_input_color extends l2_html.Base { render() { if (this.el) this.el.innerHTML = ''; super.createEL('span'); if (!this.id.value) this.id.value = 'inputColor_' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.mountComponent(); return this.el; } mountComponent() { const input = document.createElement('input'); input.type = 'color'; input.className = '_5'; const span = document.createElement('span'); span.className = 'fa fa-ban'; span.style.cursor = 'pointer'; span.style.display = 'none'; span.style.marginLeft = '5px'; this.el.style.alignItems = 'center'; this.el.appendChild(input); this.el.appendChild(span); } } _100131_helper_class_input_color._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_input_color = _100131_helper_class_input_color; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_position extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_position._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_position = _100131_helper_class_position; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_position_bootstrap extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_class_position_bootstrap = _100131_helper_class_position_bootstrap; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_radioGroup extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.generateRadio(); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } generateRadio() { const lines = this.items.value.trim().split(/\n/); for (let i = 0; i < lines.length; i++) { const label = document.createElement('label'); const input = document.createElement('input'); input.type = 'radio'; input.id = 'idInputRadioGroup_' + this.position + i; input.className = '_10'; label.htmlFor = 'idInputRadioGroup_' + this.position + i; label.innerText = lines[i]; label.className = '_11'; input.value = lines[i]; this.el.appendChild(input); this.el.appendChild(label); } } } _100131_helper_class_radioGroup._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_radioGroup = _100131_helper_class_radioGroup; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_radioGroup2 extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.id.value = this.id.value ? this.id.value : 'radioGroupHC' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.generateRadio(); return this.el; } generateRadio() { const lines = this.items.value.trim().split(/\n/); for (let i = 0; i < lines.length; i++) { const label = document.createElement('label'); const input = document.createElement('input'); input.type = 'radio'; input.id = 'idInputRadioGroup_' + this.position + i; input.name = this.id.value; input.className = '_10'; label.htmlFor = 'idInputRadioGroup_' + this.position + i; label.innerText = lines[i]; label.className = '_11'; input.value = lines[i]; this.el.appendChild(input); this.el.appendChild(label); } } } _100131_helper_class_radioGroup2._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_radioGroup2 = _100131_helper_class_radioGroup2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_radioGroupClass extends l2_html.Base { constructor() { super(...arguments); this.itens = new l2_fieldTypes.TextArea(this, { group: 'principal', name: 'itens', elName: 'defaultValue', desc: 'Value or field', elType: 'none' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); this.addBtnsList(); return this.el; } addBtnsList() { if (this.itens.value === '') return; this.itens.value.split('\n').forEach((item) => { if (item === '') return; const btn = document.createElement('button'); const cls = item.split(';').length > 1 ? item.split(';')[1] : ''; const text = item.split(';').length > 1 ? item.split(';')[0] : item; btn.innerText = text; btn.className = 'btn btn-outline-secondary ml-2 mb-2 helperClassBtnBootstrapGallery ' + cls; this.el.appendChild(btn); }); } } _100131_helper_class_radioGroupClass._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['div', 'elFieldset', 'elFlowContent', 'elPhrasingContent', 'ElhelperClassContainerSubItem'], childrenTags: ['!elChild', '!restricted'], examples: [ '{}' ] }; l2_html._100131_helper_class_radioGroupClass = _100131_helper_class_radioGroupClass; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_radioGroupClass2 extends l2_html.Base { constructor() { super(...arguments); this.itens = new l2_fieldTypes.TextArea(this, { group: 'principal', name: 'itens', elName: 'defaultValue', desc: 'Value or field', elType: 'none' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); if (!this.id.value) this.id.value = 'radioGroupClass_' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.el.style.height = 'max-content'; this.addBtnsList(); return this.el; } addBtnsList() { if (this.itens.value === '') return; this.itens.value.split('\n').forEach((item) => { if (item === '') return; const btn = document.createElement('button'); const cls = item.split(';').length > 1 ? item.split(';')[1] : ''; const text = item.split(';').length > 1 ? item.split(';')[0] : item; btn.innerText = text; btn.className = 'btn btn-outline-light ml-2 mb-2 helperClassBtnBootstrapGallery ' + cls; this.el.appendChild(btn); }); } } _100131_helper_class_radioGroupClass2._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['div', 'elFieldset', 'elFlowContent', 'elPhrasingContent', 'ElhelperClassContainerSubItem'], childrenTags: ['!elChild', '!restricted'], examples: [ '{}' ] }; l2_html._100131_helper_class_radioGroupClass2 = _100131_helper_class_radioGroupClass2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_range extends l2_html.Base { constructor() { super(...arguments); this.value = new l2_fieldTypes.Input(this, { group: 'principal', name: 'value', elName: 'defaultValue', elType: 'none', desc: 'Value or field' }); this.accept = new l2_fieldTypes.Input(this, { group: 'principal', name: 'accept', elType: 'none', desc: 'Specifies allowed file types' }); this.max = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'max value of number', elType: 'none', type: 'number' }); this.step = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'step', elType: 'none', type: 'number' }); this.min = new l2_fieldTypes.Input(this, { group: 'principal', name: 'min', desc: 'max value of number', elType: 'none', type: 'number' }); this.title = new l2_fieldTypes.Input(this, { group: 'advanced', elType: 'none', name: 'title', desc: 'title for input' }); this.idRange = new l2_fieldTypes.Input(this, { group: 'advanced', elType: 'none', desc: 'id Range' }); this.idInput = new l2_fieldTypes.Input(this, { group: 'advanced', elType: 'none', desc: 'id Input' }); this.type = new l2_fieldTypes.EnumList(this, { group: 'principal', name: 'type', desc: 'type for consistencies', list: ['text', 'button', 'color', 'checkbox', 'date', 'datetime-local', 'email', 'file', 'hidden', 'month', 'number', 'password', 'range', 'radio', 'search', 'tel', 'time', 'url', 'week'], elType: 'none' }); } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderInputRange(); } renderInputRange() { super.createEL('span'); this.mountComponent(); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } mountComponent() { const span = document.createElement('span'); span.innerText = this.title.value; const span2 = document.createElement('span'); span2.className = '_18'; const range = document.createElement('input'); range.value = this.value.value; range.type = 'range'; range.min = this.min.value; range.max = this.max.value; range.step = this.step.value; range.className = '_15'; this.idRange.value = 'idRange' + this.position; this.idInput.value = 'idInput' + this.position; range.id = this.idRange.value; const input = document.createElement('input'); input.value = this.value.value; if (this.type.value === '') { input.type = 'number'; } else { input.type = this.type.value; } input.className = '_16'; input.id = this.idInput.value; span2.appendChild(range); span2.appendChild(input); this.el.appendChild(span); this.el.appendChild(span2); } } _100131_helper_class_range._SearchDetails = { desc: 'Class ranger helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_range = _100131_helper_class_range; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_range2 extends l2_html.Base { constructor() { super(...arguments); this.max = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'max value of number', elType: 'none', type: 'number' }); this.min = new l2_fieldTypes.Input(this, { group: 'principal', name: 'min', desc: 'max value of number', elType: 'none', type: 'number' }); this.value = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'value value of number', elType: 'none', type: 'number' }); this.step = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'value value of number', elType: 'none', type: 'number', step: ".1" }); this._select = new l2_html['_100131_helper_class_select'](); this.unityType = this._select.unityType; } render() { if (this.el) this.el.innerHTML = ''; super.createEL('span'); if (!this.id.value) this.id.value = 'hcRanger_' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.mountComponent(); return this.el; } mountComponent() { const span = document.createElement('span'); span.className = '_18'; const range = document.createElement('input'); range.type = 'range'; if (this.min.value) range.min = this.min.value; if (this.max.value) range.max = this.max.value; if (this.value.value) range.defaultValue = this.value.value; if (this.step.value) range.step = this.step.value; range.className = '_15'; const input = document.createElement('input'); input.className = '_16'; input.type = 'search'; span.appendChild(range); span.appendChild(input); if (this.unityType.value && this.unityType.value !== 'none') { span.appendChild(this._select.render()); } this.el.appendChild(span); } } _100131_helper_class_range2._SearchDetails = { desc: 'Class ranger helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_range2 = _100131_helper_class_range2; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_range_drop extends l2_html.Base { constructor() { super(...arguments); this.max = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'max value of number', elType: 'none', type: 'number' }); this.value = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'default value of number', elType: 'none', type: 'number' }); this.min = new l2_fieldTypes.Input(this, { group: 'principal', name: 'min', desc: 'max value of number', elType: 'none', type: 'number' }); this.step = new l2_fieldTypes.Input(this, { group: 'principal', name: 'step', desc: 'step value of number', elType: 'none', type: 'text' }); this._select = new l2_html['_100131_input_dropdown'](); this.items = this._select.items; } render() { if (this.el) this.el.innerHTML = ''; super.createEL('span'); if (!this.id.value) this.id.value = 'hcRanger_' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.mountComponent(); return this.el; } mountComponent() { const span = document.createElement('span'); span.className = '_18'; const range = document.createElement('input'); range.type = 'range'; if (this.min.value) range.min = this.min.value ? this.min.value : '0'; if (this.max.value) range.max = this.max.value ? this.max.value : '100'; if (this.value.value) range.defaultValue = this.value.value; if (this.step.value) range.step = this.step.value; range.className = '_15'; span.appendChild(range); if (this.items.value && this.items.value !== 'none') { span.appendChild(this._select.render()); } this.el.appendChild(span); } } _100131_helper_class_range_drop._SearchDetails = { desc: 'Class ranger helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_range_drop = _100131_helper_class_range_drop; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_select extends l2_html.Base { constructor() { super(...arguments); this.unityType = new l2_fieldTypes.EnumList(this, { group: 'principal', name: 'unityType', desc: 'type for consistencies', list: ['none', 'col', 'unity'], elType: 'none' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('select'); l2_fieldTypes.renderAllFields(this.el, this); this.el.classList.add('_5'); this.createOptions(this.unityType.value, this.el); return this.el; } createOptions(tp, list) { const options = { col: ['col', 'px', 'rem', 'vh', 'vw', 'vmin', 'vmax', 'ex', 'ch'], unity: ['px', 'em', 'rem', '%', 'vh', 'vw', 'vmin', 'vmax', 'ex', 'ch'] }; if (!tp || (tp && tp === 'none') || !options[tp]) return; options[tp].forEach((item) => { const elOpt = document.createElement('option'); elOpt.innerText = item; elOpt.value = item; list.appendChild(elOpt); }); } } _100131_helper_class_select._SearchDetails = { desc: 'Class ranger helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_select = _100131_helper_class_select; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_size extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_size._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_size = _100131_helper_class_size; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_spacing extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_spacing._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_spacing = _100131_helper_class_spacing; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_textMuted extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML', elType: 'none' }); this.small = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'checked', elType: 'none', list: ['true', 'false'] }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'title', type: 'text', group: 'optional', elType: 'none', helperOptions: 'innerText', helper: '_100131_helper_TextHTML' }); } renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTitle(); } renderTitle() { super.createEL('tr'); const td = document.createElement('td'); td.colSpan = 2; let title; title = this.createTitleOnly(td); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 _31 ' + this.class.value; this.el.appendChild(title); return this.el; } createTitleOnly(el) { let item; if (this.small.value === 'true') { item = document.createElement('small'); } else { item = document.createElement('span'); } item.innerText = this.innerText.value; item.title = this.title.value; item.className = '_30'; el.appendChild(item); return el; } } _100131_helper_class_textMuted._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_textMuted = _100131_helper_class_textMuted; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_textShadows extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_textShadows._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_textShadows = _100131_helper_class_textShadows; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_title extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML', elType: 'none' }); this.useCheckbox = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'checked', elType: 'none', list: ['true', 'false'] }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'title', type: 'text', group: 'optional', elType: 'none', helperOptions: 'innerText', helper: '_100131_helper_TextHTML' }); } renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTitle(); } prepareChildren(elToRender) { const classChildrenAutoGenerated = '_5'; for (let i = 0; i < this.children.length; i++) { this.renderChild(elToRender, this.children[i], classChildrenAutoGenerated); } } renderTitle() { super.createEL('tr'); this.td = document.createElement('td'); this.td.className = '_1'; this.tdChild = document.createElement('td'); let title; if (this.useCheckbox.value === 'true') { title = this.createTitleWithCheckboxInput(this.td); } else { title = this.createTitleOnly(this.td); } l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 ' + this.class.value; this.el.appendChild(title); this.tdChild.className = '_4'; this.prepareChildren(this.tdChild); this.el.appendChild(this.tdChild); return this.el; } createTitleOnly(element) { const label = document.createElement('label'); label.htmlFor = '_' + this.position; label.innerText = this.innerText.value; label.title = this.title.value; label.className = '_2'; element.appendChild(label); return element; } createTitleWithCheckboxInput(element) { const checkbox = document.createElement('input'); const label = document.createElement('label'); checkbox.type = 'checkbox'; checkbox.id = '_' + this.position; checkbox.className = '_3'; label.htmlFor = '_' + this.position; label.innerText = this.innerText.value; label.title = this.title.value; label.className = '_2'; element.appendChild(checkbox); element.appendChild(label); return element; } renderChild(el, children, cls) { const ex = children; ex.renderHTML(); ex.el.setAttribute('class', cls + ' ' + ex.el.className); el.appendChild(ex.el); } } _100131_helper_class_title._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem', 'a'], examples: [ '{}' ] }; l2_html._100131_helper_class_title = _100131_helper_class_title; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_titleGroup extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML', elType: 'none' }); this.title = new l2_fieldTypes.Input(this, { name: 'title', desc: 'title', type: 'text', group: 'optional', elType: 'none', helperOptions: 'innerText', helper: '_100131_helper_TextHTML' }); } renderHTML() { const el = this.render(); return el; } render() { if (this.el) { this.el.innerHTML = ''; } return this.renderTitle(); } renderTitle() { super.createEL('tr'); const td = document.createElement('td'); td.colSpan = 2; let title; title = this.createTitleOnly(td); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_0 ' + this.class.value; this.el.appendChild(title); return this.el; } createTitleOnly(element) { const h2 = document.createElement('h2'); h2.innerText = this.innerText.value; h2.title = this.title.value; h2.className = '_title'; element.appendChild(h2); return element; } } _100131_helper_class_titleGroup._SearchDetails = { desc: 'Class title helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerItem'], childrenTags: ['ElhelperClassContainerSubItem'], examples: [ '{}' ] }; l2_html._100131_helper_class_titleGroup = _100131_helper_class_titleGroup; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_tooltip extends l2_html.Base { constructor() { super(...arguments); this.tooltipText = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field', elType: 'none' }); this.elementText = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field', elType: 'none' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = '_50 ' + this.class.value; this.el.innerText = this.elementText.value; this.el.appendChild(this.generateTooltip()); return this.el; } generateTooltip() { const span = document.createElement('span'); span.innerText = this.tooltipText.value; span.className = '_51'; return span; } } _100131_helper_class_tooltip._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_helper_class_tooltip = _100131_helper_class_tooltip; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_transform extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_transform._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_transform = _100131_helper_class_transform; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_typography extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_helper_class_typography._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'js', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_helper_class_typography = _100131_helper_class_typography; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_class_width_bootstrap extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_class_width_bootstrap = _100131_helper_class_width_bootstrap; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_createApi extends l2_html.Base { render() { super.createEL("null"); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } l2_html._100131_helper_createApi = _100131_helper_createApi; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_draggable extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_draggable = _100131_helper_draggable; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_editorMarkdown extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_editorMarkdown = _100131_helper_editorMarkdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_icons extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_icons = _100131_helper_icons; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l3_createMD extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l3_createMD = _100131_helper_l3_createMD; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l3_newL3Index extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l3_newL3Index = _100131_helper_l3_newL3Index; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l3_openFile extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l3_openFile = _100131_helper_l3_openFile; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_actionOrgExplorer extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l5_actionOrgExplorer = _100131_helper_l5_actionOrgExplorer; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_actionOrgManageOrganization extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l5_actionOrgManageOrganization = _100131_helper_l5_actionOrgManageOrganization; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_actionOrgManageUsers extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l5_actionOrgManageUsers = _100131_helper_l5_actionOrgManageUsers; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_actionPrjGetStatistics extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l5_actionPrjGetStatistics = _100131_helper_l5_actionPrjGetStatistics; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_actionPrjSeeBackLog extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l5_actionPrjSeeBackLog = _100131_helper_l5_actionPrjSeeBackLog; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_actionPrjSubDomains extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l5_actionPrjSubDomains = _100131_helper_l5_actionPrjSubDomains; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_actionUserCreateOrg extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_l5_actionUserCreateOrg = _100131_helper_l5_actionUserCreateOrg; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_l5_build_web_Build extends l2_html.Base { render() { super.createEL('null'); return this.el; } static start() { return new Promise((resolve, reject) => { this.build().then((res) => { resolve(res); }).catch((err) => { reject(err); }); }); } static build() { return new Promise((resolve, reject) => { const command = 'publishWeb'; const args = { module: "l3", project: mls.actual[5].project, path: 'addon_Drive.json' }; mls.services.execServerTasks(command, args).then((message) => { resolve('Build Success'); }).catch((message) => { reject(message); }); }); } } _100131_helper_l5_build_web_Build.title = 'Build - Copy L4 Files'; _100131_helper_l5_build_web_Build.desc = 'This action build copy all L4 files from your project to directory "dist" in Assets'; _100131_helper_l5_build_web_Build.image = '/l3/_100131_/images/addon_WebGeral/build.png'; l2_html._100131_helper_l5_build_web_Build = _100131_helper_l5_build_web_Build; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_markdown_common extends l2_html.Base { render() { super.createEL("null"); return this.el; } } l2_html._100131_helper_markdown_common = _100131_helper_markdown_common; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_midia extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_midia = _100131_helper_midia; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_midia_aws extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_midia_aws = _100131_helper_midia_aws; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_midia_drive extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_midia_drive = _100131_helper_midia_drive; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_midia_google extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_midia_google = _100131_helper_midia_google; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helper_midia_unsplash extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_helper_midia_unsplash = _100131_helper_midia_unsplash; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_helperr_class_buttons_Layout_Spacing extends l2_html.BaseButton { constructor() { super(...arguments); this.thisProject = 100131; this.apiHelperClass = mls.contributions['apiHelperClass']; } onButtonClick(ev) { this.preparePageForClick(); } onEditThisPage() { const a = document.createElement('a'); const page = '_' + this.thisProject + '_helper_class_spacing'; a.href = '#/l4/' + page; a.click(); } icon() { return { h_index: 500, groupName: 'style', title: 'Spacing', iconText: 'fa-arrows-alt' }; } onToolBarChange() { } onSelectedChange() { } onUpdateUI() { const l4 = window['l4_html']; if (!l4 || !l4.helper_class_spacing || !l4.helper_class_spacing.loadHelperValues) return; l4.helper_class_spacing.loadHelperValues(); } get_details(d) { } preparePageForClick() { this.apiHelperClass.state['lastSubHelper'] = 'Spacing'; this.state.divHelper.style.display = ''; mls.l4.updatePage(this.state.divHelperOpen, this.thisProject, 'helper_class_spacing', true); } } _100131_helperr_class_buttons_Layout_Spacing.tags = ['margin', 'padding']; l2_html._100131_helperr_class_buttons_Layout_Spacing = _100131_helperr_class_buttons_Layout_Spacing; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_hhelper_class_buttons_Editor extends l2_html.BaseButton { constructor() { super(...arguments); this.apiHelperClass = mls.contributions['apiHelperClass']; this.startClass = ''; this.decoration = []; this.oldCssText = ''; } onButtonClick(ev) { this.preparePageForClick(); } icon() { return { h_index: 100, groupName: "all", title: "Editor", iconText: "fa-code" }; } onToolBarChange() { const elSub = this.apiHelperClass.docParent.querySelector('#helperClassUlMySubClass'); const elState = this.apiHelperClass.docParent.querySelector('#helperClassBtnDefaultState'); if (elSub) elSub.style.display = ''; if (elState) elState.parentElement.style.display = ''; } onSelectedChange() { } preparePageForClick() { if (!this.apiHelperClass.state.classConfig) return; this.init(); const elSub = this.apiHelperClass.docParent.querySelector('#helperClassUlMySubClass'); const elState = this.apiHelperClass.docParent.querySelector('#helperClassBtnDefaultState'); if (elSub) elSub.style.display = 'none'; if (elState) elState.parentElement.style.display = 'none'; } init() { let last = this.apiHelperClass.state['lastHelper']; if (!last || last !== 'Editor') { let el = this.apiHelperClass.docParent.querySelector('#divHelperClass #helperClassUlMyClass .active'); if (el) el.click(); this.apiHelperClass.state['lastHelper'] = 'Editor'; } this.state.divHelper.style.display = ''; this.state.divHelper.style.width = '100%'; this.state.divHelper.style.height = 'calc(100vh - 410px)'; this.createEditor(); } createEditor() { if (!this.apiHelperClass.state.classConfig) return; let textCss = this.getCssText(); let _readOnly = false; this.oldCssText = textCss; if (this.apiHelperClass.state.classConfig !== 'this' && this.apiHelperClass.state.classConfigInfo.origin !== 'cssPage') { _readOnly = true; } if (!mls.contributions.editorMonaco) { mls.contributions.editorMonaco = []; } if (mls.contributions.editorMonaco[4]) { mls.contributions.editorMonaco[4] = undefined; } mls.contributions.editorMonaco[4] = mls.common.editor.createMonaco('4', textCss, this.state.divHelper, 'less', { readOnly: _readOnly }); let model = mls.contributions.editorMonaco[4].getModel(); let timeout; model.onDidChangeContent(() => { clearTimeout(timeout); timeout = setTimeout(() => { this.saveCss(); }, 900); }); } getCssText() { let cssText = ''; if (!this.apiHelperClass.state.classConfig) return; if (this.apiHelperClass.state.classConfig === 'this') { cssText = '.this {\n\n' + ' ' + this.apiHelperClass.state.style.cssText.replace(/' '/g, '').split(';').join(';\n ') + '\n}'; this.startClass = '.this {'; } else { if (this.apiHelperClass.state.classConfigInfo.classText !== '') { cssText = this.apiHelperClass.state.classConfigInfo.classText.split(';').join(';\n ').replace(/{/g, '{\n\n ').replace('}', ' '); } else { cssText = this.apiHelperClass.state.classConfig + ' {\n'; } this.apiHelperClass.state.classConfigInfo.children.forEach((item) => { let exp = new RegExp(`${this.apiHelperClass.state.classConfig} `, 'g'); let expState = new RegExp(`${this.apiHelperClass.state.classConfig}:`, 'g'); let expSub = new RegExp(`${this.apiHelperClass.state.classConfig}.`, 'g'); let newText = ' '; if (this.apiHelperClass.state.classConfigInfo.origin !== 'cssPage') { newText = item.classText.split(';').join(';\n ').replace(/{/g, '{\n '); } else { newText = item.classText.replace(exp, '').replace(expState, ':').replace(expSub, '.').split(';').join(';\n ').replace(/{/g, '{\n '); } cssText = cssText + '\n ' + newText + '\n'; }); this.startClass = this.apiHelperClass.state.classConfig + ' {'; cssText = cssText + '\n}'; } return cssText; } saveCss() { let model = mls.contributions.editorMonaco[4].getModel(); let cssStyle = model.getValue(); if (!cssStyle.startsWith(this.startClass)) { console.log('n�o come�a com' + this.startClass); this.decoration = mls.contributions.editorMonaco[4].getModel().deltaDecorations([], [ { range: { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 9999 }, options: { inlineClassName: 'mlsErrorLine' } }, ]); return; } else { this.decoration = mls.contributions.editorMonaco[4].getModel().deltaDecorations(this.decoration, [ { range: { startLineNumber: 1, startColumn: 1, endLineNumber: 1, endColumn: 9999 }, options: {} }, ]); } mls.l2.compileLess(cssStyle).then((output) => { if (output === '') { if (this.apiHelperClass.state.classConfig !== 'this') { let cssPage = this.getCssPageFilter(this.apiHelperClass.state.classConfig); cssPage = cssPage + ' ' + output; cssPage = cssPage.replace(/ :/g, ':').replace(/}\./g, '} .'); mls.l4.toolbar.pageDOC.styleSheets[this.getPosition()].ownerNode.innerText = cssPage; mls.l4.pageNodes.children[0]['cssPage'].value = cssPage; mls.l4.onWidgetsChanges(true, false, false); this.apiHelperClass.fetch(); } else { this.apiHelperClass.state.style.cssText = ''; this.apiHelperClass.updateValues(); } } if (!!output) { if (this.apiHelperClass.state.classConfig !== 'this') { if (this.apiHelperClass.state.classConfigInfo.posOrigin && output.trim().startsWith(this.apiHelperClass.state.classConfig + ' {') && output.trim().split('{').length < 3 && this.oldCssText.trim().split('{').length < 3) { cssStyle = output.replace(this.apiHelperClass.state.classConfig + ' {', '').replace('}', '').replace(/\n/g, ' '); this.apiHelperClass.state.style.cssText = cssStyle; this.apiHelperClass.updateValues(); } else { let cssPage = this.getCssPageFilter(this.apiHelperClass.state.classConfig); if (output.indexOf(this.apiHelperClass.state.classConfig + ' {') < 0) { output = this.apiHelperClass.state.classConfig + ' { } ' + output; } cssPage = cssPage + ' ' + output; cssPage = cssPage.replace(/ :/g, ':').replace(/}\./g, '} .'); mls.l4.toolbar.pageDOC.styleSheets[this.getPosition()].ownerNode.innerText = cssPage; mls.l4.pageNodes.children[0]['cssPage'].value = cssPage; mls.l4.onWidgetsChanges(true, false, false); setTimeout(() => { this.apiHelperClass.fetch(); }, 800); } } else { cssStyle = cssStyle.replace('.this {', '').replace('}', '').replace(/\n/g, ' '); this.apiHelperClass.state.style.cssText = cssStyle; this.apiHelperClass.updateValues(); } } }, (error) => { console.log("erro" + error); }); } getPosition() { let position = 0; if (this.apiHelperClass.state.classConfigInfo.posOrigin) { position = this.apiHelperClass.state.classConfigInfo.posOrigin; } else { let el = mls.l4.toolbar.pageDOC.querySelector('style[origin=cssPage]'); el ? ' ' : this.apiHelperClass.createTagStyleCssPage(); let sheets = mls.l4.toolbar.pageDOC.styleSheets; for (let i = 0; i < sheets.length; i++) { let ori = sheets[i].ownerNode.getAttribute('origin'); if (ori !== 'cssPages') continue; position = i; } } return position; } getCssPageFilter(cls) { let cssPage = ''; let arrayClass = this.apiHelperClass.state.allClass.filter((item) => item.origin === 'cssPage').filter((item) => item.nameClass.indexOf(cls) < 0); arrayClass.forEach((item) => cssPage = cssPage + ' ' + item.classText); return cssPage; } } l2_html._100131_hhelper_class_buttons_Editor = _100131_hhelper_class_buttons_Editor; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_indexPackageAPI extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_indexPackageAPI = _100131_indexPackageAPI; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_inputTags extends l2_html.Base { constructor() { super(...arguments); this.listTags = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Initial List', elType: 'attr' }); this.spaceTrigger = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'Use space triggre', elType: 'attr', list: ['Yes', 'No'] }); this.classSelected = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'styleSelected', type: 'text', elType: 'attr' }); this.useRemove = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'use remove', elType: 'attr', list: ['Yes', 'No'] }); this.delimiter = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'delimiter', elType: 'attr', }); this.classesByWords = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'classesByWords', elType: 'attr', }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); this.id.value = this.id.value ? this.id.value : 'inputTags' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.el.classList.add('clsInputTags'); this.buildWidget(); return this.el; } buildWidget() { const divBodyTags = document.createElement('div'); const divTags = document.createElement('div'); const inputTag = document.createElement('input'); const inputValue = document.createElement('textarea'); if (this.listTags.value) { inputValue.value = this.listTags.value; } divBodyTags.className = 'divBodyTags'; divTags.className = 'divTags'; inputTag.className = 'inputTag'; inputValue.className = 'inputValue'; divBodyTags.appendChild(divTags); divBodyTags.appendChild(inputTag); this.el.appendChild(divBodyTags); this.el.appendChild(inputValue); } } _100131_inputTags._SearchDetails = { desc: 'Content Division element', group: 'layout', section: l2_html.PCategories.layout, tags: ['div', 'elFieldset', 'elFlowContent', 'elPhrasingContent'], childrenTags: ['!elChild', '!restricted'], examples: ['{"name":"div1"}'] }; l2_html._100131_inputTags = _100131_inputTags; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_input_dropdown extends l2_html.Base { constructor() { super(...arguments); this.items = new l2_fieldTypes.TextArea(this, { group: 'principal', desc: 'Value or field' }); this.id = new l2_fieldTypes.Input(this, { group: 'advanced', desc: 'Value of id' }); this.placeholder = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Value of placeholder' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = 'mlsRangeInput'; this.id.value = this.id.value ? this.id.value : 'idInpDrop' + this.position; this.el.id = this.id.value; this.renderBody(); return this.el; } renderBody() { const input = document.createElement('input'); input.type = 'search'; input.placeholder = this.placeholder.value; const dropdown = document.createElement('select'); dropdown.className = 'dropdown'; this.generateOptions(dropdown); this.el.appendChild(input); this.el.appendChild(dropdown); } generateOptions(select) { const lines = this.items.value.trim().split(/\n/); for (let i = 0; i < lines.length; i++) { const child = document.createElement('option'); child.innerText = lines[i]; child.value = lines[i].toUpperCase(); child.className = 'option'; child.style.height = '24px'; select.appendChild(child); } const child = document.createElement('option'); child.innerText = '-'; child.value = '-'; child.className = 'option'; child.style.height = '24px'; child.style.display = 'none'; select.appendChild(child); } } _100131_input_dropdown._SearchDetails = { desc: 'Class input helper', section: l2_html.PCategories.internal, group: 'helperClass', tags: ['ElhelperClassContainerSubItem'], childrenTags: ['!'], examples: [ '{}' ] }; l2_html._100131_input_dropdown = _100131_input_dropdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_l3_editor_markdown extends l2_html.Base { render() { super.createEL("null"); return this.el; } } l2_html._100131_l3_editor_markdown = _100131_l3_editor_markdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_l3_preview_markdown extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_l3_preview_markdown = _100131_l3_preview_markdown; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_l5_action_alert extends l2_html.Base { render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className = 'alert-dinamic col-11 col-md-4 col-lg-3 p-0 ' + this.class.value; this.el.style.display = 'none'; this.createAlertMain(); return this.el; } createAlertMain() { const divMain = document.createElement('div'); divMain.className = 'alert-dinamic-message-main'; const divMessage = document.createElement('div'); divMessage.className = 'alert-dinamic-message-header bg-secondary d-flex align-items-center justify-content-between'; const divSpan = document.createElement('div'); const spanText = document.createElement('span'); spanText.className = 'alert-dinamic-message-header-text text-white'; divSpan.appendChild(spanText); const divMenu = document.createElement('div'); divMenu.className = 'alert-dinamic-message-menu'; const aMinimize = document.createElement('a'); aMinimize.id = 'minimize-icon'; aMinimize.className = 'text-white mr-3 open'; const iMinimize = document.createElement('i'); iMinimize.className = 'fa fa-chevron-down'; aMinimize.appendChild(iMinimize); const aClose = document.createElement('a'); aClose.id = 'close-icon'; aClose.className = 'text-white mr-3'; const iClose = document.createElement('i'); iClose.className = 'fa fa-times'; aClose.appendChild(iClose); const divContent = document.createElement('div'); divContent.className = 'alert-dinamic_div_items scroll-custom'; divContent.id = 'alert-dinamic-message-div-text'; divMenu.appendChild(aMinimize); divMenu.appendChild(aClose); divMessage.appendChild(divSpan); divMessage.appendChild(divMenu); divMain.appendChild(divMessage); divMain.appendChild(divContent); this.el.appendChild(divMain); } } _100131_l5_action_alert._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_l5_action_alert = _100131_l5_action_alert; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_l5_action_loader extends l2_html.Base { constructor() { super(); this.typeLoader = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'Type of charger required', list: ['loader-3'], onChange: () => { this.colorIcon.visible = ['loader-2', 'loader-3'].indexOf(this.typeLoader.value) >= 0; } }); this.display = new l2_fieldTypes.EnumList(this, { desc: 'Loader display', group: 'principal', list: ['none', 'block'], }); this.sizeIcon = new l2_fieldTypes.Input(this, { desc: 'The width and height value will be the same', group: 'principal', }); this.colorIcon = new l2_fieldTypes.Input(this, { desc: 'Loader color', group: 'optional', type: 'color', elType: 'none', }); this.typeTitle = new l2_fieldTypes.EnumList(this, { desc: 'Level of importance of the title', group: 'advanced', list: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], }); this.titleLoader = new l2_fieldTypes.Input(this, { desc: 'Text Displayed in Title', group: 'principal', }); this.topbotton = new l2_fieldTypes.EnumList(this, { desc: 'Text up or Down', group: 'advanced', list: ['top', 'botton'] }); this.colorText = new l2_fieldTypes.Input(this, { desc: 'Text color desired', group: 'optional', type: 'color', elType: 'none', }); this.id.value = this.id.value !== '' ? this.id.value : 'loader' + this.position; } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); l2_fieldTypes.renderAllFields(this.el, this); this.el.className += ' bs_preloader_divCenter '; if (this.display.value !== '') { this.el.setAttribute('style', 'display:' + this.display.value); } const divBackDrop = document.createElement('div'); divBackDrop.setAttribute('id', 'bsLoaderDivBackDrop'); this.el.appendChild(divBackDrop); divBackDrop.className = 'd-flex justify-content-center'; const divLoader = document.createElement('div'); divLoader.style.marginTop = 'auto'; divLoader.style.marginBottom = 'auto'; divBackDrop.appendChild(divLoader); if (this.topbotton.value === 'top' || this.topbotton.value === '') { if (this.titleLoader.value !== '') { this.renderTextTitle(divLoader); } } if (this.typeLoader.value !== '') { this.renderDiv(divLoader); } if (this.topbotton.value === 'botton') { if (this.titleLoader.value !== '') { this.renderTextTitle(divLoader, 'margin-top: 20px'); } } return this.el; } renderTextTitle(divLoader, margin) { const divText = document.createElement('div'); divLoader.appendChild(divText); divText.className = 'text-center l5-loader-title'; const text = document.createElement(this.typeTitle.value); text.innerText = this.titleLoader.value; if (this.colorText.value !== '') { text.setAttribute('style', 'color:' + this.colorText.value); } if (margin !== undefined && this.typeLoader.value === 'loader-1') { divText.style.marginTop = '20px'; } divText.appendChild(text); } renderDiv(divLoader) { const div = document.createElement('div'); const size = this.sizeIcon.value; const numberSize = parseInt(size.replace(/[^0-9]/g, ''), 10); const letter = size.replace(/[0-9]/g, ''); divLoader.appendChild(div); if (this.typeLoader.value === 'loader-1') { div.className = div.className + 'loader ' + this.typeLoader.value; if (this.sizeIcon.value !== '') { div.setAttribute('style', 'height: ' + this.sizeIcon.value + ' !important; width: ' + this.sizeIcon.value + '!important;'); } else { div.setAttribute('style', 'height:100px'); } } else if (this.typeLoader.value === 'loader-2' || this.typeLoader.value === 'loader-3') { div.className = div.className + 'loader ' + this.typeLoader.value; if (this.sizeIcon.value !== '') { div.setAttribute('style', 'width: 100%!important;'); } for (let i = 0; i < 3; i++) { div.appendChild(this.renderSpanLoader()); } } } renderSpanLoader() { const span = document.createElement('span'); span.setAttribute('style', 'background-color:' + this.colorIcon.value + '; width: ' + this.sizeIcon.value + '!important; height: ' + this.sizeIcon.value + '!important;'); return span; } } l2_html._100131_l5_action_loader = _100131_l5_action_loader; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_l5_api_statistic extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_l5_api_statistic = _100131_l5_api_statistic; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_l5_api_variations extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_l5_api_variations = _100131_l5_api_variations; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_scriptHelperLink extends l2_html.Base { render() { super.createEL('null'); return this.el; } } l2_html._100131_scriptHelperLink = _100131_scriptHelperLink; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_select_search extends l2_html.Base { render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('bsselect'); this.rendeSelect(); this.renderSpanSelect(); this.renderSpanSelectOptions(); const fieldMain = [this.class, this.style]; l2_fieldTypes.renderFields(this.el, fieldMain); return this.el; } rendeSelect() { const select = document.createElement('input'); select.className = 'bs-select-input'; select.style.display = 'none'; this.el.appendChild(select); const fieldInput = [this.id]; l2_fieldTypes.renderFields(select, fieldInput); } renderSpanSelect() { const spanSelect = document.createElement('span'); spanSelect.className = 'form-control bs-select-search'; spanSelect.setAttribute('role', 'combobox'); const span1 = document.createElement('span'); span1.className = 'bs-select-search-arrow'; span1.setAttribute('role', 'presentation'); const b83 = document.createElement('b'); span1.onclick = () => { $('.bs-select-search-container').slideToggle(); }; span1.appendChild(b83); const spanIcon = document.createElement('span'); spanIcon.className = 'bs-select-icon'; const spanText = document.createElement('span'); spanText.className = 'bs-select-text'; spanSelect.appendChild(spanIcon); spanSelect.appendChild(spanText); spanSelect.appendChild(span1); this.el.appendChild(spanSelect); } renderSpanSelectOptions() { const spanOptions = document.createElement('span'); spanOptions.className = 'bs-select-search-container d-none'; spanOptions.style.position = 'relative'; const divSearch = document.createElement('div'); divSearch.className = 'bs-select-div-search'; const inputSearch = document.createElement('input'); inputSearch.className = 'form-control'; divSearch.appendChild(inputSearch); spanOptions.appendChild(divSearch); const ulOptions = document.createElement('ul'); const n1 = 'ul' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.searchDetails.Options.elSelector = '[name =' + n1 + ']'; ulOptions.setAttribute('name', n1); spanOptions.appendChild(ulOptions); this.el.appendChild(spanOptions); for (let i = 0; i < this.children.length; i++) { this.renderChild(ulOptions, this.children[i]); } } renderChild(el, children) { if (children.getName() === 'option') { el.appendChild(this.createChildLi(children)); return; } if (children.getName() === 'optgroup') { this.createChildLiGroup(el, children); return; } const ex = children; ex.renderHTML(); el.appendChild(ex.el); } createChildLiGroup(content, child) { const li = document.createElement('li'); li.setAttribute('data_value', ''); li.innerText = child['label'].value; li.className = 'selectSearchNoSelection'; content.appendChild(li); child.children.forEach((item) => { content.appendChild(this.createChildLi(item)); }); } createChildLi(child) { const li = document.createElement('li'); const span = document.createElement('span'); span.className = 'bs-select-option-text'; const n1 = 'ol' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); child['innerText'].Options.elSelector = '[name=' + n1 + ']'; span.setAttribute('name', n1); span.innerText = child['innerText'].value; const val = child['value'].value ? child['value'].value : child['innerText'].value; li.setAttribute('data_value', val); const divContent = document.createElement('div'); divContent.className = 'd-flex'; const divText = document.createElement('div'); divText.className = 'ml-1'; divText.appendChild(span); divContent.append(this.createImage(child['class'].value)); divContent.append(divText); li.appendChild(divContent); return li; } createImage(value) { const div = document.createElement('div'); div.setAttribute('image', value); div.className = value; return div; } renderHTML() { const el = this.render(); return el; } } _100131_select_search._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'Select with search and icon', tags: ['elBsSelectOption', 'select', 'elFlowContent', 'elPhrasingContent', 'elInteractiveContent'], childrenTags: ['elBsOption', 'option', 'optgroup'], group: '', examples: [ `{"id":"l5_actionPrjVariations_selLanguage","children": [ { "_100144_select_search_option": {"innerText":"Home","data_value":"01","typeimage":"class","image":"mt-1 fa fa-home"} }, { "_100144_select_search_option": {"innerText":"Address","data_value":"02","typeimage":"class","image":"mt-1 fa fa-address-book"} }, { "_100144_select_search_option": {"innerText":"Bath","data_value":"03","typeimage":"class","image":"mt-1 fa fa-bath"} }, { "_100144_select_search_option": {"innerText":"Snow","data_value":"04","typeimage":"class","image":"mt-1 fa fa-snowflake-o"} }, { "_100144_select_search_option": {"innerText":"Bicycle","data_value":"05","typeimage":"class","image":"mt-1 fa fa-bicycle"} }]}` ] }; l2_html._100131_select_search = _100131_select_search; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_select_search_option extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { name: 'innerText', desc: 'text', helperOptions: 'innerText', type: 'text', helper: '_100131_helper_TextHTML' }); this.data_value = new l2_fieldTypes.Input(this, { desc: 'Specifies the value to be sent to a server', type: 'text', elType: 'attr' }); this.label = new l2_fieldTypes.Input(this, { group: 'optional', name: 'label', desc: 'Specifies a shorter label for an option', type: 'text', help: 'https://www.w3schools.com/tags/att_option_label.asp' }); this.typeimage = new l2_fieldTypes.EnumList(this, { group: 'principal', desc: 'Specifiestype of option image', list: ['image', 'class'], }); this.image = new l2_fieldTypes.Input(this, { desc: 'Specifies src or class for image', type: 'text', elType: 'attr' }); this.disabled = new l2_fieldTypes.Boolean(this, { group: 'advanced', name: 'disabled', desc: 'true dont allow changes', elType: 'boolean' }); this.selected = new l2_fieldTypes.Boolean(this, { group: 'optional', name: 'selected', desc: 'Specifies that an option should be pre-selected when the page loads', elType: 'boolean' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('li'); const span = document.createElement('span'); span.className = 'bs-select-option-text'; const n1 = 'ol' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; span.innerText = this.innerText.value; const imgSelector = 'image' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.image.Options.elSelector = '[name=' + imgSelector + ']'; span.setAttribute('name', n1); this.el.setAttribute('data_value', this.data_value.value); if (this.typeimage.value === '') { this.el.appendChild(span); } else { const divContent = document.createElement('div'); divContent.className = 'd-flex'; const divText = document.createElement('div'); divText.className = 'ml-1'; divText.appendChild(span); divContent.append(this.createImage(this.typeimage.value, this.image.value, imgSelector)); divContent.append(divText); this.el.appendChild(divContent); } return this.el; } createImage(typeimage, value, selector) { const div = document.createElement('div'); if (typeimage === 'image') { const img = document.createElement('img'); img.setAttribute('name', selector); img.setAttribute('image', value); img.width = 16; img.height = 16; img.src = img.getAttribute('image'); div.className = 'd-flex align-items-center'; div.appendChild(img); } else if (typeimage === 'class') { div.setAttribute('name', selector); div.setAttribute('image', value); div.className = value; } return div; } } _100131_select_search_option._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'Elements go inside a select tag', tags: ['elBsOption'], parentTags: ['elBsSelectOption'], childrenTags: ['!'], group: '', examples: [ '{}' ] }; l2_html._100131_select_search_option = _100131_select_search_option; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_service_multiLanguage extends l2_html.Base { render() { super.createEL('div'); this.el.className = 'd-flex flex-column'; l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } l2_html._100131_service_multiLanguage = _100131_service_multiLanguage; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_service_setModelInL4Page extends l2_html.Base { render() { super.createEL('null'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } l2_html._100131_service_setModelInL4Page = _100131_service_setModelInL4Page; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_shared extends l2_html.Base { constructor() { super(...arguments); this.value = new l2_fieldTypes.Input(this, { group: 'principal', name: 'value', elName: 'defaultValue', desc: 'Value or field' }); } render() { super.createEL('input'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } } _100131_shared._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'widget', desc: 'description here', tags: ['l2'], childrenTags: ['!'], examples: [] }; l2_html._100131_shared = _100131_shared; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_textBoxReadMore extends l2_html.Base { constructor() { super(...arguments); this.height = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Configure box text height', }); this.btnSeeMoreText = new l2_fieldTypes.Input(this, { desc: 'Define a text for button see more', type: 'text', elType: 'none', helperOptions: 'innerHTML', helper: '_100131_helper_TextHTML' }); this.btnSeeLessText = new l2_fieldTypes.Input(this, { desc: 'Define a text for button see less', type: 'text', elType: 'none', helperOptions: 'innerHTML', helper: '_100131_helper_TextHTML' }); } render() { if (this.el) this.el.innerHTML = ''; super.createEL('div'); this.id.value = this.id.value !== '' ? this.id.value : 'textBoxReadMore' + this.position; l2_fieldTypes.renderAllFields(this.el, this); this.el.style.maxHeight = this.height.value; this.el.classList.add('textbox-readmore'); const divGradient = this.createDivGradient(); const divContent = this.createDivContent(); const buttonSeeMore = this.createButtonSeeMore(); const buttonSeeLess = this.createButtonSeeLess(); this.el.appendChild(divGradient); this.el.appendChild(divContent); this.el.appendChild(buttonSeeMore); this.el.appendChild(buttonSeeLess); this.prepareChildren(divContent); return this.el; } renderHTML() { const el = this.render(); return el; } prepareChildren(el) { this.children.forEach((children, index) => { children.renderHTML(); el.appendChild(children.el); }); } createDivGradient() { const divGradient = document.createElement('div'); divGradient.className = 'gradient-box'; return divGradient; } createDivContent() { const divContent = document.createElement('div'); divContent.className = 'content-box'; return divContent; } createButtonSeeMore() { const button = document.createElement('button'); button.type = 'button'; button.className = 'fa fa-chevron-down button-controler button-see-more'; button.innerText = this.btnSeeMoreText.value; return button; } createButtonSeeLess() { const button = document.createElement('button'); button.type = 'button'; button.className = 'fa fa-chevron-up button-controler button-see-less'; button.innerText = this.btnSeeLessText.value; return button; } } _100131_textBoxReadMore._SearchDetails = { section: l2_html.PCategories.Interactivity, group: 'text', desc: 'Text box with see more controller', tags: ['elTextBox'], childrenTags: ['!elChild', '!restricted'], examples: [ '{} ' ] }; l2_html._100131_textBoxReadMore = _100131_textBoxReadMore; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_workspace_feed extends l2_html.Base { render() { super.createEL('div'); this.el.classList.add('workspace-feed'); return this.el; } } _100131_workspace_feed._SearchDetails = { section: l2_html.PCategories.internal, group: 'feed', desc: 'Component feed to use in workspace', tags: ['workspaceFeed'], childrenTags: ['workspaceFeedItem'], examples: [] }; l2_html._100131_workspace_feed = _100131_workspace_feed; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100131_workspace_feed_item extends l2_html.Base { constructor() { super(...arguments); this.src = new l2_fieldTypes.Input(this, { desc: 'avatar image', elName: 'src', type: 'text' }); this.title = new l2_fieldTypes.Input(this, { desc: 'feed title', elName: 'innerHTML', type: 'text' }); this.subtitle = new l2_fieldTypes.Input(this, { desc: 'feed subtitle', elName: 'innerHTML', type: 'text' }); this.time = new l2_fieldTypes.Input(this, { desc: 'feed time', elName: 'innerHTML', type: 'text' }); } render() { super.createEL('div'); this.el.classList.add('workspace-feed-item'); this.el.classList.add('callout'); if (this.class.value) this.el.classList.add(this.class.value); const divImg = this.renderFeedImage(); const divContent = this.renderFeedContent(); this.el.appendChild(divImg); this.el.appendChild(divContent); return this.el; } renderFeedImage() { const divImage = document.createElement('div'); divImage.className = 'feed-image'; const navatar = 'feedAvatar' + this.position; const img = document.createElement('img'); img.setAttribute('name', navatar); img.src = this.src.value; this.src.Options.elSelector = '[name=' + navatar + ']'; divImage.appendChild(img); return divImage; } renderFeedContent() { const divContent = document.createElement('div'); divContent.className = 'feed-content'; const div = document.createElement('div'); const ntitle = 'feedTitle' + this.position; const title = document.createElement('h5'); title.setAttribute('name', ntitle); title.innerHTML = this.title.value; this.title.Options.elSelector = '[name=' + ntitle + ']'; const nsubtitle = 'feedSubtitle' + this.position; const subtitle = document.createElement('p'); subtitle.setAttribute('name', nsubtitle); subtitle.innerHTML = this.subtitle.value; this.subtitle.Options.elSelector = '[name=' + nsubtitle + ']'; const ntime = 'feedTime' + this.position; const time = document.createElement('span'); time.setAttribute('name', ntime); time.innerHTML = this.time.value; this.time.Options.elSelector = '[name=' + ntime + ']'; div.appendChild(title); div.appendChild(subtitle); div.appendChild(time); divContent.appendChild(div); return divContent; } } _100131_workspace_feed_item._SearchDetails = { section: l2_html.PCategories.internal, group: 'feed', desc: 'Workspace feed item', tags: ['workspaceFeedItem'], childrenTags: ['!'], examples: [] }; l2_html._100131_workspace_feed_item = _100131_workspace_feed_item; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_List extends l2_html.Base { constructor() { super(...arguments); this.apiInfo = new l2_fieldTypes.Input(this, { group: 'principal', name: 'apiInfo', desc: 'Type the text', type: 'text' }); } render() { super.createEL('ul'); l2_fieldTypes.renderAllFields(this.el, this); return this.el; } getHelpers() { return [ { name: 'Template', ref: '_100143_helper_Columns_Templates' }, { name: 'Columns', ref: '_100143_helper_Columns_Fields' } ]; } helperColumns_get() { const array = []; const li = this.children.length < 1 ? undefined : this.children[0]; if (!li) return array; li.children.forEach((item, index) => { let fieldName = ''; const info = {}; if (!item['innerText'].value) { fieldName = 'Custom' + item.position.toString(); } else { fieldName = this.filterField(item['innerText'].value); } info.checked = 'true'; info.name = fieldName; info.position = (index + 1).toString(); info.type = 'custom'; if (item['innerText'].value && item['innerText'].value.indexOf('{{') >= 0) { info.type = item['innerText'].value.indexOf('.toString') >= 0 ? 'number' : 'string'; } array.push(info); }); return array; } helperColumns_add(item) { if (!item) return; const val = this.getNameConfig(item); if (!val) return; let li; if (this.children.length < 1) { li = l2_html.BaseHtml.createAndDeserialize({ li: {} }); this.children.splice(0, 0, li); } else { li = this.children[0]; } const newNode = l2_html.BaseHtml.createAndDeserialize({ div: { innerText: val } }); const positionAdd = li.children.length > 0 ? li.children.length + 1 : 0; li.children.splice(positionAdd, 0, newNode); this.updateChanges(); } helperColumns_remove(pos) { if (pos === undefined) return; const li = this.children.length < 1 ? this : this.children[0]; li.children.splice(pos, 1); if (li.children.length <= 0) this.searchDetails.value = ''; this.updateChanges(); } helperColumns_moveItem(currentPos, newPos) { const li = this.children.length < 1 ? undefined : this.children[0]; if (!li) return; const node = li.children[currentPos]; if (!node) return; li.children.splice(currentPos, 1); li.children.splice(newPos, 0, node); this.updateChanges(); } getNameConfig(item) { let res = ''; if (item.type === 'custom') { res = item.name; return res; } let auxConversion = ''; if (item.type === 'number' || item.type === 'integer') auxConversion = '.toString()'; const objInfo = JSON.parse(this.apiInfo.value); const useRepeat = objInfo.tableRepeat ? objInfo.tableRepeat : 'true'; if (!objInfo.varRepeat) objInfo.varRepeat = 'item' + this.position; const varRepeat = objInfo.varRepeat; this.apiInfo.value = JSON.stringify(objInfo); let table = objInfo.table.replace('#/', '').replace(/properties/g, '').replace(/items\//g, '').replace(/\/items/g, '').replace(/\//g, '.').trim(); if (objInfo.table.indexOf('/') < 0) table = ''; const varApiClass = objInfo.varApiClass ? objInfo.varApiClass : 'api1'; if (useRepeat === 'false') { this.searchDetails.value = ''; res = '{{ ' + varApiClass + '.state.' + table + item.name + '}}'; return res; } if (!this.searchDetails.value || (this.searchDetails.value && this.searchDetails.value.indexOf('repeat') < 0)) { this.searchDetails.value = '{{ repeat ' + varRepeat + ' in ' + varApiClass + '.state' + table + ' }}'; } res = '{{ ' + varRepeat + '.' + item.name + auxConversion + ' }}'; return res; } updateChanges() { clearTimeout(this._funcTime); this._funcTime = setTimeout(() => { mls.l4.onWidgetsChanges(true, true, true); }, 200); } filterField(field) { if (field.indexOf('.') > 1) { let array = []; field = field.replace('{{', '').replace('}}', '').trim(); array = field.split('.'); field = array.length > 1 ? array[1] : ''; } return field; } } _100143_List._SearchDetails = { section: l2_html.PCategories.dataManagement, group: 'list', desc: 'Defines an unordered (bulleted) list', tags: ['ul', 'elFlowContent', 'listUl', 'columnsTemplate'], childrenTags: ['li'], examples: [ '{"name":"Ul"}' ] }; l2_html._100143_List = _100143_List; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_TicTacToe_React extends l2_html.Base { render() { super.createEL("null"); return this.el; } } l2_html._100143_TicTacToe_React = _100143_TicTacToe_React; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_TicTacToe_mls_mvP extends l2_html.Base { render() { super.createEL("null"); return this.el; } } l2_html._100143_TicTacToe_mls_mvP = _100143_TicTacToe_mls_mvP; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_TicTacToe_vue extends l2_html.Base { render() { super.createEL("null"); return this.el; } } l2_html._100143_TicTacToe_vue = _100143_TicTacToe_vue; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnActionAnchor extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read and write' }); this.href = new l2_fieldTypes.Input(this, { desc: 'Href action anchor component', elType: 'none', elName: 'href', sectionName: 'Read and write' }); this.onClick = new l2_fieldTypes.Input(this, { desc: 'On click action component', elType: 'none', elName: 'onclick', sectionName: 'Read and write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRW()); this.add(this.renderRO()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { if (!this._elRO) { this._elRO = this._elRW; } return this._elRO; } renderRW() { if (!this._elRW) { this._elRW = document.createElement('span'); this.anchorRW = document.createElement('a'); } const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; this.anchorRW.setAttribute('name', n1); if (this.href.value !== '') { this.anchorRW.setAttribute('href', this.href.value); } this.anchorRW.innerText = this.innerText.value; if (this.onClick.value !== '') { this.anchorRW.setAttribute('onclick', this.onClick.value); } this._elRW.appendChild(this.anchorRW); return this._elRW; } renderTitle() { if (!this._elTitle) { this._elTitle = document.createElement('label'); } const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { if (!this._elHint) { this._elHint = document.createElement('span'); } const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnActionAnchor._SearchDetails = { desc: 'Column action anchor component', group: 'action', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnActionAnchor'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{"innerText":"test","href":"#test","onClick":"alert(\'test\')"}' ] }; l2_html._100143_afb_ColumnActionAnchor = _100143_afb_ColumnActionAnchor; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnActionButton extends l2_html.Base { constructor() { super(...arguments); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read and write' }); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.onClick = new l2_fieldTypes.Input(this, { desc: 'On click action component', elType: 'none', elName: 'onclick', sectionName: 'Read and write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRW()); this.add(this.renderRO()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRW() { if (!this._elRW) { this._elRW = document.createElement('button'); } const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; this._elRW.setAttribute('name', n1); this._elRW.innerText = this.innerText.value; if (this.onClick.value !== '') { this._elRW.setAttribute('onclick', this.onClick.value); } return this._elRW; } renderRO() { if (!this._elRO) { this._elRO = this._elRW; } return this._elRO; } renderHint() { if (!this._elHint) { this._elHint = document.createElement('span'); } const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } renderTitle() { if (!this._elTitle) { this._elTitle = document.createElement('label'); } const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } } _100143_afb_ColumnActionButton._SearchDetails = { desc: 'Column action button component', group: 'action', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnActionButton'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{"innerText":"Example","title":"Example of title","onClick":"alert(\'ok\');","textHint":"Example"}', ] }; l2_html._100143_afb_ColumnActionButton = _100143_afb_ColumnActionButton; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnCheckbox extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.required = new l2_fieldTypes.Boolean(this, { desc: 'Required field', elType: 'none', sectionName: 'Read and Write' }); this.checked = new l2_fieldTypes.Boolean(this, { desc: 'Checked', elType: 'none', sectionName: 'Read and Write' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } this._elRO.setAttribute('name', n1); this._elRO.innerText = this.innerText.value; return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'checkbox'; this.inputRW.defaultValue = this.value.value; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnCheckbox._SearchDetails = { desc: 'Column Checkbox component', group: 'checkbox', section: l2_html.PCategories.internal, tags: ['elAfbColumns'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{"title":"Title","innerText":"Example of read only","value":"value for test","textHint":"Hint of field","nameForInput":"test"}', ] }; l2_html._100143_afb_ColumnCheckbox = _100143_afb_ColumnCheckbox; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnCustom extends l2_html.Base { constructor() { super(); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', sectionName: 'Title', elName: 'innerText' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', sectionName: 'Value', elName: 'value' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', sectionName: 'Hint', elName: 'innerText' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.PrepareChildren(this.el); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } PrepareChildren(el) { for (let i = 0; i < this.children.length; i++) { if (this.children.length !== 4) { this.widgetErrorMessage('This component must have 4 children'); return; } if (i === 0) { if (this.children[0].getName() !== 'span') { this.widgetErrorMessage('Error component not a span 1'); return; } this._elRO = this.children[0].renderHTML(); } else if (i === 1) { if (this.children[1].getName() !== 'span') { this.widgetErrorMessage('Error component not a span 2'); return; } this._elRW = this.children[1].renderHTML(); } else if (i === 2) { if (this.children[2].getName() !== 'label') { this.widgetErrorMessage('Error component not a label 3'); return; } this._elTitle = this.children[2].renderHTML(); } else if (i === 3) { if (this.children[3].getName() !== 'span') { this.widgetErrorMessage('Error component not a span 4'); return; } this._elHint = this.children[3].renderHTML(); } } } widgetErrorMessage(errorMessage) { console.log(errorMessage); mls.l4.addWidgetError(this, errorMessage); } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { return this._elRO; } renderRW() { return this._elRW; } renderTitle() { return this._elTitle; } renderHint() { return this._elHint; } } _100143_afb_ColumnCustom._SearchDetails = { desc: 'Column Custom component', group: 'internal', section: l2_html.PCategories.internal, tags: ['elAfbColumns'], parentTags: ['elAfbColumns'], childrenTags: ['!internal', '!restricted', '!elChild'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnCustom = _100143_afb_ColumnCustom; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnDate extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.minValue = new l2_fieldTypes.Input(this, { desc: 'Min value format: yyyy-mm-dd', elType: 'none', type: 'text', sectionName: 'Read and Write' }); this.maxValue = new l2_fieldTypes.Input(this, { desc: 'Max value format: yyyy-mm-dd', elType: 'none', type: 'text', sectionName: 'Read and Write' }); this.step = new l2_fieldTypes.Input(this, { desc: 'Step for input', elType: 'none', type: 'number', min: 1, sectionName: 'Read and Write' }); this.required = new l2_fieldTypes.Boolean(this, { desc: 'Required field', elType: 'none', sectionName: 'Read and Write' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } this._elRO.setAttribute('name', n1); this._elRO.innerText = this.innerText.value; return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'date'; this.inputRW.defaultValue = this.value.value; this.inputRW.setAttribute('name', n1); if (this.id.value !== '') { this.inputRW.id = this.id.value; } if (this.minValue.value) { this.inputRW.setAttribute('min', this.minValue.value); } if (this.maxValue.value) { this.inputRW.setAttribute('max', this.maxValue.value); } if (this.step.value) { this.inputRW.setAttribute('step', this.step.value); } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnDate._SearchDetails = { desc: 'Column Date component', group: 'date,datetime,time', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbDate'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnDate = _100143_afb_ColumnDate; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnDateTimeLocal extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write', type: 'datetime-local' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.nameForInput = new l2_fieldTypes.Input(this, { desc: 'name for input', elType: 'none', elName: 'name', sectionName: 'Read and Write' }); this.minValue = new l2_fieldTypes.Input(this, { desc: 'Min value format: yyyy-mm-dd', elType: 'none', type: 'datetime-local', sectionName: 'Read and Write' }); this.maxValue = new l2_fieldTypes.Input(this, { desc: 'Max value yyyy-mm-dd', elType: 'none', type: 'datetime-local', sectionName: 'Read and Write' }); this.step = new l2_fieldTypes.Input(this, { desc: 'Step for input', elType: 'none', type: 'number', min: 1, sectionName: 'Read and Write' }); this.required = new l2_fieldTypes.Boolean(this, { desc: 'Required field', elType: 'none', sectionName: 'Read and Write' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } this._elRO.setAttribute('name', n1); this._elRO.innerText = this.innerText.value; return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'datetime-local'; this.inputRW.defaultValue = this.value.value; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } if (this.minValue.value !== '') { this.inputRW.setAttribute('min', this.minValue.value); } if (this.maxValue.value !== '') { this.inputRW.setAttribute('max', this.maxValue.value); } if (this.step.value !== '') { this.inputRW.setAttribute('step', this.step.value); } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnDateTimeLocal._SearchDetails = { desc: 'Column Date time local component', group: 'datetime,date,time', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnDateTime'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnDateTimeLocal = _100143_afb_ColumnDateTimeLocal; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnEmail extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title', type: 'text' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only', type: 'text' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write', type: 'text' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint', type: 'text' }); this.required = new l2_fieldTypes.Boolean(this, { desc: 'Required field', elType: 'none', sectionName: 'Read and Write' }); this.maxLength = new l2_fieldTypes.Input(this, { desc: 'Maxlength for field', elType: 'none', sectionName: 'Read and Write', type: 'number' }); this.minLength = new l2_fieldTypes.Input(this, { desc: 'Minlength for field', elType: 'none', sectionName: 'Read and Write', type: 'number' }); this.pattern = new l2_fieldTypes.Input(this, { desc: 'Pattern regex', elType: 'none', sectionName: 'Read and Write', type: 'text' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } this._elRO.setAttribute('name', n1); this._elRO.innerText = this.innerText.value; return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'email'; this.inputRW.defaultValue = this.value.value; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } if (this.minLength.value !== '') { this.inputRW.minLength = parseInt(this.minLength.value); } if (this.maxLength.value !== '') { this.inputRW.maxLength = parseInt(this.maxLength.value); } if (this.pattern.value !== '') { this.inputRW.setAttribute('pattern', this.pattern.value); } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnEmail._SearchDetails = { desc: 'Column Email component', group: 'string,email', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnEmail'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnEmail = _100143_afb_ColumnEmail; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnFileAudio extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.src = new l2_fieldTypes.Input(this, { desc: 'Src for file', elType: 'none', sectionName: 'Read and Write', elName: 'src' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderAudio(src) { const audio = document.createElement('audio'); audio.controls = true; const source = document.createElement('source'); source.src = src; audio.appendChild(source); return audio; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } this._elRO.setAttribute('name', n1); if (this.src.value !== '') { this._elRO.appendChild(this.renderAudio(this.src.value)); } return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.src.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'file'; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } this.inputRW.setAttribute('accept', 'audio/*'); this.inputRW.setAttribute('multiple', 'false'); this.inputRW.src = this.src.value; this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } } _100143_afb_ColumnFileAudio._SearchDetails = { desc: 'Column file component Video', group: 'file', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnFileVideo'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnFileAudio = _100143_afb_ColumnFileAudio; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnFileDoc extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.linkRO = new l2_fieldTypes.Input(this, { desc: 'Link for download file', elType: 'none', sectionName: 'Read Only', elName: 'href' }); this.src = new l2_fieldTypes.Input(this, { desc: 'Src for file', elType: 'none', sectionName: 'Read and Write', elName: 'src' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('a'); } this._elRO.setAttribute('name', n1); this._elRO.setAttribute('href', this.linkRO.value); this._elRO.setAttribute('download', ''); this._elRO.innerText = this.innerText.value; return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.src.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'file'; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } this.inputRW.setAttribute('accept', '.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,.pdf'); this.inputRW.setAttribute('multiple', 'false'); this.inputRW.setAttribute('src', this.src.value); this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnFileDoc._SearchDetails = { desc: 'Column file component Doc', group: 'file', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnFileDoc'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnFileDoc = _100143_afb_ColumnFileDoc; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnFileImage extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.src = new l2_fieldTypes.Input(this, { desc: 'Src for file', elType: 'none', sectionName: 'Read Only' }); this.height = new l2_fieldTypes.Input(this, { desc: 'Height for image', elType: 'none', sectionName: 'Read Only', type: 'number', min: 0 }); this.width = new l2_fieldTypes.Input(this, { desc: 'Width for image', elType: 'none', sectionName: 'Read Only', type: 'number', min: 0 }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); this.imageRO = document.createElement('img'); } this._elRO.setAttribute('name', n1); if (this.src.value !== '') { this.imageRO.setAttribute('src', this.src.value); if (this.height.value !== '') { this.imageRO.height = parseInt(this.height.value); } if (this.width.value !== '') { this.imageRO.width = parseInt(this.width.value); } this._elRO.appendChild(this.imageRO); } return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.src.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'file'; this.inputRW.defaultValue = this.src.value; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } this.inputRW.setAttribute('accept', 'image/*'); this.inputRW.setAttribute('multiple', 'false'); this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnFileImage._SearchDetails = { desc: 'Column file image component', group: 'file', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnFileImage'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{"title":"teste","innerText":"teste","src":"https://www.w3schools.com/tags/smiley.gif","height":"100","width":"100","textHint":"teste"}', ] }; l2_html._100143_afb_ColumnFileImage = _100143_afb_ColumnFileImage; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnFileVideo extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.src = new l2_fieldTypes.Input(this, { desc: 'Src for file', elType: 'none', sectionName: 'Read Only', elName: 'src' }); this.heigth = new l2_fieldTypes.Input(this, { desc: 'Heigth for video', elType: 'none', sectionName: 'Read Only' }); this.width = new l2_fieldTypes.Input(this, { desc: 'Width for video', elType: 'none', sectionName: 'Read Only' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); this.videoRO = document.createElement('video'); this.sourceRO = document.createElement('source'); } this._elRO.setAttribute('name', n1); this.videoRO.setAttribute('controls', ''); if (this.width.value !== '') { this.videoRO.width = parseInt(this.width.value); } if (this.heigth.value !== '') { this.videoRO.height = parseInt(this.heigth.value); } this.sourceRO.setAttribute('src', this.src.value); this.sourceRO.setAttribute('type', 'video/' + this.src.value.split('.').pop()); this.videoRO.appendChild(this.sourceRO); this._elRO.appendChild(this.videoRO); return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.src.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'file'; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } this.inputRW.setAttribute('accept', 'video/*'); this.inputRW.setAttribute('multiple', 'false'); this.inputRW.src = this.src.value; this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnFileVideo._SearchDetails = { desc: 'Column file component Video', group: 'file', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbColumnFileVideo'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{"title":"example of video","innerText":"example","src":"https://www.w3schools.com/tags/movie.mp4","heigth":"300","width":"300"}', ] }; l2_html._100143_afb_ColumnFileVideo = _100143_afb_ColumnFileVideo; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnNumber extends l2_html.Base { constructor() { super(); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.minimum = new l2_fieldTypes.Input(this, { desc: 'Min value', elType: 'none', type: 'number', sectionName: 'Read and Write' }); this.maximum = new l2_fieldTypes.Input(this, { desc: 'Max value', elType: 'none', type: 'number', sectionName: 'Read and Write' }); this.maxLength = new l2_fieldTypes.Input(this, { desc: 'Max length', elType: 'none', type: 'number', min: 1, sectionName: 'Read and Write' }); this.step = new l2_fieldTypes.Input(this, { desc: 'Step for input', elType: 'none', type: 'number', min: 1 }); this.apiName = new l2_fieldTypes.Input(this, { desc: 'Api name', elType: 'none', }); this.table = new l2_fieldTypes.Input(this, { desc: 'table', elType: 'none', }); this.field = new l2_fieldTypes.Input(this, { desc: 'field', elType: 'none', }); if ((this.apiName.value !== '') && (l2_html[this.apiName.value] !== undefined) && (l2_html[this.apiName.value].jsonSchema !== undefined)) { this._obj = l2_html[this.apiName.value].jsonSchema; this.renderForJsonSchema(this._obj, this.table.value, this.field.value); } } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderForJsonSchema(obj, table, field) { let objectField; if (obj.type === 'object') { objectField = obj.properties; } else if (obj.type === 'array') { if (obj.items.type === 'object') { objectField = obj.items.properties; } } const arrayActualChild = Object.keys(objectField); for (let i = 0; i < arrayActualChild.length; i++) { if (obj.id === table) { if (arrayActualChild[i] === field) { if (objectField[arrayActualChild[i]].minimum !== undefined) { this.minimum.value = objectField[arrayActualChild[i]].minimum; } if (objectField[arrayActualChild[i]].maximum !== undefined) { this.maximum.value = objectField[arrayActualChild[i]].maximum; } if (objectField[arrayActualChild[i]].maxLength !== undefined) { this.maxLength.value = objectField[arrayActualChild[i]].maxLength; } if (objectField[arrayActualChild[i]].step !== undefined) { this.step.value = objectField[arrayActualChild[i]].step; } } } else { this.renderForJsonSchema(objectField[arrayActualChild[i]], table, field); } } } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); this.labelRO = document.createElement('label'); } this.labelRO.innerText = this.innerText.value; this.labelRO.setAttribute('name', n1); this._elRO.appendChild(this.labelRO); return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'number'; this.inputRW.defaultValue = this.value.value; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } if (this.minimum.value !== '') { this.inputRW.min = this.minimum.value; } if (this.maximum.value !== '') { this.inputRW.max = this.maximum.value; } if (this.maxLength.value !== '') { this.inputRW.maxLength = parseInt(this.maxLength.value); } if (this.step.value !== '') { this.inputRW.step = this.step.value; } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnNumber._SearchDetails = { desc: 'Column Number component', group: 'integer,double,number,float', section: l2_html.PCategories.internal, tags: ['elAfbColumns'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnNumber = _100143_afb_ColumnNumber; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnPassword extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.maxLength = new l2_fieldTypes.Input(this, { desc: 'Max length', elType: 'none', type: 'number', min: 1, sectionName: 'Read and Write' }); this.pattern = new l2_fieldTypes.Input(this, { desc: 'Pattern for input', elType: 'none', }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } const label = document.createElement('label'); label.innerText = '******'; label.setAttribute('name', n1); this._elRO.appendChild(label); return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'password'; this.inputRW.defaultValue = this.value.value; this.inputRW.setAttribute('name', n1); if (this.id.value) { this.inputRW.id = this.id.value; } if (this.maxLength.value !== '') { this.inputRW.maxLength = parseInt(this.maxLength.value); } if (this.pattern.value !== '') { this.inputRW.step = this.pattern.value; } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } const small = document.createElement('small'); small.className = 'form-text text-muted'; small.setAttribute('name', n1); small.innerText = this.textHint.value; this._elHint.appendChild(small); return this._elHint; } } _100143_afb_ColumnPassword._SearchDetails = { desc: 'Column Password component', group: 'string,password', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAfbPassword'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnPassword = _100143_afb_ColumnPassword; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnRating extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.valueRO = new l2_fieldTypes.Input(this, { desc: 'Value stars active', elType: 'attr', elName: 'valueRO', sectionName: 'Read Only' }); this.numberStarRO = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Number of stars desired (maximum 15)', elType: 'attr', elName: 'numberStarRO', min: 0, max: 15, sectionName: 'Read Only' }); this.valueRW = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write' }); this.numberStarRW = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Number of stars desired (maximum 15)', elType: 'attr', elName: 'numberStarRW', min: 0, max: 15, sectionName: 'Read and Write' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.valueRO.Options.elSelector = '[name=' + n1 + ']'; this.numberStarRO.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); const span = document.createElement('span'); span.className = 'fa fa-star-o'; this._elRO.append(span); } if (this.numberStarRO.value.indexOf('{{') < 0) { this._elRO.setAttribute('numberstarro', this.numberStarRO.value); } if (this.valueRO.value.indexOf('{{') < 0) { this._elRO.setAttribute('valuero', this.valueRO.value); } this._elRO.setAttribute('name', n1); this._elRO.setAttribute('spanRoRating', ''); return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.searchDetails.Options.elSelector = '[name=i' + n1 + ']'; this.valueRW.Options.elSelector = '[name=i' + n1 + ']'; this.numberStarRW.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); const inputRW = document.createElement('input'); inputRW.setAttribute('name', 'i' + n1); inputRW.defaultValue = this.valueRW.value; inputRW.type = 'hidden'; this._elRW.appendChild(inputRW); } if (this.numberStarRW.value.indexOf('{{') < 0) { this._elRW.setAttribute('numberstarrw', this.numberStarRW.value); } if (this.valueRW.value.indexOf('{{') < 0) { this._elRW.setAttribute('valuerw', this.valueRW.value); } this._elRW.setAttribute('name', n1); this._elRW.setAttribute('spanRwRating', ''); return this._elRW; } renderTitle() { const p = mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); const n1 = 'title ' + p !== undefined ? String(p) : ''; this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const p = mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); const n1 = 'hint' + p !== undefined ? String(p) : ''; this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', 'hint'); this._elHint.innerText = this.textHint.value; return this._elHint; } getHelpers() { return [ { name: 'Column String', ref: '_100174_helper_ColumnString' } ]; } } _100143_afb_ColumnRating._SearchDetails = { desc: 'Column String component', group: 'string', section: l2_html.PCategories.internal, tags: ['elAfbColumns'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnRating = _100143_afb_ColumnRating; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnString extends l2_html.Base { constructor() { super(); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.maxLength = new l2_fieldTypes.Input(this, { desc: 'Max length constraints', elType: 'none', elName: 'maxLength', sectionName: 'Constraints', type: 'number', min: 0 }); this.minLength = new l2_fieldTypes.Input(this, { desc: 'Min length constraints', elType: 'none', elName: 'minLength', sectionName: 'Constraints', type: 'number', min: 0 }); this.pattern = new l2_fieldTypes.Input(this, { desc: 'Pattern constraints', elType: 'none', type: 'text', elName: 'pattern', sectionName: 'Constraints', }); this.apiName = new l2_fieldTypes.Input(this, { desc: 'Api name', elType: 'none', }); this.table = new l2_fieldTypes.Input(this, { desc: 'table', elType: 'none', }); this.field = new l2_fieldTypes.Input(this, { desc: 'field', elType: 'none', }); if ((this.apiName.value !== '') && (l2_html[this.apiName.value] !== undefined) && (l2_html[this.apiName.value].jsonSchema !== undefined)) { this._obj = l2_html[this.apiName.value].jsonSchema; this.renderForJsonSchema(this._obj, this.table.value, this.field.value); } } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderForJsonSchema(obj, table, field) { let objectField; if (obj.type === 'object') { objectField = obj.properties; } else if (obj.type === 'array') { if (obj.items.type === 'object') { objectField = obj.items.properties; } } const arrayActualChild = Object.keys(objectField); for (let i = 0; i < arrayActualChild.length; i++) { if (obj.id === table) { if (arrayActualChild[i] === field) { if (objectField[arrayActualChild[i]].pattern !== undefined) { this.pattern.value = objectField[arrayActualChild[i]].pattern; } if (objectField[arrayActualChild[i]].maxLength !== undefined) { this.maxLength.value = objectField[arrayActualChild[i]].maxLength; } if (objectField[arrayActualChild[i]].minLength !== undefined) { this.minLength.value = objectField[arrayActualChild[i]].minLength; } } } else { this.renderForJsonSchema(objectField[arrayActualChild[i]], table, field); } } } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } this._elRO.setAttribute('name', n1); this._elRO.innerText = this.innerText.value; return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.setAttribute('name', n1); this.inputRW.type = 'text'; this.inputRW.defaultValue = this.value.value; if (this.id.value) { this.inputRW.id = this.id.value; } if (this.maxLength.value !== '') { this.inputRW.maxLength = parseInt(this.maxLength.value); } if (this.minLength.value !== '') { this.inputRW.minLength = parseInt(this.minLength.value); } if (this.pattern.value !== '') { this.inputRW.pattern = this.pattern.value; } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', 'hint'); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnString._SearchDetails = { desc: 'Column String component', group: 'string', section: l2_html.PCategories.internal, tags: ['elAfbColumns'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnString = _100143_afb_ColumnString; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_ColumnTime extends l2_html.Base { constructor() { super(...arguments); this.title = new l2_fieldTypes.Input(this, { desc: 'Title', elType: 'none', elName: 'innerText', sectionName: 'Title' }); this.innerText = new l2_fieldTypes.Input(this, { desc: 'innerText', elType: 'none', elName: 'innerText', sectionName: 'Read Only' }); this.value = new l2_fieldTypes.Input(this, { desc: 'Value for field', elType: 'none', elName: 'value', sectionName: 'Read and Write' }); this.textHint = new l2_fieldTypes.Input(this, { desc: 'Text for hint', elType: 'none', elName: 'innerText', sectionName: 'Hint' }); this.minValue = new l2_fieldTypes.Input(this, { desc: 'Min value format: hh-mm', elType: 'none', type: 'text', sectionName: 'Read and Write' }); this.maxValue = new l2_fieldTypes.Input(this, { desc: 'Max value: hh-mm', elType: 'none', type: 'text', sectionName: 'Read and Write' }); this.required = new l2_fieldTypes.Boolean(this, { desc: 'Required field', elType: 'none', sectionName: 'Read and Write' }); } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); this.add(this.renderRO()); this.add(this.renderRW()); this.add(this.renderTitle()); this.add(this.renderHint()); return this.el; } add(el) { el ? this.el.appendChild(el) : null; } renderRO() { const n1 = 'ro' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.innerText.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRO) { this._elRO = document.createElement('span'); } this._elRO.setAttribute('name', n1); this._elRO.innerText = this.innerText.value; return this._elRO; } renderRW() { const n1 = 'rw' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.value.Options.elSelector = '[name=' + n1 + ']'; this.searchDetails.Options.elSelector = '[name=' + n1 + ']'; if (!this._elRW) { this._elRW = document.createElement('span'); this.inputRW = document.createElement('input'); } this.inputRW.type = 'time'; this.inputRW.defaultValue = this.value.value; this.inputRW.setAttribute('name', n1); if (this.id.value !== '') { this.inputRW.id = this.id.value; } if (this.minValue.value !== '') { this.inputRW.setAttribute('min', this.minValue.value); } if (this.maxValue.value !== '') { this.inputRW.setAttribute('max', this.maxValue.value); } this._elRW.appendChild(this.inputRW); return this._elRW; } renderTitle() { const n1 = 'title' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.title.Options.elSelector = '[name=' + n1 + ']'; if (!this._elTitle) { this._elTitle = document.createElement('label'); } this._elTitle.setAttribute('name', n1); this._elTitle.innerText = this.title.value; return this._elTitle; } renderHint() { const n1 = 'hint' + mls.l4.findPathByPosition(mls.l4.pageNodes, this.position).pop(); this.textHint.Options.elSelector = '[name=' + n1 + ']'; if (!this._elHint) { this._elHint = document.createElement('span'); } this._elHint.className = 'form-text text-muted'; this._elHint.setAttribute('name', n1); this._elHint.innerText = this.textHint.value; return this._elHint; } } _100143_afb_ColumnTime._SearchDetails = { desc: 'Column Time component', group: '[date,time,datetime]', section: l2_html.PCategories.internal, tags: ['elAfbColumns', 'elAdbColumnTime'], parentTags: ['elAfbColumns'], childrenTags: ['!'], examples: [ '{ }', ] }; l2_html._100143_afb_ColumnTime = _100143_afb_ColumnTime; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_Columns extends l2_html.Base { constructor() { super(...arguments); this.columnName = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Api name', elType: 'none' }); this.apiName = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Api name', elType: 'none' }); this.useRepeat = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Repeat', elType: 'none' }); this.useMvp = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Mvp', elType: 'none' }); this.table = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Table', elType: 'none' }); } render() { super.createEL('span'); return this.el; } loadFields() { this._elRW = []; this._elRO = []; this._elTitle = []; this._elHint = []; if (this.children.length > 0) { this.createArray(this.children, 0); } } createArray(array, nivel) { if (nivel < array.length) { this._elRO.push(array[nivel]['renderRO']()); this._elRW.push(array[nivel]['renderRW']()); this._elHint.push(array[nivel]['renderHint']()); this._elTitle.push(array[nivel]['renderTitle']()); nivel += 1; this.createArray(array, nivel); } } renderRO() { return this._elRO; } renderRW() { return this._elRW; } renderTitle() { return this._elTitle; } renderHint() { return this._elHint; } getHelpers() { document.querySelector('#L4ModeTitle1 div[data-service = "service_Form_Builder"]').innerHTML = ''; return [ { name: 'Create Columns', ref: '_100143_helper_afb_Columns', args: '' } ]; } } _100143_afb_Columns._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'description here', tags: ['elAfbColumns', 'ElAfbComponents'], childrenTags: ['elAfbColumns'], examples: ['{}'] }; l2_html._100143_afb_Columns = _100143_afb_Columns; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_Master extends l2_html.Base { constructor() { super(...arguments); this.apiName = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'Api name', elType: 'none' }); this.templateName = new l2_fieldTypes.Input(this, { group: 'principal', desc: 'TemplateName name', elType: 'none' }); this.useMVP = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'Use mvp framework', elType: 'none' }); this.useRepeat = new l2_fieldTypes.Boolean(this, { group: 'principal', desc: 'Use repeat', elType: 'none' }); this.jsonMaster = { useMVP: true, useRepeat: true, columns: [] }; } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('div'); this.prepareChildren(this.el); l2_fieldTypes.renderAllFields(this.el, this); this.jsonMaster['useMVP'] = this.useMVP.value; this.jsonMaster['useRepeat'] = this.useRepeat.value; return this.el; } renderHTML() { const el = this.render(); return el; } prepareChildren(el) { for (let i = 0; i < this.children.length; i++) { this.renderChild(el, this.children[i]); if (this.children[i].children.length > 0) { this.checkChildrenReentrance(this.children[i].children); } } } checkChildrenReentrance(children) { this.jsonMaster['columns'] = []; for (let i = 0; i < children.length; i++) { const name = children[i].getName(); if (name === '_100174_afb_Column') { this.jsonMaster['columns'].push({ name: children[i]['mField'].value, type: children[i]['mType'].value }); } if (children[i].children.length > 0) { this.checkChildrenReentrance(children[i].children); } } } renderChild(el, children) { const ex = children; ex.renderHTML(); el.appendChild(ex.el); } } _100143_afb_Master._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'description here', tags: ['elAfbMaster'], childrenTags: ['ElAfbComponents'], examples: ['{}' ] }; l2_html._100143_afb_Master = _100143_afb_Master; })(l2_html || (l2_html = {})); var l2_html; (function (l2_html) { class _100143_afb_TemplateGridForm extends l2_html.Base { constructor() { super(...arguments); this.apiName = new l2_fieldTypes.Input(this, { name: 'apiName', desc: 'Type the text', type: 'text' }); this._jsoninfo = []; this.preprocessHTML = () => { this.el.innerHTML = ''; this._jsoninfo = []; if (this.children.length > 0) { this.getChildren(this.children, 0); this.el.appendChild(this.renderGrid()); this.el.appendChild(this.renderForm()); } }; } render() { if (this.el) { this.el.innerHTML = ''; } super.createEL('span'); return this.el; } getChildren(array, nivel) { if (nivel < array.length) { const mlsid = $(array[nivel])[0]['el'].dataset['mlsid']; array[nivel]['loadFields'](); if (nivel === 0) { this._jsoninfo.push({ mlsid, title: array[nivel]['renderTitle'](), html: array[nivel]['renderRO']() }); } else if (nivel === 1) { this._jsoninfo.push({ mlsid, title: array[nivel]['renderTitle'](), html: array[nivel]['renderRW']() }); } nivel += 1; this.getChildren(array, nivel); } } renderGrid() { const table = document.createElement('table'); const thead = document.createElement('thead'); const tbody = document.createElement('tbody'); if (this._jsoninfo[0]['mlsid']) { tbody.dataset.mlsid = this._jsoninfo[0]['mlsid']; } table.className = 'table table-bordered table-striped table-sm text-nowrap'; const trH = document.createElement('tr'); let array = this._jsoninfo[0]['title']; for (let i = 0; i < array.length; i++) { const td = document.createElement('td'); td.appendChild(array[i].cloneNode(true)); trH.appendChild(td); } const trB = document.createElement('tr'); array = this._jsoninfo[0]['html']; for (let i = 0; i < array.length; i++) { const td = document.createElement('td'); td.appendChild(array[i].cloneNode(true)); trB.appendChild(td); } thead.appendChild(trH); tbody.appendChild(trB); table.appendChild(thead); table.appendChild(tbody); return table; } renderForm() { const form = document.createElement('form'); const arrayTitle = this._jsoninfo[1]['title']; const arrayInput = this._jsoninfo[1]['html']; for (let i = 0; i < arrayTitle.length; i++) { const div = document.createElement('div'); div.appendChild(arrayTitle[i]); const input = arrayInput[i].cloneNode(true); const el = input.querySelector('input'); if (el) el.className = 'form-control mb-2'; div.appendChild(input); form.appendChild(div); } return form; } static openHelperApi(el) { el; mls.l4.helpers.loadHelper('_100143_helper_FormBuilderApis', 'API', '', '{"helper":"_100143_helper_Template", "template": "_100143_afb_TemplateGridForm", "columns":[{"name":"Grid", "useRepeat" : "true"},{"name":"Form", "useRepeat" : "false"}]}'); } getHelpers() { return [ { name: 'Template', ref: '_100143_helper_Template', args: '[{"name":"Grid", "useRepeat" : "true"},{"name":"Form", "useRepeat" : "false"}]' }, ]; } } _100143_afb_TemplateGridForm._SearchDetails = { section: l2_html.PCategories.dataManagement, desc: 'description here', tags: ['elAfbColumns', 'ElAfbComponents'], childrenTags: ['ElAfbComponents'], examples: ['{}' ], iconUrl: 'https://z9t4u9f6.stackpathcdn.com/wp-content/uploads/2015/08/forms.jpg' }; l2_html._100143_afb_Templ