53 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-01-29 09:26:07 +08:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createKey = exports.find = exports.namespace = exports.prefix = exports.asModal = exports.insidePopover = exports.insideModal = exports.cCB = exports.cNotM = exports.cM = exports.cE = exports.cB = exports.c = void 0;
/* eslint-disable @typescript-eslint/restrict-template-expressions */
const css_render_1 = require("css-render");
const plugin_bem_1 = require("@css-render/plugin-bem");
const namespace = 'n';
exports.namespace = namespace;
const prefix = `.${namespace}-`;
exports.prefix = prefix;
const elementPrefix = '__';
const modifierPrefix = '--';
const cssr = (0, css_render_1.CssRender)();
const plugin = (0, plugin_bem_1.plugin)({
blockPrefix: prefix,
elementPrefix,
modifierPrefix
});
cssr.use(plugin);
const { c, find } = cssr;
exports.c = c;
exports.find = find;
const { cB, cE, cM, cNotM } = plugin;
exports.cB = cB;
exports.cE = cE;
exports.cM = cM;
exports.cNotM = cNotM;
function insideModal(style) {
return c(({ props: { bPrefix } }) => `${bPrefix || prefix}modal, ${bPrefix || prefix}drawer`, [style]);
}
exports.insideModal = insideModal;
function insidePopover(style) {
return c(({ props: { bPrefix } }) => `${bPrefix || prefix}popover`, [style]);
}
exports.insidePopover = insidePopover;
function asModal(style) {
return c(({ props: { bPrefix } }) => `&${bPrefix || prefix}modal`, style);
}
exports.asModal = asModal;
// child block
const cCB = ((...args) => {
return c('>', [cB(...args)]);
});
exports.cCB = cCB;
function createKey(prefix, suffix) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (prefix +
(suffix === 'default'
? ''
: suffix.replace(/^[a-z]/, (startChar) => startChar.toUpperCase())));
}
exports.createKey = createKey;