Skip to content
Snippets Groups Projects
Verified Commit c59f78c7 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: CustomElement now supprt format marker for template mapping #249

parent 76172ece
No related branches found
No related tags found
No related merge requests found
Showing
with 3227 additions and 3204 deletions
......@@ -11,7 +11,10 @@
*/
import { instanceSymbol } from "../../constants.mjs";
import {addAttributeToken, removeAttributeToken} from "../../dom/attributes.mjs";
import {
addAttributeToken,
removeAttributeToken,
} from "../../dom/attributes.mjs";
import {
ATTRIBUTE_ERRORMESSAGE,
ATTRIBUTE_ROLE,
......@@ -36,7 +39,6 @@ export {Copy};
*/
const timerCallbackSymbol = Symbol("timerCallback");
/**
* @private
* @type {symbol}
......@@ -100,7 +102,6 @@ class Copy extends CustomElement {
return this;
}
/**
* This method is called when the element is connected to the dom.
*
......@@ -120,7 +121,6 @@ class Copy extends CustomElement {
attachResizeObserver.call(this);
}
/**
* This method is called when the element is disconnected from the dom.
*
......@@ -219,8 +219,6 @@ class Copy extends CustomElement {
}
return this;
}
}
/**
......@@ -367,7 +365,6 @@ function initEventHandler() {
});
this[copyButtonElementSymbol].addEventListener(type, function (event) {
fireCustomEvent(self, "monster-copy-clicked", {
element: self,
});
......@@ -383,22 +380,30 @@ function initEventHandler() {
}
}
navigator.clipboard.writeText(text).then(function () {
self[copyButtonElementSymbol].querySelector("use").setAttribute("href", "#copy-success");
navigator.clipboard
.writeText(text)
.then(function () {
self[copyButtonElementSymbol]
.querySelector("use")
.setAttribute("href", "#copy-success");
setTimeout(() => {
self[copyButtonElementSymbol].querySelector("use").setAttribute("href", "#copy");
self[copyButtonElementSymbol]
.querySelector("use")
.setAttribute("href", "#copy");
}, 2000);
fireCustomEvent(self, "monster-copy-success", {
element: self,
});
}).catch(function (e) {
self[copyButtonElementSymbol].querySelector("use").setAttribute("href", "#copy-error");
})
.catch(function (e) {
self[copyButtonElementSymbol]
.querySelector("use")
.setAttribute("href", "#copy-error");
setTimeout(() => {
self[copyButtonElementSymbol].querySelector("use").setAttribute("href", "#copy");
self[copyButtonElementSymbol]
.querySelector("use")
.setAttribute("href", "#copy");
}, 2000);
fireCustomEvent(self, "monster-copy-error", {
......@@ -406,13 +411,12 @@ function initEventHandler() {
});
addAttributeToken(self, ATTRIBUTE_ERRORMESSAGE, "" + e);
})
});
});
return this;
}
/**
* @private
* @return {void}
......@@ -429,7 +433,6 @@ function initControlReferences() {
this[popperElementSymbol] = this.shadowRoot.querySelector(
`[${ATTRIBUTE_ROLE}="popper"]`,
);
}
/**
......@@ -471,5 +474,4 @@ function getTemplate() {
</div>`;
}
registerCustomElement(Copy);
......@@ -13,7 +13,7 @@
import { addAttributeToken } from "../../../dom/attributes.mjs";
import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";
export {CopyStyleSheet}
export { CopyStyleSheet };
/**
* @private
......@@ -22,10 +22,17 @@ export {CopyStyleSheet}
const CopyStyleSheet = new CSSStyleSheet();
try {
CopyStyleSheet.insertRule(`
CopyStyleSheet.insertRule(
`
@layer copy {
[data-monster-role=control]{box-sizing:border-box;outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:host{box-sizing:border-box;display:block}:after,:before,:root{--monster-font-family:-apple-system,BlinkMacSystemFont,\"Quicksand\",\"Segoe UI\",\"Roboto\",\"Oxygen\",\"Ubuntu\",\"Cantarell\",\"Fira Sans\",\"Droid Sans\",\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";--monster-color-primary-1:var(--monster-color-gray-6);--monster-color-primary-2:var(--monster-color-gray-6);--monster-color-primary-3:var(--monster-color-cinnamon-1);--monster-color-primary-4:var(--monster-color-cinnamon-1);--monster-bg-color-primary-1:var(--monster-color-gray-1);--monster-bg-color-primary-2:var(--monster-color-gray-2);--monster-bg-color-primary-3:var(--monster-color-gray-6);--monster-bg-color-primary-4:var(--monster-color-gray-4)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-1:var(--monster-color-gray-1);--monster-color-primary-2:var(--monster-color-gray-1);--monster-color-primary-3:var(--monster-color-gray-6);--monster-color-primary-4:var(--monster-color-gray-6);--monster-bg-color-primary-1:var(--monster-color-gray-6);--monster-bg-color-primary-2:var(--monster-color-gray-3);--monster-bg-color-primary-3:var(--monster-color-gray-2);--monster-bg-color-primary-4:var(--monster-color-gray-1)}}:after,:before,:root{--monster-color-secondary-1:var(--monster-color-red-4);--monster-color-secondary-2:var(--monster-color-red-4);--monster-color-secondary-3:var(--monster-color-red-1);--monster-color-secondary-4:var(--monster-color-red-1);--monster-bg-color-secondary-1:var(--monster-color-gray-1);--monster-bg-color-secondary-2:var(--monster-color-red-2);--monster-bg-color-secondary-3:var(--monster-color-red-3);--monster-bg-color-secondary-4:var(--monster-color-red-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-secondary-1:var(--monster-color-red-1);--monster-color-secondary-2:var(--monster-color-red-1);--monster-color-secondary-3:var(--monster-color-red-6);--monster-color-secondary-4:var(--monster-color-red-4);--monster-bg-color-secondary-1:var(--monster-color-gray-6);--monster-bg-color-secondary-2:var(--monster-color-red-3);--monster-bg-color-secondary-3:var(--monster-color-red-2);--monster-bg-color-secondary-4:var(--monster-color-red-1)}}:after,:before,:root{--monster-color-tertiary-1:var(--monster-color-magenta-4);--monster-color-tertiary-2:var(--monster-color-magenta-4);--monster-color-tertiary-3:var(--monster-color-magenta-6);--monster-color-tertiary-4:var(--monster-color-magenta-1);--monster-bg-color-tertiary-1:var(--monster-color-gray-1);--monster-bg-color-tertiary-2:var(--monster-color-magenta-1);--monster-bg-color-tertiary-3:var(--monster-color-magenta-2);--monster-bg-color-tertiary-4:var(--monster-color-magenta-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-tertiary-1:var(--monster-color-magenta-1);--monster-color-tertiary-2:var(--monster-color-magenta-6);--monster-color-tertiary-3:var(--monster-color-magenta-4);--monster-color-tertiary-4:var(--monster-color-magenta-4);--monster-bg-color-tertiary-1:var(--monster-color-gray-6);--monster-bg-color-tertiary-2:var(--monster-color-magenta-2);--monster-bg-color-tertiary-3:var(--monster-color-magenta-1);--monster-bg-color-tertiary-4:var(--monster-color-magenta-1)}}:after,:before,:root{--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-4);--monster-color-destructive-3:var(--monster-color-red-6);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-4);--monster-bg-color-destructive-2:var(--monster-color-gray-1);--monster-bg-color-destructive-3:var(--monster-color-red-2);--monster-bg-color-destructive-4:var(--monster-color-red-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-3);--monster-color-destructive-3:var(--monster-color-red-4);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-5);--monster-bg-color-destructive-2:var(--monster-color-gray-6);--monster-bg-color-destructive-3:var(--monster-color-red-1);--monster-bg-color-destructive-4:var(--monster-color-red-4)}}:after,:before,:root{--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-4);--monster-color-success-3:var(--monster-color-green-6);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-3);--monster-bg-color-success-2:var(--monster-color-gray-1);--monster-bg-color-success-3:var(--monster-color-green-2);--monster-bg-color-success-4:var(--monster-color-green-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-2);--monster-color-success-3:var(--monster-color-green-4);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-5);--monster-bg-color-success-2:var(--monster-color-gray-6);--monster-bg-color-success-3:var(--monster-color-green-1);--monster-bg-color-success-4:var(--monster-color-green-3)}}:after,:before,:root{--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-4);--monster-color-warning-3:var(--monster-color-orange-6);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-3);--monster-bg-color-warning-2:var(--monster-color-gray-1);--monster-bg-color-warning-3:var(--monster-color-orange-2);--monster-bg-color-warning-4:var(--monster-color-orange-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-3);--monster-color-warning-3:var(--monster-color-orange-4);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-5);--monster-bg-color-warning-2:var(--monster-color-gray-6);--monster-bg-color-warning-3:var(--monster-color-orange-1);--monster-bg-color-warning-4:var(--monster-color-orange-3)}}:after,:before,:root{--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-4);--monster-color-error-3:var(--monster-color-red-6);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-4);--monster-bg-color-error-2:var(--monster-color-gray-1);--monster-bg-color-error-3:var(--monster-color-red-2);--monster-bg-color-error-4:var(--monster-color-red-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-3);--monster-color-error-3:var(--monster-color-red-4);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-5);--monster-bg-color-error-2:var(--monster-color-gray-6);--monster-bg-color-error-3:var(--monster-color-red-1);--monster-bg-color-error-4:var(--monster-color-red-4)}}:after,:before,:root{--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6)}}:after,:before,:root{--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-4);--monster-color-primary-disabled-4:var(--monster-color-gray-4);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-1);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-3);--monster-color-primary-disabled-4:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-6);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-1)}}:after,:before,:root{--monster-color-gradient-1:#833ab4;--monster-color-gradient-2:#fd1d1d;--monster-color-gradient-3:#fcb045;--monster-box-shadow-1:none;--monster-box-shadow-2:-1px 1px 10px 1px hsla(0,0%,76%,.61);--monster-text-shadow:none;--monster-theme-control-bg-color:var(--monster-color-seashell-1);--monster-theme-control-color:var(--monster-color-seashell-6);--monster-theme-control-hover-color:var(--monster-color-seashell-6);--monster-theme-control-hover-bg-color:var(--monster-color-seashell-2);--monster-theme-control-border-width:2px;--monster-theme-control-border-style:solid;--monster-theme-control-border-radius:0;--monster-theme-control-border-color:var(--monster-color-primary-1)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-theme-control-bg-color:var(--monster-color-gray-5);--monster-theme-control-color:var(--monster-color-gray-1);--monster-theme-control-border-color:var(--monster-color-gray-3);--monster-theme-control-hover-color:var(--monster-color-gray-1);--monster-theme-control-hover-bg-color:var(--monster-color-gray-6)}}:after,:before,:root{--monster-theme-on-color:var(--monster-color-green-1);--monster-theme-on-bg-color:var(--monster-color-green-5);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-4)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-theme-on-color:var(--monster-color-gray-6);--monster-theme-on-bg-color:var(--monster-color-gray-1);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-5)}}:after,:before,:root{--monster-border-style:solid;--monster-border-width:3px;--monster-border-radius:0;--monster-popper-witharrrow-distance:-4px;--monster-z-index-default:0;--monster-z-index-outline:10;--monster-z-index-dropdown:200;--monster-z-index-dropdown-overlay:210;--monster-z-index-sticky:300;--monster-z-index-sticky-overlay:310;--monster-z-index-fixed:400;--monster-z-index-fixed-overlay:410;--monster-z-index-modal-backdrop:500;--monster-z-index-modal-backdrop-overlay:510;--monster-z-index-offcanvas:600;--monster-z-index-offcanvas-overlay:610;--monster-z-index-modal:700;--monster-z-index-modal-overlay:710;--monster-z-index-popover:800;--monster-z-index-popover-overlay:810;--monster-z-index-tooltip:800;--monster-z-index-tooltip-overlay:910;--monster-space-0:0;--monster-space-1:2px;--monster-space-2:4px;--monster-space-3:6px;--monster-space-4:10px;--monster-space-5:16px;--monster-space-6:26px;--monster-space-7:42px;--monster-breakpoint-0:480px;--monster-breakpoint-4:480px;--monster-breakpoint-7:768px;--monster-breakpoint-9:992px;--monster-breakpoint-12:1200px;--monster-dragger-width:2px;--monster-dragger-handle-width:4px;--monster-dragger-handle-height:50px}div[data-monster-role=popper]{align-content:center;background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;justify-content:space-between;left:0;padding:1.1em;position:absolute;top:0;width:-moz-max-content;width:max-content;z-index:var(--monster-z-index-modal)}div[data-monster-role=popper] div[data-monster-role=arrow]{background:var(--monster-bg-color-primary-1);height:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);pointer-events:none;position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);z-index:-1}:host{display:inline-block}[data-monster-role=control]{display:inherit}[data-monster-role=icon]{fill:var(--monster-color-primary-1)}[data-monster-role=icon-map]{display:none}button{background:inherit;border:none}button:hover{cursor:copy}button:active{transform:scale(.95)}
}`, 0);
}`,
0,
);
} catch (e) {
addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
addAttributeToken(
document.getRootNode().querySelector("html"),
ATTRIBUTE_ERRORMESSAGE,
e + "",
);
}
......@@ -270,7 +270,6 @@ function updateColumns() {
}
this[fieldSetElementSymbol].classList.add("multiple-columns");
}
/**
......
......@@ -285,7 +285,6 @@ const FILTER_POSITION_INLINE = "inline";
* @fires monster-changed
*/
class Select extends CustomControl {
/**
*
*/
......@@ -341,8 +340,7 @@ class Select extends CustomControl {
const result = convertValueToSelection.call(this, value);
setSelection
.call(this, result.selection)
.then(() => {
})
.then(() => {})
.catch((e) => {
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
});
......@@ -522,7 +520,6 @@ class Select extends CustomControl {
}
if (self.getOption("url") !== null) {
if (lazyLoadFlag) {
lookupSelection.call(self);
} else {
......@@ -542,8 +539,7 @@ class Select extends CustomControl {
lastValue = n;
setSelection
.call(self, n)
.then(() => {
})
.then(() => {})
.catch((e) => {
addAttributeToken(self, ATTRIBUTE_ERRORMESSAGE, `${e}`);
});
......@@ -658,7 +654,6 @@ class Select extends CustomControl {
map instanceof Set ||
map instanceof Map
) {
try {
this.importOptions(map);
} catch (e) {
......@@ -831,7 +826,6 @@ function lookupSelection() {
const self = this;
setTimeout(() => {
const selection = self.getOption("selection");
if (selection.length === 0) {
return;
......@@ -852,7 +846,11 @@ function lookupSelection() {
}
if (this.getOption("lookup.grouping") === true) {
filterFromRemoteByValue.call(self, url, selection.map((s) => s?.["value"]));
filterFromRemoteByValue.call(
self,
url,
selection.map((s) => s?.["value"]),
);
return;
}
......@@ -861,9 +859,7 @@ function lookupSelection() {
filterFromRemoteByValue.call(self, url, s?.["value"]);
}
}
}, 100);
}
/**
......@@ -1165,8 +1161,7 @@ function getDefaultTranslation() {
try {
const doc = getDocumentTranslations();
translation.locale = doc.locale;
} catch (e) {
}
} catch (e) {}
return translation;
}
......@@ -1541,23 +1536,21 @@ function filterFromRemote() {
return;
}
return filterFromRemoteByValue.call(this, optionUrl, this[inlineFilterElementSymbol].value);
return filterFromRemoteByValue.call(
this,
optionUrl,
this[inlineFilterElementSymbol].value,
);
}
/**
* @private
*/
function filterFromRemoteByValue(optionUrl, value) {
return new Processing(() => {
const filterValue = encodeURI(
value
);
const filterValue = encodeURI(value);
let url = optionUrl;
if (filterValue.length > 0) {
const formatter = new Formatter({ filter: filterValue });
const openMarker = this.getOption("filter.marker.open");
let closeMarker = this.getOption("filter.marker.close");
......@@ -1773,8 +1766,7 @@ function gatherState() {
setSelection
.call(this, selection)
.then(() => {
})
.then(() => {})
.catch((e) => {
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, `${e}`);
});
......@@ -1803,8 +1795,7 @@ function clearSelection() {
setSelection
.call(this, [])
.then(() => {
})
.then(() => {})
.catch((e) => {
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, `${e}`);
});
......@@ -2168,10 +2159,9 @@ function show() {
checkOptionState.call(this);
requestAnimationFrame(() => {
show.call(this);
})
});
})
.catch((e) => {
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
setStatusOrRemoveBadges.call(this, "error");
});
......@@ -2414,7 +2404,6 @@ function initEventHandler() {
* @return {Select}
*/
function setStatusOrRemoveBadges(suggestion) {
requestAnimationFrame(() => {
const selection = this.getOption("selection");
......@@ -2478,8 +2467,7 @@ function setStatusOrRemoveBadges(suggestion) {
}
return;
}
})
});
}
/**
......
This diff is collapsed.
......@@ -124,7 +124,6 @@ class WidthToggle extends CustomElement {
* @throws {Error} - If the mode is not supported.
*/
/**
* @param {string} mode
* @returns {WidthToggle}
......
......@@ -72,7 +72,6 @@ const emptyStateElementSymbol = Symbol("emptyStateElement");
* @summary Log is a control to show a log message.
*/
/**
* A Log component
*
......
......@@ -13,7 +13,7 @@
import { addAttributeToken } from "../../dom/attributes.mjs";
import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
export {FormStyleSheet}
export { FormStyleSheet };
/**
* @private
......@@ -22,10 +22,17 @@ export {FormStyleSheet}
const FormStyleSheet = new CSSStyleSheet();
try {
FormStyleSheet.insertRule(`
FormStyleSheet.insertRule(
`
@layer form {
input,meter,progress,select,textarea{accent-color:var(--monster-color-secondary-2);background-color:var(--monster-bg-color-primary-1);border-color:var(--monster-theme-control-border-color);border-radius:var(--monster-theme-control-border-radius);border-style:var(--monster-theme-control-border-style);border-width:var(--monster-theme-control-border-width);box-sizing:border-box;color:var(--monster-color-primary-1);font-family:inherit;font-size:100%;margin:0;outline:none}input,select,textarea{height:-moz-fit-content;height:fit-content;padding:.4rem .6rem}textarea{min-height:6rem;resize:vertical}input[type=color]{height:2rem;margin:0;padding:.1rem;width:2rem}input:hover:not([type=radio]):not([type=checkbox]):not([type=range]),select:hover,textarea:hover{box-shadow:var(--monster-box-shadow-2);transition:background .8s,color .25s .0833333333s}input:focus,select:focus,textarea:focus{outline:1px dashed var(--monster-color-selection-3);outline-offset:3px}
}`, 0);
}`,
0,
);
} catch (e) {
addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
addAttributeToken(
document.getRootNode().querySelector("html"),
ATTRIBUTE_ERRORMESSAGE,
e + "",
);
}
......@@ -101,7 +101,6 @@ const openEntryEventHandlerSymbol = Symbol("openEntryEventHandler");
* @fires Monster.Components.TreeMenu.event:monster-fetched
*/
class TreeMenu extends CustomElement {
/**
* This method is called by the `instanceof` operator.
* @returns {symbol}
......
......@@ -327,6 +327,10 @@ class CustomElement extends HTMLElement {
* @property {Object} templates Specifies the templates used by the control.
* @property {string} templates.main=undefined Specifies the main template used by the control.
* @property {Object} templateMapping Specifies the mapping of templates.
* @property {Object} templateFormatter Specifies the formatter for the templates.
* @property {Object} templateFormatter.marker Specifies the marker for the templates.
* @property {Function} templateFormatter.marker.open=null Specifies the opening marker for the templates.
* @property {Function} templateFormatter.marker.close=null Specifies the closing marker for the templates.
* @property {Boolean} eventProcessing=false Specifies whether the control processes events.
* @since 1.8.0
*/
......@@ -339,6 +343,12 @@ class CustomElement extends HTMLElement {
main: undefined,
},
templateMapping: {},
templateFormatter: {
marker: {
open: null,
close: null,
},
},
eventProcessing: false,
};
......@@ -1200,7 +1210,14 @@ function initShadowRoot() {
const mapping = this.getOption("templateMapping", {});
if (isObject(mapping)) {
html = new Formatter(mapping).format(html);
const formatter = new Formatter(mapping);
if (self.getOption("templateFormatter.marker.open")) {
formatter.setMarker(
self.getOption("templateFormatter.marker.open"),
self.getOption("templateFormatter.marker.close"),
);
}
formatter.format(html);
}
this.shadowRoot.innerHTML = html;
......
......@@ -27,6 +27,7 @@ export * from "./components/layout/width-toggle.mjs";
export * from "./components/layout/panel.mjs";
export * from "./components/layout/details.mjs";
export * from "./components/layout/slider.mjs";
export * from "./components/content/copy.mjs";
export * from "./components/form/message-state-button.mjs";
export * from "./components/form/button-bar.mjs";
export * from "./components/form/reload.mjs";
......@@ -55,7 +56,7 @@ export * from "./components/form/constants.mjs";
export * from "./components/notify/message.mjs";
export * from "./components/notify/notify.mjs";
export * from "./components/notify/constants.mjs";
//export * from "./components/tree-menu/dragable-tree-menu.mjs";
export * from "./components/tree-menu/dragable-tree-menu.mjs";
export * from "./components/tree-menu/tree-menu.mjs";
export * from "./components/host/collapse.mjs";
export * from "./components/host/config-manager.mjs";
......
......@@ -78,8 +78,6 @@ function initJSDOM(options) {
} catch(e) {
console.error("Error setting key", key, e);
}
});
import("dom-storage").then(({default: Storage}) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment