@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 • 1.1 kB
JavaScript
import { PlaceholderItemHandler } from "./PlaceholderItemHandler";
import { ImageItemHandler } from "./ImageItemHandler";
import { GroupItemHandler } from "./GroupItemHandler";
export function isPlaceholder(itemHandler) {
return itemHandler instanceof PlaceholderItemHandler;
}
export function isImage(itemHandler) {
return itemHandler instanceof ImageItemHandler;
}
export function isImageOrPlaceholder(itemHandler) {
return isImage(itemHandler) || isPlaceholder(itemHandler);
}
export function isGroup(itemHandler) {
return itemHandler instanceof GroupItemHandler;
}
export function isNonVectorImageHandler(handler) {
return handler instanceof ImageItemHandler
&& !handler.item.source.isVector;
}
export function getPlaceholderContent(handler) {
return handler instanceof PlaceholderItemHandler
? handler.content
: handler;
}
export function extractGroupContent(handler) {
return handler instanceof GroupItemHandler
? handler.getNestedItemHandlers()
: [handler];
}
//# sourceMappingURL=HandlerUtils.js.map