@aurigma/design-atoms
Version:
Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.
30 lines • 921 B
JavaScript
export class SpotlightHandler {
constructor(_handlerFactory) {
this._handlerFactory = _handlerFactory;
this._data = new Map();
}
showSpotlight(items, options) {
items.forEach(item => {
const data = {
item: item,
handler: this._handlerFactory.get(item),
options: options
};
this._data.set(item.id, data);
});
}
hideSpotlight(items) {
if (items == null) {
items = [...this._data.values()]
.map(data => data === null || data === void 0 ? void 0 : data.item);
}
items.forEach(item => {
if (this._data.has(item.id))
this._data.delete(item.id);
});
}
getSpotlightItems() {
return [...this._data.values()];
}
}
//# sourceMappingURL=SpotlightHandler.js.map