"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Layout = void 0;
var vue_1 = require("vue");
var context_1 = require("../context");
var shared_1 = require("@designable/shared");
exports.Layout = (0, vue_1.defineComponent)({
    name: 'Layout',
    props: {
        theme: { type: String, default: 'light' },
        prefixCls: { type: String, default: 'dn-' },
        variables: { type: Object, default: function () { } },
        position: { type: String, default: 'fixed' }
    },
    setup: function (props, _a) {
        var slots = _a.slots;
        var layoutRef = (0, context_1.useContext)(context_1.DesignerLayoutSymbol);
        var containerRef = (0, vue_1.ref)();
        (0, vue_1.watch)(containerRef, function () {
            if (containerRef.value) {
                (0, shared_1.each)(props.variables, function (value, key) {
                    var _a, _b;
                    (_b = (_a = containerRef.value) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.setProperty("--".concat(key), value);
                });
            }
        });
        if (layoutRef.value) {
            return function () {
                var _a;
                return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
            };
        }
        (0, vue_1.provide)(context_1.DesignerLayoutSymbol, (0, vue_1.computed)(function () {
            return {
                theme: props.theme,
                prefixCls: props.prefixCls,
                position: props.position
            };
        }));
        return function () {
            var _a;
            var _b;
            return (<div ref={containerRef} class={_a = {},
                    _a["".concat(props.prefixCls, "app")] = true,
                    _a["".concat(props.prefixCls).concat(props.theme)] = props.theme,
                    _a}>
          {(_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots)}
        </div>);
        };
    },
});
//# sourceMappingURL=Layout.jsx.map