"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LayoutContainerNode = void 0;
exports.$createLayoutContainerNode = $createLayoutContainerNode;
exports.$isLayoutContainerNode = $isLayoutContainerNode;
const utils_1 = require("@lexical/utils");
const lexical_1 = require("lexical");
class LayoutContainerNode extends lexical_1.ElementNode {
    constructor(templateColumns, key) {
        super(key);
        this.__templateColumns = templateColumns;
    }
    static getType() {
        return 'layout-container';
    }
    static clone(node) {
        return new LayoutContainerNode(node.__templateColumns, node.__key);
    }
    createDOM(config) {
        const dom = document.createElement('div');
        dom.style.gridTemplateColumns = this.__templateColumns;
        if (typeof config.theme.layoutContainer === 'string') {
            (0, utils_1.addClassNamesToElement)(dom, config.theme.layoutContainer);
        }
        return dom;
    }
    updateDOM(prevNode, dom) {
        if (prevNode.__templateColumns !== this.__templateColumns) {
            dom.style.gridTemplateColumns = this.__templateColumns;
        }
        return false;
    }
    static importDOM() {
        return {};
    }
    static importJSON(json) {
        return $createLayoutContainerNode(json.templateColumns);
    }
    canBeEmpty() {
        return false;
    }
    exportJSON() {
        return {
            ...super.exportJSON(),
            templateColumns: this.__templateColumns,
            type: 'layout-container',
            version: 1,
        };
    }
    getTemplateColumns() {
        return this.getLatest().__templateColumns;
    }
    setTemplateColumns(templateColumns) {
        this.getWritable().__templateColumns = templateColumns;
    }
}
exports.LayoutContainerNode = LayoutContainerNode;
function $createLayoutContainerNode(templateColumns) {
    return new LayoutContainerNode(templateColumns);
}
function $isLayoutContainerNode(node) {
    return node instanceof LayoutContainerNode;
}
//# sourceMappingURL=LayoutContainerNode.js.map