{"mappings":"AACA,cAAyB,iBAAiB;KAErC,iBAAiB;CACpB,iBAAiB;CACjB,iBAAiB;CACjB;CACA,OAAO;;;;;AAyBT,OAAO,cAAM,YAAY;CACvB;CAEA,YAAY,EACV,UACA,OACA,OACA,SACC;CASH,IAAI,cAAc;;AAKpB,YAAY,WAAW,YAAY,kBAAkB,WAAW,iBAAiB,WAAW;AAE5F,OAAO,cAAM,SAAU,MAAM;AAE7B,OAAO,cAAM,oBAAoB","names":[],"sources":["../../../src/internal/ring.ts"],"sourcesContent":["import { cssGlobalVars } from \"./global-style.js\";\nimport { unsafeCSS, type CSSResult } from \"lit\";\n\ntype OutlineOptions = {\n  width?: string | CSSResult;\n  color?: string | CSSResult;\n  selector?: string;\n  type?: RingType;\n};\n\nconst outlineRing = ({ width, color, inset }) =>\n  `outline-style:solid;outline-color:${color};outline-width:${width};${\n    inset ? `outline-offset:calc(-1 * ${width});` : \"\"\n  }`;\n\nconst borderRing = ({ width, color }) => `border-style:solid;border-color:${color};border-width:${width};`;\n\nconst shadowRing = ({ width, color, inset }) => `box-shadow:${inset ? \"inset\" : \"\"} 0 0 0 ${width} ${color};`;\n\nconst ringMap = {\n  outline: (width, color) => outlineRing({ width, color, inset: false }),\n  \"outline-inset\": (width, color) => outlineRing({ width, color, inset: true }),\n  \"box-shadow\": (width, color) => shadowRing({ width, color, inset: false }),\n  shadow: (width, color) => shadowRing({ width, color, inset: false }),\n  \"box-shadow-inset\": (width, color) => shadowRing({ width, color, inset: true }),\n  \"shadow-inset\": (width, color) => shadowRing({ width, color, inset: true }),\n  border: (width, color) => borderRing({ width, color }),\n};\n\n/**\n * The {@link RingBuilder} class is responsible for generating CSS styles for various types of outline/border/shadow.\n */\nexport class RingBuilder {\n  css: string;\n\n  constructor({\n    selector = \":host\",\n    width = cssGlobalVars.ringWidth.toVar(),\n    color = cssGlobalVars.ringColor.toVar(),\n    type,\n  }: OutlineOptions = {}) {\n    if (type && type in ringMap) {\n      const style = ringMap[type](width, color);\n      this.css = `${selector}{${style}}`;\n    } else {\n      this.css = \"\";\n    }\n  }\n\n  get styleSheet(): CSSStyleSheet {\n    return unsafeCSS(this.css).styleSheet;\n  }\n}\n\nexport type RingType = \"outline\" | \"outline-inset\" | \"shadow\" | \"shadow-inset\" | \"border\" | \"none\" | undefined;\n\nexport const isNone = (type: RingType): boolean => !type || type === \"none\";\n\nexport const ringTypeAttribute = \"ring-type\";\n"],"version":3,"file":"ring.d.ts"}