import { Directive, PartType, directive } from "lit/directive.js";
import { nothing } from "lit-html";
//#region src/shared/directives/custom-style-map/index.ts
var CustomStyleMapDirective = class extends Directive {
	constructor(partInfo) {
		super(partInfo);
		if (partInfo.type !== PartType.ATTRIBUTE || partInfo.name !== "style" || partInfo.strings?.length > 2) throw new Error("`customStyleMap()` can only be used in the `style` attribute and must be the only part in the attribute.");
	}
	render(styleInfoList) {
		const styles = Object.keys(styleInfoList).filter((key) => styleInfoList[key]);
		if (styles.length === 0) return nothing;
		return ` ${styles.join("; ")} `;
	}
};
/**
* A directive that applies dynamic CSS styles.
* Since build in `styleMap` directive doesn't allow to add conditional styles
*
* Example `{'foo bar': baz}` applies the style `foo bar` if the value of `baz` is
* truthy.
*
* @param styleInfoList
*/
var customStyleMap = directive(CustomStyleMapDirective);
//#endregion
export { CustomStyleMapDirective, customStyleMap };
