"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSchemaSpecs = void 0;
const const_1 = require("./const.js");
const DEFAULT_PLACEHOLDERS = {
    TabTitle: 'Tab title',
    RadioTabLabelTitle: 'Radio title',
};
const getSchemaSpecs = (opts, placeholder) => ({
    [const_1.TabsNode.Tab]: {
        attrs: {
            [const_1.TabAttrs.id]: { default: 'unknown' },
            [const_1.TabAttrs.class]: { default: 'yfm-tab' },
            [const_1.TabAttrs.role]: { default: 'unknown' },
            [const_1.TabAttrs.ariaControls]: { default: 'unknown' },
            [const_1.TabAttrs.ariaSelected]: { default: 'unknown' },
            [const_1.TabAttrs.tabindex]: { default: 'unknown' },
            [const_1.TabAttrs.dataDiplodocKey]: { default: 'unknown' },
            [const_1.TabAttrs.dataDiplodocid]: { default: 'unknown' },
            [const_1.TabAttrs.dataDiplodocIsActive]: { default: 'unknown' },
        },
        marks: '',
        content: 'text*',
        group: 'block',
        parseDOM: [{ tag: 'div.yfm-tab' }],
        toDOM(node) {
            return ['div', { draggable: 'false', ...node.attrs }, 0];
        },
        placeholder: {
            content: placeholder?.[const_1.TabsNode.Tab] ??
                opts?.tabPlaceholder ??
                DEFAULT_PLACEHOLDERS.TabTitle,
            alwaysVisible: true,
        },
        selectionContext: false,
        selectable: false,
        allowSelection: false,
        complex: 'leaf',
    },
    [const_1.TabsNode.TabPanel]: {
        attrs: {
            [const_1.TabPanelAttrs.id]: { default: 'unknown' },
            [const_1.TabPanelAttrs.class]: { default: 'yfm-tab-panel' },
            [const_1.TabPanelAttrs.role]: { default: 'unknown' },
            [const_1.TabPanelAttrs.dataTitle]: { default: 'unknown' },
            [const_1.TabPanelAttrs.ariaLabelledby]: { default: 'unknown' },
        },
        content: '(block | paragraph)+',
        group: 'block',
        parseDOM: [{ tag: 'div.yfm-tab-panel' }],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        selectable: false,
        allowSelection: false,
        complex: 'leaf',
        isolating: true,
    },
    [const_1.TabsNode.Tabs]: {
        attrs: {
            [const_1.TabsAttrs.class]: { default: 'yfm-tabs' },
            [const_1.TabsAttrs.dataDiplodocGroup]: { default: 'unknown' },
            [const_1.TabsAttrs.dataDiplodocVariant]: { default: 'regular' },
        },
        content: `${const_1.TabsNode.TabsList} ${const_1.TabsNode.TabPanel}+`,
        group: 'block',
        parseDOM: [{ tag: 'div.yfm-tabs' }],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        selectable: true,
        complex: 'root',
    },
    [const_1.TabsNode.TabsList]: {
        attrs: {
            [const_1.TabsListAttrs.class]: { default: 'yfm-tab-list' },
            [const_1.TabsListAttrs.role]: { default: 'unknown' },
        },
        content: `${const_1.TabsNode.Tab}*`,
        group: 'block',
        parseDOM: [{ tag: 'div.yfm-tab-list' }],
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        selectable: false,
        allowSelection: false,
        complex: 'inner',
    },
    [const_1.TabsNode.RadioTabs]: {
        attrs: {
            [const_1.TabsAttrs.class]: { default: 'yfm-tabs yfm-tabs-vertical' },
            [const_1.TabsAttrs.dataDiplodocGroup]: { default: 'unknown' },
            [const_1.TabsAttrs.dataDiplodocVariant]: { default: 'radio' },
        },
        content: `(${const_1.TabsNode.RadioTab} ${const_1.TabsNode.TabPanel})+`,
        group: 'block',
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        complex: 'root',
    },
    [const_1.TabsNode.RadioTab]: {
        attrs: {
            [const_1.TabAttrs.id]: { default: null },
            [const_1.TabAttrs.class]: { default: 'yfm-tab yfm-vertical-tab' },
            [const_1.TabAttrs.role]: { default: 'unknown' },
            [const_1.TabAttrs.ariaControls]: { default: 'unknown' },
            [const_1.TabAttrs.ariaSelected]: { default: 'unknown' },
            [const_1.TabAttrs.tabindex]: { default: 'unknown' },
            [const_1.TabAttrs.dataDiplodocKey]: { default: 'unknown' },
            [const_1.TabAttrs.dataDiplodocid]: { default: 'unknown' },
            [const_1.TabAttrs.dataDiplodocIsActive]: { default: 'false' },
            [const_1.TabAttrs.dataDiplodocVerticalTab]: { default: 'true' },
        },
        content: `${const_1.TabsNode.RadioTabInput} ${const_1.TabsNode.RadioTabLabel}`,
        group: 'block',
        toDOM(node) {
            return ['div', node.attrs, 0];
        },
        selectable: false,
        allowSelection: false,
        complex: 'inner',
    },
    [const_1.TabsNode.RadioTabInput]: {
        attrs: {
            [const_1.TabAttrs.class]: { default: 'radio' },
            type: { default: 'radio' },
            checked: { default: null },
        },
        group: 'block',
        toDOM(node) {
            return ['input', node.attrs];
        },
        selectable: false,
        allowSelection: false,
        complex: 'leaf',
    },
    [const_1.TabsNode.RadioTabLabel]: {
        attrs: {},
        marks: '',
        content: 'text*',
        group: 'block',
        toDOM(node) {
            return ['label', node.attrs, 0];
        },
        placeholder: {
            content: placeholder?.[const_1.TabsNode.RadioTab] ?? DEFAULT_PLACEHOLDERS.RadioTabLabelTitle,
            alwaysVisible: true,
        },
        selectionContext: false,
        selectable: false,
        allowSelection: false,
        complex: 'leaf',
    },
});
exports.getSchemaSpecs = getSchemaSpecs;
//# sourceMappingURL=schema.js.map
