{"version":3,"file":"breadcrumb-v2.mjs","sources":["../../../../src/breadcrumb/v2/breadcrumb.ts"],"sourcesContent":["import { html, unsafeCSS, type CSSResult, type TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { BaseOrganism } from '../../base-organism';\nimport '@vg-constellation/web/breadcrumbs';\nimport '@vg-constellation/web/link';\n// Registers c11n-web-v1-menu, which c11n-web-v1-breadcrumbs relies on internally for its\n// overflow-collapse behavior. overflow=\"wrap\" is intended to avoid ever needing it, but the\n// component's implementation isn't inspectable from this repo (CDN re-export) to confirm the\n// menu path is fully dead — keep this registered until that's verified.\nimport '@vg-constellation/web/menu';\nimport styles from './breadcrumb.scss?inline';\n\n@customElement('pips-v2-breadcrumb')\nexport class BreadcrumbV2 extends BaseOrganism {\n  static override styles: CSSResult[] = [...BaseOrganism.styles, unsafeCSS(styles)];\n\n  /** Breadcrumbs have no background color concept; locked to disable the inherited BaseOrganism feature. */\n  override get background(): string | null {\n    return null;\n  }\n\n  override set background(_value: string | null) {\n    // no-op\n  }\n\n  // The getter/setter override above stops the `background` property from ever\n  // holding a value, but Lit's attribute reflection only writes property → attribute,\n  // not the reverse — a `background` attribute set directly on the DOM (bypassing the\n  // property setter) is never removed by the no-op setter alone. base-organism.slot.scss\n  // has raw `[background=\"...\"]` selectors that would otherwise still match. Strip it here.\n  override attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n    super.attributeChangedCallback(name, oldValue, newValue);\n    if (name === 'background' && newValue !== null) {\n      this.removeAttribute('background');\n    }\n  }\n\n  protected override firstUpdated(): void {\n    super.firstUpdated();\n\n    const breadcrumbs = this.shadowRoot?.querySelector('c11n-web-v1-breadcrumbs');\n    if (!breadcrumbs) {\n      return;\n    }\n\n    // One-shot move: child nodes present at first render are relocated into the\n    // Constellation breadcrumbs element. Children added after this point are NOT\n    // moved — breadcrumb items are expected to be authored statically in AEM.\n    //\n    // Only slotted elements (e.g. the auto-injected fine-print) are excluded. Text\n    // and comment nodes are moved along with everything else, matching v1's behavior:\n    // excluding them (as an earlier revision of this method did, to keep incidental\n    // AEM whitespace out of the Constellation component) splits lit-html's internal\n    // comment markers from the elements they track, breaking re-renders driven through\n    // lit-html (e.g. Storybook's itemCount control re-rendering with a new item count).\n    Array.from(this.childNodes).forEach(node => {\n      if (node instanceof Element && node.hasAttribute('slot')) {\n        return;\n      }\n      breadcrumbs.appendChild(node);\n    });\n  }\n\n  protected override renderContent(): TemplateResult {\n    return html`\n      <div class=\"layout--full-width breadcrumb-container\">\n        <c11n-web-v1-breadcrumbs variant=\"secondary\" overflow=\"wrap\"></c11n-web-v1-breadcrumbs>\n      </div>\n    `;\n  }\n}\n"],"names":["BreadcrumbV2","BaseOrganism","background","_value","name","oldValue","newValue","super","attributeChangedCallback","this","removeAttribute","firstUpdated","breadcrumbs","shadowRoot","querySelector","Array","from","childNodes","forEach","node","Element","hasAttribute","appendChild","renderContent","html","styles","unsafeCSS","customElement"],"mappings":"6qCAaO,IAAMA,EAAN,cAA2BC,EAIhC,IAAA,YAAaC,CACX,OAAO,IACT,CAEA,eAAwBC,EAAAA,CAExB,CAOS,yBAAyBC,EAAcC,EAAyBC,GACvEC,MAAMC,yBAAyBJ,EAAMC,EAAUC,CAAAA,EAC3CF,IAAS,cAAgBE,IAAa,MACxCG,KAAKC,gBAAgB,aAEzB,CAEmB,eACjBH,MAAMI,aAAAA,EAEN,MAAMC,EAAcH,KAAKI,YAAYC,cAAc,yBAAA,EAC9CF,GAcLG,MAAMC,KAAKP,KAAKQ,UAAAA,EAAYC,QAAQC,IAC9BA,aAAgBC,SAAWD,EAAKE,aAAa,MAAA,GAGjDT,EAAYU,YAAYH,CAAAA,CAAAA,CAAAA,CAE5B,CAEmB,eAAAI,CACjB,OAAOC;AAAAA;AAAAA;AAAAA;AAAAA,KAKT,CAAA,EAxDWxB,EACKyB,OAAsB,CAAA,GAAIxB,EAAawB,OAAQC,0LADpD1B,wGAAN,CADN2B,EAAc,oBAAA,CAAA,EACF3B,CAAAA"}