@repobit/dex-system-design 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +35 -0
  3. package/dist/src/components/agent-endpoints/agent-endpoints.d.ts +1 -0
  4. package/dist/src/components/agent-endpoints/agent-endpoints.js +12 -12
  5. package/dist/src/components/agent-endpoints/agent-endpoints.js.map +1 -1
  6. package/dist/src/components/anchor/anchor-nav.d.ts +2 -1
  7. package/dist/src/components/anchor/anchor-nav.js +10 -10
  8. package/dist/src/components/anchor/anchor-nav.js.map +1 -1
  9. package/dist/src/components/audience-card/audience-card.d.ts +1 -0
  10. package/dist/src/components/audience-card/audience-card.js +7 -7
  11. package/dist/src/components/audience-card/audience-card.js.map +1 -1
  12. package/dist/src/components/awards/awards-flex.d.ts +3 -2
  13. package/dist/src/components/awards/awards-flex.js +16 -16
  14. package/dist/src/components/awards/awards-flex.js.map +1 -1
  15. package/dist/src/components/awards/awards-spotlight.d.ts +2 -1
  16. package/dist/src/components/awards/awards-spotlight.js +8 -8
  17. package/dist/src/components/awards/awards-spotlight.js.map +1 -1
  18. package/dist/src/components/awards/awards.d.ts +1 -1
  19. package/dist/src/components/bento-grid/bento-grid.d.ts +1 -0
  20. package/dist/src/components/bento-grid/bento-grid.js +10 -10
  21. package/dist/src/components/bento-grid/bento-grid.js.map +1 -1
  22. package/dist/src/components/bento-grid/bento-item.d.ts +1 -0
  23. package/dist/src/components/bento-grid/bento-item.js +9 -9
  24. package/dist/src/components/bento-grid/bento-item.js.map +1 -1
  25. package/dist/src/components/button/button.d.ts +1 -1
  26. package/dist/src/components/cards/card.d.ts +2 -2
  27. package/dist/src/components/cards/card.js +11 -11
  28. package/dist/src/components/cards/card.js.map +1 -1
  29. package/dist/src/components/carousel/carousel.d.ts +2 -2
  30. package/dist/src/components/carousel/carousel.js +6 -6
  31. package/dist/src/components/carousel/carousel.js.map +1 -1
  32. package/dist/src/components/comparison-panel/comparison-panel.d.ts +1 -0
  33. package/dist/src/components/comparison-panel/comparison-panel.js +12 -12
  34. package/dist/src/components/comparison-panel/comparison-panel.js.map +1 -1
  35. package/dist/src/components/compatibility-table/compatibility-table.d.ts +1 -0
  36. package/dist/src/components/compatibility-table/compatibility-table.js +14 -14
  37. package/dist/src/components/compatibility-table/compatibility-table.js.map +1 -1
  38. package/dist/src/components/cta-banner/cta-banner.d.ts +1 -0
  39. package/dist/src/components/cta-banner/cta-banner.js +8 -8
  40. package/dist/src/components/cta-banner/cta-banner.js.map +1 -1
  41. package/dist/src/components/header/header-code.d.ts +3 -2
  42. package/dist/src/components/header/header-code.js +13 -13
  43. package/dist/src/components/header/header-code.js.map +1 -1
  44. package/dist/src/components/heading/heading.d.ts +1 -1
  45. package/dist/src/components/heading/heading.js +5 -1
  46. package/dist/src/components/heading/heading.js.map +1 -1
  47. package/dist/src/components/hero/hero.d.ts +2 -1
  48. package/dist/src/components/hero/hero.js +8 -8
  49. package/dist/src/components/hero/hero.js.map +1 -1
  50. package/dist/src/components/install-options/install-options.d.ts +3 -2
  51. package/dist/src/components/install-options/install-options.js +17 -17
  52. package/dist/src/components/install-options/install-options.js.map +1 -1
  53. package/dist/src/components/link/link.d.ts +1 -1
  54. package/dist/src/components/list/list-item/list-item.d.ts +1 -1
  55. package/dist/src/components/logo-marquee/logo-marquee.d.ts +1 -0
  56. package/dist/src/components/logo-marquee/logo-marquee.js +5 -5
  57. package/dist/src/components/logo-marquee/logo-marquee.js.map +1 -1
  58. package/dist/src/components/motion-art/motion-art.js +1 -1
  59. package/dist/src/components/motion-art/motion-art.js.map +1 -1
  60. package/dist/src/components/overview/overview.d.ts +1 -0
  61. package/dist/src/components/overview/overview.js +7 -7
  62. package/dist/src/components/overview/overview.js.map +1 -1
  63. package/dist/src/components/page-switcher/page-switcher.d.ts +1 -0
  64. package/dist/src/components/page-switcher/page-switcher.js +5 -5
  65. package/dist/src/components/page-switcher/page-switcher.js.map +1 -1
  66. package/dist/src/components/pagination-dots/pagination-dots.d.ts +1 -1
  67. package/dist/src/components/partner-banner/partner-banner.d.ts +1 -0
  68. package/dist/src/components/partner-banner/partner-banner.js +6 -6
  69. package/dist/src/components/partner-banner/partner-banner.js.map +1 -1
  70. package/dist/src/components/picture/picture.css.js +1 -1
  71. package/dist/src/components/picture/picture.css.js.map +1 -1
  72. package/dist/src/components/post-card/post-card.d.ts +1 -0
  73. package/dist/src/components/post-card/post-card.js +5 -5
  74. package/dist/src/components/post-card/post-card.js.map +1 -1
  75. package/dist/src/components/process-steps/process-steps.d.ts +1 -0
  76. package/dist/src/components/process-steps/process-steps.js +7 -7
  77. package/dist/src/components/process-steps/process-steps.js.map +1 -1
  78. package/dist/src/components/quick-answer/quick-answer.d.ts +1 -0
  79. package/dist/src/components/quick-answer/quick-answer.js +7 -7
  80. package/dist/src/components/quick-answer/quick-answer.js.map +1 -1
  81. package/dist/src/components/review/review-grid.d.ts +1 -0
  82. package/dist/src/components/review/review-grid.js +3 -3
  83. package/dist/src/components/review/review-grid.js.map +1 -1
  84. package/dist/src/components/review/review.d.ts +1 -0
  85. package/dist/src/components/review/review.js +2 -2
  86. package/dist/src/components/review/review.js.map +1 -1
  87. package/dist/src/components/section-header/section-header.d.ts +1 -0
  88. package/dist/src/components/section-header/section-header.js +3 -3
  89. package/dist/src/components/section-header/section-header.js.map +1 -1
  90. package/dist/src/components/shared/controller.observer.d.ts +50 -0
  91. package/dist/src/components/shared/controller.observer.js +2 -0
  92. package/dist/src/components/shared/controller.observer.js.map +1 -0
  93. package/dist/src/components/spotlight-section/spotlight-section.d.ts +1 -0
  94. package/dist/src/components/spotlight-section/spotlight-section.js +7 -7
  95. package/dist/src/components/spotlight-section/spotlight-section.js.map +1 -1
  96. package/dist/src/components/stat/stat-highlight.d.ts +5 -5
  97. package/dist/src/components/stat/stat-highlight.js +2 -2
  98. package/dist/src/components/stat/stat-highlight.js.map +1 -1
  99. package/dist/src/components/stat/stat-tile.d.ts +1 -0
  100. package/dist/src/components/stat/stat-tile.js +5 -5
  101. package/dist/src/components/stat/stat-tile.js.map +1 -1
  102. package/dist/src/components/terminal/terminal-cursor.d.ts +1 -0
  103. package/dist/src/components/terminal/terminal-cursor.js +1 -1
  104. package/dist/src/components/terminal/terminal-cursor.js.map +1 -1
  105. package/dist/src/components/terminal/terminal-message.d.ts +4 -3
  106. package/dist/src/components/terminal/terminal-message.js +25 -25
  107. package/dist/src/components/terminal/terminal-message.js.map +1 -1
  108. package/dist/src/components/tooltip/tooltip.js +1 -1
  109. package/dist/src/components/tooltip/tooltip.js.map +1 -1
  110. package/dist/src/components/trust-panel/trust-panel.d.ts +1 -0
  111. package/dist/src/components/trust-panel/trust-panel.js +19 -19
  112. package/dist/src/components/trust-panel/trust-panel.js.map +1 -1
  113. package/dist/src/loader/create-loader.d.ts +13 -0
  114. package/dist/src/loader/create-loader.js +2 -0
  115. package/dist/src/loader/create-loader.js.map +1 -0
  116. package/dist/src/loader/loader.d.ts +44 -0
  117. package/dist/src/loader/loader.js +2 -0
  118. package/dist/src/loader/loader.js.map +1 -0
  119. package/dist/src/loader/registry.d.ts +2 -0
  120. package/dist/src/loader/registry.js +2 -0
  121. package/dist/src/loader/registry.js.map +1 -0
  122. package/dist/src/tokens/tokens.js +1 -1
  123. package/dist/src/tokens/tokens.js.map +1 -1
  124. package/package.json +14 -6
  125. package/schemas/component-manifest.json +1 -1
  126. package/dist/src/tokens/dark-derivation.d.ts +0 -70
  127. package/dist/src/tokens/dark-derivation.js +0 -2
  128. package/dist/src/tokens/dark-derivation.js.map +0 -1
  129. package/dist/src/tokens/dark-findings.d.ts +0 -59
  130. package/dist/src/tokens/dark-findings.js +0 -2
  131. package/dist/src/tokens/dark-findings.js.map +0 -1
  132. package/dist/src/tokens/story-chrome.d.ts +0 -72
  133. package/dist/src/tokens/story-chrome.js +0 -292
  134. package/dist/src/tokens/story-chrome.js.map +0 -1
  135. package/dist/src/tokens/token-map.d.ts +0 -114
  136. package/dist/src/tokens/token-map.js +0 -2
  137. package/dist/src/tokens/token-map.js.map +0 -1
  138. package/dist/src/tokens/token-purposes.d.ts +0 -63
  139. package/dist/src/tokens/token-purposes.js +0 -2
  140. package/dist/src/tokens/token-purposes.js.map +0 -1
  141. package/dist/src/tokens/type-ceiling-words.d.ts +0 -96
  142. package/dist/src/tokens/type-ceiling-words.js +0 -2
  143. package/dist/src/tokens/type-ceiling-words.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.1.0](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@3.0.3...@repobit/dex-system-design@3.1.0) (2026-11-03)
7
+
8
+ ### Features
9
+
10
+ * **DEX-29334:** load dex-system-design components through one loader
11
+
12
+ ### Bug Fixes
13
+
14
+ * **DEX-29320:** bd-motion-art imports its vendored engine by a relative path
15
+ * **DEX-29334:** address loader review findings
16
+ * **DEX-29334:** refuse nodes of another window in the loader
17
+ * **DEX-29360:** bd-h keeps its heading element across updates
18
+ * **DEX-29360:** bd-tooltip keeps its edge margin at the reader's root size
19
+ * **DEX-29360:** keep observers attached across a reconnect
20
+ * **DEX-29360:** re-evaluate css templates per build; keep story helpers out of dist
21
+
22
+
23
+ ## [3.0.3](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@3.0.2...@repobit/dex-system-design@3.0.3) (2026-11-02)
24
+
25
+ ### Bug Fixes
26
+
27
+ * **DEX-29329:** bd-picture's high-contrast edge reads prefers-contrast: more
28
+
29
+
6
30
  ## [3.0.2](https://github.com/bitdefender/dex-core/compare/@repobit/dex-system-design@3.0.1...@repobit/dex-system-design@3.0.2) (2026-10-30)
7
31
 
8
32
  ### Performance Improvements
package/README.md CHANGED
@@ -31,6 +31,41 @@ properties carry their allowed values, and the events it sends are in
31
31
  `HTMLElementEventMap`. Since 3.0.0 the published files are under
32
32
  `dist/`; import through the entry points above, never by a file path.
33
33
 
34
+ ## Loading components
35
+
36
+ To skip working out which entry point a tag lives in — `bd-p` is
37
+ `./paragraph`'s, `bd-button-link` is `./button`'s, `bd-li` is `./list-item`'s —
38
+ let the loader do it. It carries a map of every tag the package registers to
39
+ the module that registers it (about 2 KB gzipped with the loader), and imports
40
+ only the modules a page actually uses.
41
+
42
+ ```js
43
+ import { load, autoload } from '@repobit/dex-system-design/loader';
44
+
45
+ // build, wait, then show: nothing renders half-defined
46
+ const layout = document.createElement('bd-grid');
47
+ layout.append(document.createElement('bd-stat-tile'), document.createElement('bd-p'));
48
+ await load(layout); // imports ./grid, ./stat and ./paragraph
49
+ container.replaceChildren(layout);
50
+
51
+ // and anything added to the page later, once
52
+ autoload();
53
+ ```
54
+
55
+ - `load(target)` takes an element or fragment — itself and everything under
56
+ it, attached to the page or not — or a list of tag names, and resolves once
57
+ every component in it is defined. It rejects if an import fails, so you can
58
+ keep a fallback. Tags that are not this package's are ignored.
59
+ - Components are defined in the window that imported the loader. A node from
60
+ an iframe's document is rejected (`autoload()` throws for one), because the
61
+ iframe upgrades its elements from its own registry: import the loader inside
62
+ the iframe instead. A `<template>`'s content is fine.
63
+ - `autoload(root = document.documentElement)` loads what is under `root` now
64
+ and whatever is added under it later, and returns a function that stops it.
65
+ It does not look inside shadow roots of your own; `load()` those.
66
+ - Each module is imported once, however many times it is asked for. With a
67
+ bundler, every component becomes its own chunk.
68
+
34
69
  ## Tokens
35
70
 
36
71
  Tokens are declared on `:root` in document scope, inside the `bd-tokens`
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from "lit";
2
2
  import "../button/button.js";
3
+ import "../../tokens/tokens.js";
3
4
  import "../heading/heading.js";
4
5
  import "../paragraph/paragraph.js";
5
6
  import "../icons/arrow-right-icon.js";
@@ -1,14 +1,14 @@
1
- import{defineElement as e}from"../shared/define-element.js";import{tokens as t}from"../../tokens/tokens.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import"../heading/heading.js";import"../paragraph/paragraph.js";import{ensembleCSS as r}from"../shared/ensemble.css.js";import i from"./agent-endpoints.css.js";import"../button/button.js";import"../icons/arrow-right-icon.js";import{LitElement as a,html as o,nothing as s}from"lit";import{property as c}from"lit/decorators.js";var l=class extends a{constructor(...e){super(...e),this.eyebrow=``,this.title=``,this.description=``,this.endpoints=[],this.assistants=[]}static{this.styles=[t,r,i]}render(){return o`
1
+ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import t from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import"../heading/heading.js";import"../paragraph/paragraph.js";import{ensembleCSS as n}from"../shared/ensemble.css.js";import r from"./agent-endpoints.css.js";import"../button/button.js";import"../icons/arrow-right-icon.js";import{LitElement as i,html as a,nothing as o}from"lit";import{property as s}from"lit/decorators.js";var c=class extends i{constructor(...e){super(...e),this.eyebrow=``,this.title=``,this.description=``,this.endpoints=[],this.assistants=[]}static{this.styles=[n,r]}render(){return a`
2
2
  <div class="bd-ensemble bd-agentendpoints-wrapper">
3
- ${this.eyebrow?o`<bd-p variant="eyebrow" class="bd-agentendpoints-eyebrow"><slot name="eyebrow">${this.eyebrow}</slot></bd-p>`:s}
3
+ ${this.eyebrow?a`<bd-p variant="eyebrow" class="bd-agentendpoints-eyebrow"><slot name="eyebrow">${this.eyebrow}</slot></bd-p>`:o}
4
4
 
5
- ${this.title?o`<bd-h as="h2" class="bd-agentendpoints-title"><slot name="title">${this.title}</slot></bd-h>`:s}
5
+ ${this.title?a`<bd-h as="h2" class="bd-agentendpoints-title"><slot name="title">${this.title}</slot></bd-h>`:o}
6
6
 
7
- ${this.description?o`<bd-p variant="regular" class="bd-agentendpoints-description"><slot name="description">${this.description}</slot></bd-p>`:s}
7
+ ${this.description?a`<bd-p variant="regular" class="bd-agentendpoints-description"><slot name="description">${this.description}</slot></bd-p>`:o}
8
8
 
9
- ${this.endpoints&&this.endpoints.length?o`
9
+ ${this.endpoints&&this.endpoints.length?a`
10
10
  <div class="bd-agentendpoints-row">
11
- ${this.endpoints.map(e=>o`
11
+ ${this.endpoints.map(e=>a`
12
12
  <bd-button-link
13
13
  class="bd-agentendpoints-pill"
14
14
  href=${e.href}
@@ -21,11 +21,11 @@ import{defineElement as e}from"../shared/define-element.js";import{tokens as t}f
21
21
  </bd-button-link>
22
22
  `)}
23
23
  </div>
24
- `:s}
24
+ `:o}
25
25
 
26
- ${this.assistants&&this.assistants.length?o`
26
+ ${this.assistants&&this.assistants.length?a`
27
27
  <div class="bd-agentendpoints-row">
28
- ${this.assistants.map(e=>o`
28
+ ${this.assistants.map(e=>a`
29
29
  <bd-button-link
30
30
  class="bd-agentendpoints-pill"
31
31
  href=${e.href}
@@ -34,14 +34,14 @@ import{defineElement as e}from"../shared/define-element.js";import{tokens as t}f
34
34
  variant="tertiary"
35
35
  label="${e.label} (opens in new tab)"
36
36
  >
37
- ${e.icon?o`<img src=${e.icon} alt="" class="bd-agentendpoints-icon" width="20" height="20" loading="lazy" />`:s}
37
+ ${e.icon?a`<img src=${e.icon} alt="" class="bd-agentendpoints-icon" width="20" height="20" loading="lazy" />`:o}
38
38
  <span>${e.label}</span>
39
39
  </bd-button-link>
40
40
  `)}
41
41
  </div>
42
- `:s}
42
+ `:o}
43
43
 
44
44
  <slot name="rows"></slot>
45
45
  </div>
46
- `}};n([c({type:String})],l.prototype,`eyebrow`,void 0),n([c({type:String})],l.prototype,`title`,void 0),n([c({type:String})],l.prototype,`description`,void 0),n([c({type:Array})],l.prototype,`endpoints`,void 0),n([c({type:Array})],l.prototype,`assistants`,void 0),l=n([e(`bd-agent-endpoints`)],l);
46
+ `}};t([s({type:String})],c.prototype,`eyebrow`,void 0),t([s({type:String})],c.prototype,`title`,void 0),t([s({type:String})],c.prototype,`description`,void 0),t([s({type:Array})],c.prototype,`endpoints`,void 0),t([s({type:Array})],c.prototype,`assistants`,void 0),c=t([e(`bd-agent-endpoints`)],c);
47
47
  //# sourceMappingURL=agent-endpoints.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-endpoints.js","names":["agentEndpointsCSS","_decorate","__decorate","agent_endpoints_css_default","AgentEndpoints","LitElement","_args","tokens","ensembleCSS","nothing","ep","a","property","defineElement"],"sources":["../../../../src/components/agent-endpoints/agent-endpoints.ts"],"sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\nimport '#components/button/button.ts';\nimport { tokens } from \"#tokens/tokens.ts\";\nimport \"#components/heading/heading.ts\";\nimport \"#components/paragraph/paragraph.ts\";\nimport agentEndpointsCSS from \"./agent-endpoints.css.ts\";\nimport { ensembleCSS } from \"#shared/ensemble.css.ts\";\nimport \"#components/icons/arrow-right-icon.ts\";\n\ninterface Endpoint {\n label: string;\n href : string;\n}\n\ninterface Assistant {\n label: string;\n href : string;\n icon?: string;\n}\n\n@defineElement(\"bd-agent-endpoints\")\nclass AgentEndpoints extends LitElement {\n static styles = [tokens, ensembleCSS, agentEndpointsCSS];\n\n @property({ type: String })\n eyebrow = \"\";\n @property({ type: String })\n title = \"\";\n @property({ type: String })\n description = \"\";\n @property({ type: Array })\n endpoints: Endpoint[] = []; // [{ label: String, href: String }]\n @property({ type: Array })\n assistants: Assistant[] = []; // [{ label: String, href: String, icon: String }]\n\n render() {\n return html`\n <div class=\"bd-ensemble bd-agentendpoints-wrapper\">\n ${this.eyebrow\n ? html`<bd-p variant=\"eyebrow\" class=\"bd-agentendpoints-eyebrow\"><slot name=\"eyebrow\">${this.eyebrow}</slot></bd-p>`\n : nothing}\n\n ${this.title\n ? html`<bd-h as=\"h2\" class=\"bd-agentendpoints-title\"><slot name=\"title\">${this.title}</slot></bd-h>`\n : nothing}\n\n ${this.description\n ? html`<bd-p variant=\"regular\" class=\"bd-agentendpoints-description\"><slot name=\"description\">${this.description}</slot></bd-p>`\n : nothing}\n\n ${this.endpoints && this.endpoints.length\n ? html`\n <div class=\"bd-agentendpoints-row\">\n ${this.endpoints.map(\n (ep) => html`\n <bd-button-link\n class=\"bd-agentendpoints-pill\"\n href=${ep.href}\n target=\"_blank\"\n size=\"sm\"\n variant=\"tertiary\"\n >\n <bd-arrow-right-icon class=\"bd-agentendpoints-arrow\" size=\"xs\" aria-hidden=\"true\"></bd-arrow-right-icon>\n <span class=\"bd-agentendpoints-mono\">${ep.label}</span>\n </bd-button-link>\n `\n )}\n </div>\n `\n : nothing}\n\n ${this.assistants && this.assistants.length\n ? html`\n <div class=\"bd-agentendpoints-row\">\n ${this.assistants.map(\n (a) => html`\n <bd-button-link\n class=\"bd-agentendpoints-pill\"\n href=${a.href}\n target=\"_blank\"\n size=\"sm\"\n variant=\"tertiary\"\n label=\"${a.label} (opens in new tab)\"\n >\n ${a.icon\n ? html`<img src=${a.icon} alt=\"\" class=\"bd-agentendpoints-icon\" width=\"20\" height=\"20\" loading=\"lazy\" />`\n : nothing}\n <span>${a.label}</span>\n </bd-button-link>\n `\n )}\n </div>\n `\n : nothing}\n\n <slot name=\"rows\"></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-agent-endpoints\": AgentEndpoints;\n }\n}"],"mappings":"A,4fAsBA,IACMI,EADN,cAC6BC,CAAW,C,8BAI5B,KAAA,QAAA,GAEF,KAAA,MAAA,GAEM,KAAA,YAAA,GAEU,KAAA,UAAA,CAAC,EAEC,KAAA,WAAA,CAAC,C,QAXX,KAAA,OAAA,CAACE,EAAQC,EAAaR,CAAiB,C,CAavD,QAAS,CACP,MAAO,EAAI;;UAEL,KAAK,QACH,CAAI,kFAAkF,KAAK,QAAQ,gBACnGS,EAAQ;;UAEV,KAAK,MACH,CAAI,oEAAoE,KAAK,MAAM,gBACnFA,EAAQ;;UAEV,KAAK,YACH,CAAI,0FAA0F,KAAK,YAAY,gBAC/GA,EAAQ;;UAEV,KAAK,WAAa,KAAK,UAAU,OAC/B,CAAI;;kBAEE,KAAK,UAAU,IACd,GAAO,CAAI;;;6BAGDC,EAAG,KAAK;;;;;;6DAMwBA,EAAG,MAAM;;mBAGtD,EAAE;;cAGND,EAAQ;;UAEV,KAAK,YAAc,KAAK,WAAW,OACjC,CAAI;;kBAEE,KAAK,WAAW,IACf,GAAM,CAAI;;;6BAGAE,EAAE,KAAK;;;;+BAILA,EAAE,MAAM;;wBAEfA,EAAE,KACA,CAAI,YAAYA,EAAE,KAAK,iFACvBF,EAAQ;8BACJE,EAAE,MAAM;;mBAGtB,EAAE;;cAGNF,EAAQ;;;;KAKlB,CACF,EA3EGR,EAAA,CAAAW,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAR,EAAA,UAAA,UAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAW,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAR,EAAA,UAAA,QAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAW,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAR,EAAA,UAAA,cAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAW,EAAS,CAAE,KAAM,KAAM,CAAC,CAAA,EAAAR,EAAA,UAAA,YAAA,IAAA,EAAA,EAExBH,EAAA,CAAAW,EAAS,CAAE,KAAM,KAAM,CAAC,CAAA,EAAAR,EAAA,UAAA,aAAA,IAAA,EAAA,EAZ1B,EAAAH,EAAA,CAAAY,EAAc,oBAAoB,CAAA,EAAAT,CAAA"}
1
+ {"version":3,"file":"agent-endpoints.js","names":["agentEndpointsCSS","_decorate","__decorate","agent_endpoints_css_default","AgentEndpoints","LitElement","_args","ensembleCSS","nothing","ep","a","property","defineElement"],"sources":["../../../../src/components/agent-endpoints/agent-endpoints.ts"],"sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\nimport '#components/button/button.ts';\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/heading/heading.ts\";\nimport \"#components/paragraph/paragraph.ts\";\nimport agentEndpointsCSS from \"./agent-endpoints.css.ts\";\nimport { ensembleCSS } from \"#shared/ensemble.css.ts\";\nimport \"#components/icons/arrow-right-icon.ts\";\n\ninterface Endpoint {\n label: string;\n href : string;\n}\n\ninterface Assistant {\n label: string;\n href : string;\n icon?: string;\n}\n\n@defineElement(\"bd-agent-endpoints\")\nclass AgentEndpoints extends LitElement {\n static styles = [ensembleCSS, agentEndpointsCSS];\n\n @property({ type: String })\n eyebrow = \"\";\n @property({ type: String })\n title = \"\";\n @property({ type: String })\n description = \"\";\n @property({ type: Array })\n endpoints: Endpoint[] = []; // [{ label: String, href: String }]\n @property({ type: Array })\n assistants: Assistant[] = []; // [{ label: String, href: String, icon: String }]\n\n render() {\n return html`\n <div class=\"bd-ensemble bd-agentendpoints-wrapper\">\n ${this.eyebrow\n ? html`<bd-p variant=\"eyebrow\" class=\"bd-agentendpoints-eyebrow\"><slot name=\"eyebrow\">${this.eyebrow}</slot></bd-p>`\n : nothing}\n\n ${this.title\n ? html`<bd-h as=\"h2\" class=\"bd-agentendpoints-title\"><slot name=\"title\">${this.title}</slot></bd-h>`\n : nothing}\n\n ${this.description\n ? html`<bd-p variant=\"regular\" class=\"bd-agentendpoints-description\"><slot name=\"description\">${this.description}</slot></bd-p>`\n : nothing}\n\n ${this.endpoints && this.endpoints.length\n ? html`\n <div class=\"bd-agentendpoints-row\">\n ${this.endpoints.map(\n (ep) => html`\n <bd-button-link\n class=\"bd-agentendpoints-pill\"\n href=${ep.href}\n target=\"_blank\"\n size=\"sm\"\n variant=\"tertiary\"\n >\n <bd-arrow-right-icon class=\"bd-agentendpoints-arrow\" size=\"xs\" aria-hidden=\"true\"></bd-arrow-right-icon>\n <span class=\"bd-agentendpoints-mono\">${ep.label}</span>\n </bd-button-link>\n `\n )}\n </div>\n `\n : nothing}\n\n ${this.assistants && this.assistants.length\n ? html`\n <div class=\"bd-agentendpoints-row\">\n ${this.assistants.map(\n (a) => html`\n <bd-button-link\n class=\"bd-agentendpoints-pill\"\n href=${a.href}\n target=\"_blank\"\n size=\"sm\"\n variant=\"tertiary\"\n label=\"${a.label} (opens in new tab)\"\n >\n ${a.icon\n ? html`<img src=${a.icon} alt=\"\" class=\"bd-agentendpoints-icon\" width=\"20\" height=\"20\" loading=\"lazy\" />`\n : nothing}\n <span>${a.label}</span>\n </bd-button-link>\n `\n )}\n </div>\n `\n : nothing}\n\n <slot name=\"rows\"></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-agent-endpoints\": AgentEndpoints;\n }\n}"],"mappings":"A,2eAuBA,IACMI,EADN,cAC6BC,CAAW,C,8BAI5B,KAAA,QAAA,GAEF,KAAA,MAAA,GAEM,KAAA,YAAA,GAEU,KAAA,UAAA,CAAC,EAEC,KAAA,WAAA,CAAC,C,QAXX,KAAA,OAAA,CAACE,EAAaP,CAAiB,C,CAa/C,QAAS,CACP,MAAO,EAAI;;UAEL,KAAK,QACH,CAAI,kFAAkF,KAAK,QAAQ,gBACnGQ,EAAQ;;UAEV,KAAK,MACH,CAAI,oEAAoE,KAAK,MAAM,gBACnFA,EAAQ;;UAEV,KAAK,YACH,CAAI,0FAA0F,KAAK,YAAY,gBAC/GA,EAAQ;;UAEV,KAAK,WAAa,KAAK,UAAU,OAC/B,CAAI;;kBAEE,KAAK,UAAU,IACd,GAAO,CAAI;;;6BAGDC,EAAG,KAAK;;;;;;6DAMwBA,EAAG,MAAM;;mBAGtD,EAAE;;cAGND,EAAQ;;UAEV,KAAK,YAAc,KAAK,WAAW,OACjC,CAAI;;kBAEE,KAAK,WAAW,IACf,GAAM,CAAI;;;6BAGAE,EAAE,KAAK;;;;+BAILA,EAAE,MAAM;;wBAEfA,EAAE,KACA,CAAI,YAAYA,EAAE,KAAK,iFACvBF,EAAQ;8BACJE,EAAE,MAAM;;mBAGtB,EAAE;;cAGNF,EAAQ;;;;KAKlB,CACF,EA3EGP,EAAA,CAAAU,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAP,EAAA,UAAA,UAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAU,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAP,EAAA,UAAA,QAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAU,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAP,EAAA,UAAA,cAAA,IAAA,EAAA,EAEzBH,EAAA,CAAAU,EAAS,CAAE,KAAM,KAAM,CAAC,CAAA,EAAAP,EAAA,UAAA,YAAA,IAAA,EAAA,EAExBH,EAAA,CAAAU,EAAS,CAAE,KAAM,KAAM,CAAC,CAAA,EAAAP,EAAA,UAAA,aAAA,IAAA,EAAA,EAZ1B,EAAAH,EAAA,CAAAW,EAAc,oBAAoB,CAAA,EAAAR,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { LitElement, type PropertyValues } from "lit";
2
+ import { ObserverController } from "../shared/controller.observer.js";
2
3
  import "../../tokens/tokens.js";
3
4
  import "../icons/arrow-down-icon.js";
4
5
  import "../button/button.js";
@@ -44,7 +45,7 @@ declare class BdAnchorNav extends LitElement {
44
45
  _onStickyScroll: (() => void) | null;
45
46
  _restoreScrollBehavior: (() => void) | null;
46
47
  _indicatorReady: boolean;
47
- _indicatorResizeObserver: ResizeObserver | null;
48
+ _indicatorSize: ObserverController<ResizeObserver>;
48
49
  constructor();
49
50
  connectedCallback(): void;
50
51
  disconnectedCallback(): void;
@@ -1,18 +1,18 @@
1
- import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{matchesBelow as t}from"../shared/token-scales.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{ensembleCSS as r}from"../shared/ensemble.css.js";import"../icons/arrow-down-icon.js";import"../button/button.js";import{anchorNavStyles as i}from"./anchor-nav.css.js";import"../link/link.js";import{LitElement as a,html as o,nothing as s}from"lit";import{property as c,state as l}from"lit/decorators.js";function u(e){let t=(e||``).trim();if(!t)return 0;if(t.endsWith(`px`))return parseFloat(t);if(t.endsWith(`rem`)){let e=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;return parseFloat(t)*e}return parseFloat(t)||0}var d=(e,t)=>(e||``).replace(/^#/,``)||`anchor-${t}-section`,f=`10000%`,p=`popover`in HTMLElement.prototype&&CSS.supports(`anchor-name: --a`),m=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:`open`})}connectedCallback(){this.render()}render(){this.shadowRoot.innerHTML=`<slot></slot>`}};m=n([e(`bd-anchor-nav-item`)],m);var h=class extends a{static{this.styles=[r,i]}constructor(){super(),this.activeId=``,this.navLabel=`Section navigation`,this._dropdownOpen=!1,this._mobileCtaRevealed=!1,this.ctaLabel=`Buy now`,this.ctaHref=``,this.items=null,this.maxWidth=``,this.stickyTop=`0px`,this._panelId=`bd-anchor-nav-panel-${Math.random().toString(36).slice(2,11)}`,this._onDocumentPointerDown=this._onDocumentPointerDown.bind(this),this._onKeydown=this._onKeydown.bind(this),this._onSectionsCrossLine=this._onSectionsCrossLine.bind(this),this._onFirstSectionCross=this._onFirstSectionCross.bind(this),this._scheduleSpy=this._scheduleSpy.bind(this),this._spyFrame=0,this._spyObserver=null,this._ctaObserver=null,this._layoutObserver=null,this._sections=[],this._spyLine=0,this._spyViewport=0,this._passed=/* @__PURE__ */ new Map,this._firstSectionBehind=!1,this._programmaticScrollTargetId=null,this._unlockScrollSpyTimer=null,this._scrollEndUnlockHandler=null,this._onStickyScroll=null,this._restoreScrollBehavior=null,this._handleResize=this._handleResize.bind(this),this._indicatorReady=!1,this._indicatorResizeObserver=null}connectedCallback(){super.connectedCallback(),window.addEventListener(`resize`,this._handleResize),p||(document.addEventListener(`pointerdown`,this._onDocumentPointerDown,!0),document.addEventListener(`keydown`,this._onKeydown,!0)),this._initSticky(),this._layoutObserver=new ResizeObserver(this._scheduleSpy),this._layoutObserver.observe(this),this._layoutObserver.observe(document.documentElement)}disconnectedCallback(){super.disconnectedCallback(),this._cancelScrollSpyUnlock(),this._restoreScrollBehavior?.(),window.removeEventListener(`resize`,this._handleResize),document.removeEventListener(`pointerdown`,this._onDocumentPointerDown,!0),document.removeEventListener(`keydown`,this._onKeydown,!0),this._destroySticky(),this._indicatorResizeObserver?.disconnect(),this._unobserveSections()}willUpdate(e){super.willUpdate(e),!this.hasUpdated&&!this.activeId&&this._resolvedItems().length&&(this.activeId=`anchor-1`)}updated(e){if(super.updated(e),e.has(`stickyTop`)&&this.style.setProperty(`--sticky-top`,this.stickyTop||`0px`),(e.has(`stickyTop`)||e.has(`items`))&&this._scheduleSpy(),(e.has(`activeId`)||e.has(`items`))&&requestAnimationFrame(()=>this._updateIndicator(`updated`)),!e.has(`activeId`))return;let t=e.get(`activeId`);t!==void 0&&t!==``&&t!==this.activeId&&queueMicrotask(()=>this._playMobileDropdownLabelSwap())}firstUpdated(){requestAnimationFrame(()=>this._updateIndicator(`firstUpdated`));let e=this.renderRoot?.querySelector(`.anchor-links--desktop`);e&&(this._indicatorResizeObserver=new ResizeObserver(()=>{this._updateIndicator(`ResizeObserver`)}),this._indicatorResizeObserver.observe(e),this._indicatorResizeObserver.observe(this))}_updateIndicator(e){let t=this.renderRoot?.querySelector(`.anchor-indicator`),n=this.renderRoot?.querySelector(`.anchor-links--desktop .anchor-link[current]`);if(!t||!n)return;let r=t.offsetWidth,i=r?n.offsetWidth/r:0,a=this.renderRoot.querySelector(`.bd-anchor-nav__inner`),o=a&&parseFloat(getComputedStyle(a).paddingBottom)||0,s=n.offsetTop+n.offsetHeight+o,c=()=>{t.style.translate=`${n.offsetLeft}px ${s}px`,t.style.scale=`${i} 1`};this._indicatorReady?c():(t.style.transition=`none`,c(),t.offsetWidth,t.style.transition=``,this._indicatorReady=!0)}_handleResize(){this._updateIndicator(`windowResize`),this._scheduleSpy()}_initSticky(){this.style.setProperty(`--sticky-top`,this.stickyTop||`0px`),!CSS.supports(`container-type: scroll-state`)&&(this._onStickyScroll=()=>{let e=parseFloat(getComputedStyle(this).top)||0,t=Math.abs(this.getBoundingClientRect().top-e)<1;this.classList.toggle(`is-sticky`,t&&window.scrollY>0)},window.addEventListener(`scroll`,this._onStickyScroll,{passive:!0}),window.addEventListener(`resize`,this._onStickyScroll,{passive:!0}),requestAnimationFrame(()=>this._onStickyScroll?.()))}_destroySticky(){this._onStickyScroll&&=(window.removeEventListener(`scroll`,this._onStickyScroll),window.removeEventListener(`resize`,this._onStickyScroll),null),this.classList.remove(`is-sticky`)}_cancelScrollSpyUnlock(){this._unlockScrollSpyTimer!=null&&(clearTimeout(this._unlockScrollSpyTimer),this._unlockScrollSpyTimer=null),this._scrollEndUnlockHandler&&=(window.removeEventListener(`scrollend`,this._scrollEndUnlockHandler),null)}_scheduleScrollSpyUnlock(){this._cancelScrollSpyUnlock();let e=()=>{this._cancelScrollSpyUnlock(),this._restoreScrollBehavior?.(),this._programmaticScrollTargetId=null,this._runScrollSpy()};this._scrollEndUnlockHandler=e,window.addEventListener(`scrollend`,e,{passive:!0});let t=window.scrollY,n=()=>{if(window.scrollY===t)return e();t=window.scrollY,this._unlockScrollSpyTimer=window.setTimeout(n,250)};this._unlockScrollSpyTimer=window.setTimeout(n,250)}_onKeydown(e){e.key===`Escape`&&this._dropdownOpen&&(this._dropdownOpen=!1,this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot?.querySelector(`.bd-anchor-nav__dropdown-toggle`)?.focus()))}_onDocumentPointerDown(e){this._dropdownOpen&&(e.composedPath().includes(this)||(this._dropdownOpen=!1,this.requestUpdate()))}_scheduleSpy(){this._spyFrame||=requestAnimationFrame(()=>{this._spyFrame=0,this._observeSections()})}_observeSections(){let e=this._resolvedItems().map(({href:e},t)=>document.getElementById(d(e,t+1))),t=this._stickyOffsetPx(),n=t+2,r=document.documentElement.clientHeight;if(n===this._spyLine&&r===this._spyViewport&&e.length===this._sections.length&&e.every((e,t)=>e===this._sections[t]))return;for(let t of this._sections)t&&!e.includes(t)&&t.style.removeProperty(`scroll-margin-top`);for(let n of e)n?.style.setProperty(`scroll-margin-top`,`${t}px`);this._spyObserver?.disconnect(),this._ctaObserver?.disconnect(),this._spyObserver=this._ctaObserver=null,e[0]!==this._sections[0]&&(this._firstSectionBehind=!1),this._passed=new Map(e.filter(e=>this._passed.has(e)).map(e=>[e,this._passed.get(e)])),this._sections=e,this._spyLine=n,this._spyViewport=r;let i=e.filter(Boolean);i.length&&(this._spyObserver=new IntersectionObserver(this._onSectionsCrossLine,{root:document,rootMargin:`${f} 0px ${n-r}px 0px`}),i.forEach(e=>this._spyObserver.observe(e))),e[0]&&(this._ctaObserver=new IntersectionObserver(this._onFirstSectionCross,{root:document,rootMargin:`0px 0px ${f} 0px`}),this._ctaObserver.observe(e[0])),this._runScrollSpy()}_unobserveSections(){cancelAnimationFrame(this._spyFrame),this._spyFrame=0,this._layoutObserver?.disconnect(),this._spyObserver?.disconnect(),this._ctaObserver?.disconnect(),this._layoutObserver=this._spyObserver=this._ctaObserver=null;for(let e of this._sections)e?.style.removeProperty(`scroll-margin-top`);this._sections=[],this._passed=/* @__PURE__ */ new Map}_onSectionsCrossLine(e){for(let{target:t,boundingClientRect:n,rootBounds:r}of e)this._passed.set(t,n.top<=r.bottom);this._runScrollSpy()}_onFirstSectionCross(e){let{boundingClientRect:t,rootBounds:n}=e[e.length-1];this._firstSectionBehind=t.bottom<=n.top,this._runScrollSpy()}_resolvedItems(){return this.items&&this.items.length?this.items.map((e,t)=>({title:e.title,href:e.href||`#anchor-${t+1}-section`,id:`anchor-${t+1}`})):Array.from(this.children).filter(e=>e.tagName===`BD-ANCHOR-NAV-ITEM`).map((e,t)=>({title:e.getAttribute(`title`),href:e.getAttribute(`href`)||`#anchor-${t+1}-section`,id:`anchor-${t+1}`}))}_runScrollSpy(){let e=this.activeId;this._sections.length&&!this._programmaticScrollTargetId&&(e=`anchor-1`,this._sections.forEach((t,n)=>{t&&this._passed.get(t)&&(e=`anchor-${n+1}`)})),this.activeId=e,this._mobileCtaRevealed=!this._sections[0]||this._firstSectionBehind}_playMobileDropdownLabelSwap(){if(typeof window>`u`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||!t(`md`))return;let e=this.renderRoot?.querySelector(`.bd-anchor-nav__dropdown-label`);e&&(e.classList.remove(`bd-anchor-nav__dropdown-label--swap`),e.offsetWidth,e.classList.add(`bd-anchor-nav__dropdown-label--swap`),e.addEventListener(`animationend`,()=>e.classList.remove(`bd-anchor-nav__dropdown-label--swap`),{once:!0}))}_stickyOffsetPx(){let e=this.offsetHeight,t=parseFloat(getComputedStyle(this).top)||0,n=u(getComputedStyle(this).getPropertyValue(`--spacing-8`).trim())||8;return e>0?e+n+t:u(getComputedStyle(this).getPropertyValue(`--spacing-128`).trim())||128}handleClick(e,t,n){if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;this._cancelScrollSpyUnlock(),this._programmaticScrollTargetId=null,this.activeId=t;let r=d(n,t.replace(/^anchor-/,``));document.getElementById(r)&&(this._programmaticScrollTargetId=t,this._smoothFragmentScroll(),this._scheduleScrollSpyUnlock())}_smoothFragmentScroll(){if(this._restoreScrollBehavior||!window.matchMedia(`(prefers-reduced-motion: no-preference)`).matches)return;let e=document.documentElement,t=e.style.scrollBehavior;e.style.scrollBehavior=`smooth`,this._restoreScrollBehavior=()=>{e.style.scrollBehavior=t,this._restoreScrollBehavior=null}}_toggleDropdown(e){p||(e.preventDefault(),e.stopPropagation(),this._dropdownOpen=!this._dropdownOpen)}_onPanelToggle(e){this._dropdownOpen=e.newState===`open`}_selectFromDropdown(e,t,n){if(p){let e=this.renderRoot.querySelector(`.bd-anchor-nav__dropdown-panel`);e?.matches(`:popover-open`)&&e.hidePopover()}else this._dropdownOpen=!1;this.handleClick(e,t,n)}_activeLabel(e){let t=/^anchor-(\d+)$/.exec(this.activeId||``),n=t?parseInt(t[1],10):1;return e[Math.min(Math.max(n-1,0),Math.max(0,e.length-1))]?.title||e[0]?.title||`Section`}render(){let e=this._resolvedItems(),t=this._activeLabel(e),n=t=>o`
1
+ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import{matchesBelow as t}from"../shared/token-scales.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import{ensembleCSS as r}from"../shared/ensemble.css.js";import"../icons/arrow-down-icon.js";import"../button/button.js";import{anchorNavStyles as i}from"./anchor-nav.css.js";import{ObserverController as a}from"../shared/controller.observer.js";import"../link/link.js";import{LitElement as o,html as s,nothing as c}from"lit";import{property as l,state as u}from"lit/decorators.js";function d(e){let t=(e||``).trim();if(!t)return 0;if(t.endsWith(`px`))return parseFloat(t);if(t.endsWith(`rem`)){let e=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;return parseFloat(t)*e}return parseFloat(t)||0}var f=(e,t)=>(e||``).replace(/^#/,``)||`anchor-${t}-section`,p=`10000%`,m=`popover`in HTMLElement.prototype&&CSS.supports(`anchor-name: --a`),h=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:`open`})}connectedCallback(){this.render()}render(){this.shadowRoot.innerHTML=`<slot></slot>`}};h=n([e(`bd-anchor-nav-item`)],h);var g=class extends o{static{this.styles=[r,i]}constructor(){super(),this.activeId=``,this.navLabel=`Section navigation`,this._dropdownOpen=!1,this._mobileCtaRevealed=!1,this.ctaLabel=`Buy now`,this.ctaHref=``,this.items=null,this.maxWidth=``,this.stickyTop=`0px`,this._indicatorSize=new a(this,()=>new ResizeObserver(()=>this._updateIndicator(`ResizeObserver`)),e=>{let t=this.renderRoot.querySelector(`.anchor-links--desktop`);t&&(e.observe(t),e.observe(this))}),this._panelId=`bd-anchor-nav-panel-${Math.random().toString(36).slice(2,11)}`,this._onDocumentPointerDown=this._onDocumentPointerDown.bind(this),this._onKeydown=this._onKeydown.bind(this),this._onSectionsCrossLine=this._onSectionsCrossLine.bind(this),this._onFirstSectionCross=this._onFirstSectionCross.bind(this),this._scheduleSpy=this._scheduleSpy.bind(this),this._spyFrame=0,this._spyObserver=null,this._ctaObserver=null,this._layoutObserver=null,this._sections=[],this._spyLine=0,this._spyViewport=0,this._passed=/* @__PURE__ */ new Map,this._firstSectionBehind=!1,this._programmaticScrollTargetId=null,this._unlockScrollSpyTimer=null,this._scrollEndUnlockHandler=null,this._onStickyScroll=null,this._restoreScrollBehavior=null,this._handleResize=this._handleResize.bind(this),this._indicatorReady=!1}connectedCallback(){super.connectedCallback(),window.addEventListener(`resize`,this._handleResize),m||(document.addEventListener(`pointerdown`,this._onDocumentPointerDown,!0),document.addEventListener(`keydown`,this._onKeydown,!0)),this._initSticky(),this._layoutObserver=new ResizeObserver(this._scheduleSpy),this._layoutObserver.observe(this),this._layoutObserver.observe(document.documentElement)}disconnectedCallback(){super.disconnectedCallback(),this._cancelScrollSpyUnlock(),this._restoreScrollBehavior?.(),window.removeEventListener(`resize`,this._handleResize),document.removeEventListener(`pointerdown`,this._onDocumentPointerDown,!0),document.removeEventListener(`keydown`,this._onKeydown,!0),this._destroySticky(),this._unobserveSections()}willUpdate(e){super.willUpdate(e),!this.hasUpdated&&!this.activeId&&this._resolvedItems().length&&(this.activeId=`anchor-1`)}updated(e){if(super.updated(e),e.has(`stickyTop`)&&this.style.setProperty(`--sticky-top`,this.stickyTop||`0px`),(e.has(`stickyTop`)||e.has(`items`))&&this._scheduleSpy(),(e.has(`activeId`)||e.has(`items`))&&requestAnimationFrame(()=>this._updateIndicator(`updated`)),!e.has(`activeId`))return;let t=e.get(`activeId`);t!==void 0&&t!==``&&t!==this.activeId&&queueMicrotask(()=>this._playMobileDropdownLabelSwap())}firstUpdated(){requestAnimationFrame(()=>this._updateIndicator(`firstUpdated`))}_updateIndicator(e){let t=this.renderRoot?.querySelector(`.anchor-indicator`),n=this.renderRoot?.querySelector(`.anchor-links--desktop .anchor-link[current]`);if(!t||!n)return;let r=t.offsetWidth,i=r?n.offsetWidth/r:0,a=this.renderRoot.querySelector(`.bd-anchor-nav__inner`),o=a&&parseFloat(getComputedStyle(a).paddingBottom)||0,s=n.offsetTop+n.offsetHeight+o,c=()=>{t.style.translate=`${n.offsetLeft}px ${s}px`,t.style.scale=`${i} 1`};this._indicatorReady?c():(t.style.transition=`none`,c(),t.offsetWidth,t.style.transition=``,this._indicatorReady=!0)}_handleResize(){this._updateIndicator(`windowResize`),this._scheduleSpy()}_initSticky(){this.style.setProperty(`--sticky-top`,this.stickyTop||`0px`),!CSS.supports(`container-type: scroll-state`)&&(this._onStickyScroll=()=>{let e=parseFloat(getComputedStyle(this).top)||0,t=Math.abs(this.getBoundingClientRect().top-e)<1;this.classList.toggle(`is-sticky`,t&&window.scrollY>0)},window.addEventListener(`scroll`,this._onStickyScroll,{passive:!0}),window.addEventListener(`resize`,this._onStickyScroll,{passive:!0}),requestAnimationFrame(()=>this._onStickyScroll?.()))}_destroySticky(){this._onStickyScroll&&=(window.removeEventListener(`scroll`,this._onStickyScroll),window.removeEventListener(`resize`,this._onStickyScroll),null),this.classList.remove(`is-sticky`)}_cancelScrollSpyUnlock(){this._unlockScrollSpyTimer!=null&&(clearTimeout(this._unlockScrollSpyTimer),this._unlockScrollSpyTimer=null),this._scrollEndUnlockHandler&&=(window.removeEventListener(`scrollend`,this._scrollEndUnlockHandler),null)}_scheduleScrollSpyUnlock(){this._cancelScrollSpyUnlock();let e=()=>{this._cancelScrollSpyUnlock(),this._restoreScrollBehavior?.(),this._programmaticScrollTargetId=null,this._runScrollSpy()};this._scrollEndUnlockHandler=e,window.addEventListener(`scrollend`,e,{passive:!0});let t=window.scrollY,n=()=>{if(window.scrollY===t)return e();t=window.scrollY,this._unlockScrollSpyTimer=window.setTimeout(n,250)};this._unlockScrollSpyTimer=window.setTimeout(n,250)}_onKeydown(e){e.key===`Escape`&&this._dropdownOpen&&(this._dropdownOpen=!1,this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot?.querySelector(`.bd-anchor-nav__dropdown-toggle`)?.focus()))}_onDocumentPointerDown(e){this._dropdownOpen&&(e.composedPath().includes(this)||(this._dropdownOpen=!1,this.requestUpdate()))}_scheduleSpy(){this._spyFrame||=requestAnimationFrame(()=>{this._spyFrame=0,this._observeSections()})}_observeSections(){let e=this._resolvedItems().map(({href:e},t)=>document.getElementById(f(e,t+1))),t=this._stickyOffsetPx(),n=t+2,r=document.documentElement.clientHeight;if(n===this._spyLine&&r===this._spyViewport&&e.length===this._sections.length&&e.every((e,t)=>e===this._sections[t]))return;for(let t of this._sections)t&&!e.includes(t)&&t.style.removeProperty(`scroll-margin-top`);for(let n of e)n?.style.setProperty(`scroll-margin-top`,`${t}px`);this._spyObserver?.disconnect(),this._ctaObserver?.disconnect(),this._spyObserver=this._ctaObserver=null,e[0]!==this._sections[0]&&(this._firstSectionBehind=!1),this._passed=new Map(e.filter(e=>this._passed.has(e)).map(e=>[e,this._passed.get(e)])),this._sections=e,this._spyLine=n,this._spyViewport=r;let i=e.filter(Boolean);i.length&&(this._spyObserver=new IntersectionObserver(this._onSectionsCrossLine,{root:document,rootMargin:`${p} 0px ${n-r}px 0px`}),i.forEach(e=>this._spyObserver.observe(e))),e[0]&&(this._ctaObserver=new IntersectionObserver(this._onFirstSectionCross,{root:document,rootMargin:`0px 0px ${p} 0px`}),this._ctaObserver.observe(e[0])),this._runScrollSpy()}_unobserveSections(){cancelAnimationFrame(this._spyFrame),this._spyFrame=0,this._layoutObserver?.disconnect(),this._spyObserver?.disconnect(),this._ctaObserver?.disconnect(),this._layoutObserver=this._spyObserver=this._ctaObserver=null;for(let e of this._sections)e?.style.removeProperty(`scroll-margin-top`);this._sections=[],this._passed=/* @__PURE__ */ new Map}_onSectionsCrossLine(e){for(let{target:t,boundingClientRect:n,rootBounds:r}of e)this._passed.set(t,n.top<=r.bottom);this._runScrollSpy()}_onFirstSectionCross(e){let{boundingClientRect:t,rootBounds:n}=e[e.length-1];this._firstSectionBehind=t.bottom<=n.top,this._runScrollSpy()}_resolvedItems(){return this.items&&this.items.length?this.items.map((e,t)=>({title:e.title,href:e.href||`#anchor-${t+1}-section`,id:`anchor-${t+1}`})):Array.from(this.children).filter(e=>e.tagName===`BD-ANCHOR-NAV-ITEM`).map((e,t)=>({title:e.getAttribute(`title`),href:e.getAttribute(`href`)||`#anchor-${t+1}-section`,id:`anchor-${t+1}`}))}_runScrollSpy(){let e=this.activeId;this._sections.length&&!this._programmaticScrollTargetId&&(e=`anchor-1`,this._sections.forEach((t,n)=>{t&&this._passed.get(t)&&(e=`anchor-${n+1}`)})),this.activeId=e,this._mobileCtaRevealed=!this._sections[0]||this._firstSectionBehind}_playMobileDropdownLabelSwap(){if(typeof window>`u`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||!t(`md`))return;let e=this.renderRoot?.querySelector(`.bd-anchor-nav__dropdown-label`);e&&(e.classList.remove(`bd-anchor-nav__dropdown-label--swap`),e.offsetWidth,e.classList.add(`bd-anchor-nav__dropdown-label--swap`),e.addEventListener(`animationend`,()=>e.classList.remove(`bd-anchor-nav__dropdown-label--swap`),{once:!0}))}_stickyOffsetPx(){let e=this.offsetHeight,t=parseFloat(getComputedStyle(this).top)||0,n=d(getComputedStyle(this).getPropertyValue(`--spacing-8`).trim())||8;return e>0?e+n+t:d(getComputedStyle(this).getPropertyValue(`--spacing-128`).trim())||128}handleClick(e,t,n){if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;this._cancelScrollSpyUnlock(),this._programmaticScrollTargetId=null,this.activeId=t;let r=f(n,t.replace(/^anchor-/,``));document.getElementById(r)&&(this._programmaticScrollTargetId=t,this._smoothFragmentScroll(),this._scheduleScrollSpyUnlock())}_smoothFragmentScroll(){if(this._restoreScrollBehavior||!window.matchMedia(`(prefers-reduced-motion: no-preference)`).matches)return;let e=document.documentElement,t=e.style.scrollBehavior;e.style.scrollBehavior=`smooth`,this._restoreScrollBehavior=()=>{e.style.scrollBehavior=t,this._restoreScrollBehavior=null}}_toggleDropdown(e){m||(e.preventDefault(),e.stopPropagation(),this._dropdownOpen=!this._dropdownOpen)}_onPanelToggle(e){this._dropdownOpen=e.newState===`open`}_selectFromDropdown(e,t,n){if(m){let e=this.renderRoot.querySelector(`.bd-anchor-nav__dropdown-panel`);e?.matches(`:popover-open`)&&e.hidePopover()}else this._dropdownOpen=!1;this.handleClick(e,t,n)}_activeLabel(e){let t=/^anchor-(\d+)$/.exec(this.activeId||``),n=t?parseInt(t[1],10):1;return e[Math.min(Math.max(n-1,0),Math.max(0,e.length-1))]?.title||e[0]?.title||`Section`}render(){let e=this._resolvedItems(),t=this._activeLabel(e),n=t=>s`
2
2
  <div class="${t}">
3
- ${e.map(({id:e,title:t,href:n})=>{let r=this.activeId===e;return o`
3
+ ${e.map(({id:e,title:t,href:n})=>{let r=this.activeId===e;return s`
4
4
  <bd-link
5
5
  href="${n}"
6
6
  variant="primary"
7
7
  no-underline
8
8
  class="anchor-link"
9
- current=${r?`location`:s}
9
+ current=${r?`location`:c}
10
10
  @click=${t=>this.handleClick(t,e,n)}
11
11
  >${t}</bd-link>
12
12
  `})}
13
13
  <span class="anchor-indicator" aria-hidden="true"></span>
14
14
  </div>
15
- `,r=this.maxWidth?`max-width: ${this.maxWidth};`:``;return o`
15
+ `,r=this.maxWidth?`max-width: ${this.maxWidth};`:``;return s`
16
16
  <nav aria-label=${this.navLabel}>
17
17
  <div
18
18
  class="bd-ensemble bd-anchor-nav__inner"
@@ -28,7 +28,7 @@ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/
28
28
  class="bd-anchor-nav__dropdown-toggle"
29
29
  aria-expanded=${this._dropdownOpen?`true`:`false`}
30
30
  aria-controls=${this._panelId}
31
- popovertarget=${p?this._panelId:s}
31
+ popovertarget=${m?this._panelId:c}
32
32
  @click=${this._toggleDropdown}
33
33
  >
34
34
  <span class="bd-anchor-nav__dropdown-label">${t}</span>
@@ -39,17 +39,17 @@ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/
39
39
  <div
40
40
  class="bd-anchor-nav__dropdown-panel"
41
41
  id=${this._panelId}
42
- popover=${p?`auto`:s}
43
- ?hidden=${!p&&!this._dropdownOpen}
42
+ popover=${m?`auto`:c}
43
+ ?hidden=${!m&&!this._dropdownOpen}
44
44
  @toggle=${this._onPanelToggle}
45
45
  >
46
46
  <ul class="bd-anchor-nav__dropdown-list">
47
- ${e.map(({id:e,title:t,href:n})=>{let r=this.activeId===e;return o`
47
+ ${e.map(({id:e,title:t,href:n})=>{let r=this.activeId===e;return s`
48
48
  <li>
49
49
  <a
50
50
  href="${n}"
51
51
  class="bd-anchor-nav__dropdown-option"
52
- aria-current=${r?`location`:s}
52
+ aria-current=${r?`location`:c}
53
53
  @click=${t=>this._selectFromDropdown(t,e,n)}
54
54
  >${t}</a>
55
55
  </li>
@@ -63,5 +63,5 @@ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/
63
63
  </div>
64
64
  </div>
65
65
  </nav>
66
- `}};n([l()],h.prototype,`activeId`,void 0),n([c({type:String,attribute:`aria-label`})],h.prototype,`navLabel`,void 0),n([l()],h.prototype,`_dropdownOpen`,void 0),n([l()],h.prototype,`_mobileCtaRevealed`,void 0),n([c({type:String,attribute:`cta-label`})],h.prototype,`ctaLabel`,void 0),n([c({type:String,attribute:`cta-href`})],h.prototype,`ctaHref`,void 0),n([c({type:Array})],h.prototype,`items`,void 0),n([c({type:String,attribute:`max-width`})],h.prototype,`maxWidth`,void 0),n([c({type:String,attribute:`sticky-top`})],h.prototype,`stickyTop`,void 0),h=n([e(`bd-anchor-nav`)],h);
66
+ `}};n([u()],g.prototype,`activeId`,void 0),n([l({type:String,attribute:`aria-label`})],g.prototype,`navLabel`,void 0),n([u()],g.prototype,`_dropdownOpen`,void 0),n([u()],g.prototype,`_mobileCtaRevealed`,void 0),n([l({type:String,attribute:`cta-label`})],g.prototype,`ctaLabel`,void 0),n([l({type:String,attribute:`cta-href`})],g.prototype,`ctaHref`,void 0),n([l({type:Array})],g.prototype,`items`,void 0),n([l({type:String,attribute:`max-width`})],g.prototype,`maxWidth`,void 0),n([l({type:String,attribute:`sticky-top`})],g.prototype,`stickyTop`,void 0),g=n([e(`bd-anchor-nav`)],g);
67
67
  //# sourceMappingURL=anchor-nav.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"anchor-nav.js","names":["_decorate","__decorate","parseLengthToPx","s","value","root","sectionIdOf","href","n","FAR","NATIVE_POPOVER","BdAnchorNavItem","defineElement","BdAnchorNav","LitElement","ensembleCSS","anchorNavStyles","changedProperties","prev","links","indicator","activeLink","row","scale","inner","gap","top","place","atTop","unlock","lastY","unlockOnceStill","sections","i","offset","line","viewport","el","found","entries","target","boundingClientRect","rootBounds","item","next","matchesBelow","barPx","stickyTopPx","insetPx","event","id","sectionId","before","panel","m","resolved","dropdownLabel","linkRow","cls","isActive","nothing","e","title","innerStyle","state","property"],"sources":["../../../../src/components/anchor/anchor-nav.ts"],"sourcesContent":["import { LitElement, html, nothing, type PropertyValues } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/icons/arrow-down-icon.ts\";\nimport \"#components/button/button.ts\";\nimport \"#components/link/link.ts\";\nimport { anchorNavStyles } from \"./anchor-nav.css.ts\";\nimport { ensembleCSS } from \"#shared/ensemble.css.ts\";\nimport { matchesBelow } from \"#shared/token-scales.ts\";\n\nfunction parseLengthToPx(value: string) {\n const s = (value || \"\").trim();\n if (!s) return 0;\n if (s.endsWith(\"px\")) return parseFloat(s);\n if (s.endsWith(\"rem\")) {\n const root = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n return parseFloat(s) * root;\n }\n return parseFloat(s) || 0;\n}\n\nconst sectionIdOf = (href: string, n: number | string) => (href || \"\").replace(/^#/, \"\") || `anchor-${n}-section`;\n\n/* \"The rest of the page\" as a root margin: a hundred viewports. Each observer\n below watches one edge, and a jump only registers if it carries a section\n across that edge while still inside the root -- so the root reaches this far\n past the edge, beyond any jump a real page makes. */\nconst FAR = \"10000%\";\n\n/* The dropdown panel is a popover only where it can also be anchored to its\n toggle: in the top layer it leaves the toggle's box, and without anchor\n positioning it would sit in the middle of the viewport. Both are newer than\n the Widely available target, so elsewhere the panel keeps its z-index and\n the document listeners close it. */\nconst NATIVE_POPOVER = \"popover\" in HTMLElement.prototype && CSS.supports(\"anchor-name: --a\");\n\ninterface AnchorNavItem {\n title: string;\n href?: string;\n}\n\ninterface ResolvedItem {\n title: string | null;\n href : string;\n id : string;\n}\n\n@defineElement(\"bd-anchor-nav-item\")\nclass BdAnchorNavItem extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: \"open\" });\n }\n connectedCallback() { this.render(); }\n render() { this.shadowRoot!.innerHTML = `<slot></slot>`; }\n}\n\n@defineElement(\"bd-anchor-nav\")\nclass BdAnchorNav extends LitElement {\n static styles = [ensembleCSS, anchorNavStyles];\n\n @state()\n activeId = \"\";\n @property({ type: String, attribute: \"aria-label\" })\n navLabel = \"Section navigation\";\n @state()\n _dropdownOpen = false;\n @state()\n _mobileCtaRevealed = false;\n @property({ type: String, attribute: \"cta-label\" })\n ctaLabel = \"Buy now\";\n @property({ type: String, attribute: \"cta-href\" })\n ctaHref = \"\";\n @property({ type: Array })\n items: AnchorNavItem[] | null = null;\n @property({ type: String, attribute: \"max-width\" })\n maxWidth = \"\";\n @property({ type: String, attribute: \"sticky-top\" })\n stickyTop = \"0px\";\n\n _panelId : string;\n _spyFrame : number;\n _spyObserver : IntersectionObserver | null;\n _ctaObserver : IntersectionObserver | null;\n _layoutObserver : ResizeObserver | null;\n _sections : (HTMLElement | null)[];\n _spyLine : number;\n _spyViewport : number;\n _passed : Map<Element | null, boolean | undefined>;\n _firstSectionBehind : boolean;\n _programmaticScrollTargetId: string | null;\n _unlockScrollSpyTimer : number | null;\n _scrollEndUnlockHandler : (() => void) | null;\n _onStickyScroll : (() => void) | null;\n _restoreScrollBehavior : (() => void) | null;\n _indicatorReady : boolean;\n _indicatorResizeObserver : ResizeObserver | null;\n\n constructor() {\n super();\n this._panelId = `bd-anchor-nav-panel-${Math.random().toString(36)\n .slice(2, 11)}`;\n this._onDocumentPointerDown = this._onDocumentPointerDown.bind(this);\n this._onKeydown = this._onKeydown.bind(this);\n this._onSectionsCrossLine = this._onSectionsCrossLine.bind(this);\n this._onFirstSectionCross = this._onFirstSectionCross.bind(this);\n this._scheduleSpy = this._scheduleSpy.bind(this);\n this._spyFrame = 0;\n this._spyObserver = null;\n this._ctaObserver = null;\n this._layoutObserver = null;\n this._sections = [];\n this._spyLine = 0;\n this._spyViewport = 0;\n this._passed = new Map();\n this._firstSectionBehind = false;\n this._programmaticScrollTargetId = null;\n this._unlockScrollSpyTimer = null;\n this._scrollEndUnlockHandler = null;\n this._onStickyScroll = null;\n this._restoreScrollBehavior = null;\n this._handleResize = this._handleResize.bind(this);\n this._indicatorReady = false;\n this._indicatorResizeObserver = null;\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this._handleResize);\n if (!NATIVE_POPOVER) {\n document.addEventListener(\"pointerdown\", this._onDocumentPointerDown, true);\n document.addEventListener(\"keydown\", this._onKeydown, true);\n }\n this._initSticky();\n /* The bar's height moves the line the sections are read against, and the\n page growing may bring a section that was not there yet. */\n this._layoutObserver = new ResizeObserver(this._scheduleSpy);\n this._layoutObserver.observe(this);\n this._layoutObserver.observe(document.documentElement);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this._cancelScrollSpyUnlock();\n this._restoreScrollBehavior?.();\n window.removeEventListener(\"resize\", this._handleResize);\n document.removeEventListener(\"pointerdown\", this._onDocumentPointerDown, true);\n document.removeEventListener(\"keydown\", this._onKeydown, true);\n this._destroySticky();\n this._indicatorResizeObserver?.disconnect();\n this._unobserveSections();\n }\n\n /* The first item is active before the first render, not after it: state set\n in firstUpdated or updated starts a second render, the one Lit warns about\n as change-in-update. */\n willUpdate(changedProperties: PropertyValues<this>) {\n super.willUpdate(changedProperties);\n if (!this.hasUpdated && !this.activeId && this._resolvedItems().length) this.activeId = \"anchor-1\";\n }\n\n updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (changedProperties.has(\"stickyTop\")) {\n this.style.setProperty(\"--sticky-top\", this.stickyTop || \"0px\");\n }\n\n if (changedProperties.has(\"stickyTop\") || changedProperties.has(\"items\")) {\n this._scheduleSpy();\n }\n\n if (changedProperties.has(\"activeId\") || changedProperties.has(\"items\")) {\n requestAnimationFrame(() => this._updateIndicator(\"updated\"));\n }\n\n if (!changedProperties.has(\"activeId\")) return;\n const prev = changedProperties.get(\"activeId\");\n if (prev === undefined || prev === \"\") return;\n if (prev === this.activeId) return;\n queueMicrotask(() => this._playMobileDropdownLabelSwap());\n }\n\n firstUpdated() {\n requestAnimationFrame(() => this._updateIndicator(\"firstUpdated\"));\n\n const links = this.renderRoot?.querySelector(\".anchor-links--desktop\");\n if (links) {\n this._indicatorResizeObserver = new ResizeObserver(() => {\n this._updateIndicator(\"ResizeObserver\");\n });\n this._indicatorResizeObserver.observe(links);\n this._indicatorResizeObserver.observe(this);\n }\n }\n\n /* The indicator spans the link row and is moved and sized on the\n compositor: translate to the current link's corner, scale to its width.\n It used to animate top and width, which laid the bar out again on every\n frame of the slide. The offsets are physical -- offsetLeft is -- so the\n indicator is anchored at the row's physical left, on a right-to-left\n page too. */\n _updateIndicator(_caller?: string) {\n const indicator = this.renderRoot?.querySelector<HTMLElement>(\".anchor-indicator\");\n const activeLink = this.renderRoot?.querySelector<HTMLElement>(\n \".anchor-links--desktop .anchor-link[current]\"\n );\n if (!indicator || !activeLink) return;\n\n const row = indicator.offsetWidth;\n const scale = row ? activeLink.offsetWidth / row : 0;\n // The bar's bottom edge is the inner's padding-bottom below the link.\n const inner = this.renderRoot.querySelector(\".bd-anchor-nav__inner\");\n const gap = inner ? parseFloat(getComputedStyle(inner).paddingBottom) || 0 : 0;\n const top = activeLink.offsetTop + activeLink.offsetHeight + gap;\n\n const place = () => {\n indicator.style.translate = `${activeLink.offsetLeft}px ${top}px`;\n indicator.style.scale = `${scale} 1`;\n };\n\n if (!this._indicatorReady) {\n indicator.style.transition = \"none\";\n place();\n void indicator.offsetWidth;\n indicator.style.transition = \"\";\n this._indicatorReady = true;\n return;\n }\n\n place();\n }\n\n _handleResize() {\n this._updateIndicator(\"windowResize\");\n // The viewport's height places the spy's line inside its root.\n this._scheduleSpy();\n }\n\n /* The bar sticks with position: sticky, which keeps its own place in the\n flow and lets go at the end of its parent, so nothing here positions it.\n It used to: past its top it switched to position: fixed at the\n viewport's width, measured its parent to know when to let go, and left a\n placeholder behind to hold its space.\n\n While stuck it draws a shadow. A scroll-state container query says when\n that is, and it is newer than the Widely available target; where it is\n missing, this tells instead: the bar sits at its sticky top -- read as\n the browser resolved it, as _stickyOffsetPx() reads it, so calc(), em\n and custom properties count -- and the page has scrolled. A bar that\n merely rests at that line on an unscrolled page is not stuck, as the\n query would not call it. */\n _initSticky() {\n this.style.setProperty(\"--sticky-top\", this.stickyTop || \"0px\");\n if (CSS.supports(\"container-type: scroll-state\")) return;\n\n this._onStickyScroll = () => {\n const top = parseFloat(getComputedStyle(this).top) || 0;\n const atTop = Math.abs(this.getBoundingClientRect().top - top) < 1;\n this.classList.toggle(\"is-sticky\", atTop && window.scrollY > 0);\n };\n window.addEventListener(\"scroll\", this._onStickyScroll, { passive: true });\n window.addEventListener(\"resize\", this._onStickyScroll, { passive: true });\n /* Removed within a frame of connecting, the bar has torn this down. */\n requestAnimationFrame(() => this._onStickyScroll?.());\n }\n\n _destroySticky() {\n if (this._onStickyScroll) {\n window.removeEventListener(\"scroll\", this._onStickyScroll);\n window.removeEventListener(\"resize\", this._onStickyScroll);\n this._onStickyScroll = null;\n }\n this.classList.remove(\"is-sticky\");\n }\n\n _cancelScrollSpyUnlock() {\n if (this._unlockScrollSpyTimer != null) {\n clearTimeout(this._unlockScrollSpyTimer);\n this._unlockScrollSpyTimer = null;\n }\n if (this._scrollEndUnlockHandler) {\n window.removeEventListener(\"scrollend\", this._scrollEndUnlockHandler);\n this._scrollEndUnlockHandler = null;\n }\n }\n\n /* The click's item stays active until the scroll is over. scrollend says so\n where the browser has it. The timer is for a click that scrolls nothing,\n which no scrollend follows, and for browsers without the event: it ends\n the lock once the page has stopped moving. It used to end it after a\n fixed second, and a long smooth scroll outlasts that -- measured 1.3s\n from the first section to the third on the playground at 1280, with the\n second item lit for the last 250ms of it. */\n _scheduleScrollSpyUnlock() {\n this._cancelScrollSpyUnlock();\n const unlock = () => {\n this._cancelScrollSpyUnlock();\n this._restoreScrollBehavior?.();\n this._programmaticScrollTargetId = null;\n this._runScrollSpy();\n };\n this._scrollEndUnlockHandler = unlock;\n window.addEventListener(\"scrollend\", unlock, { passive: true });\n let lastY = window.scrollY;\n const unlockOnceStill = () => {\n if (window.scrollY === lastY) return unlock();\n lastY = window.scrollY;\n this._unlockScrollSpyTimer = window.setTimeout(unlockOnceStill, 250);\n };\n this._unlockScrollSpyTimer = window.setTimeout(unlockOnceStill, 250);\n }\n\n _onKeydown(e: KeyboardEvent) {\n if (e.key === \"Escape\" && this._dropdownOpen) {\n this._dropdownOpen = false;\n this.requestUpdate();\n this.updateComplete.then(() =>\n this.renderRoot?.querySelector<HTMLButtonElement>(\".bd-anchor-nav__dropdown-toggle\")?.focus());\n }\n }\n\n _onDocumentPointerDown(e: PointerEvent) {\n if (!this._dropdownOpen) return;\n const path = e.composedPath();\n if (path.includes(this)) return;\n this._dropdownOpen = false;\n this.requestUpdate();\n }\n\n _scheduleSpy() {\n if (this._spyFrame) return;\n this._spyFrame = requestAnimationFrame(() => {\n this._spyFrame = 0;\n this._observeSections();\n });\n }\n\n /* Scroll-spy, without reading the page on every scroll. The active item is\n the last section whose top has reached a line just under the stuck bar,\n and two IntersectionObservers say when an edge crosses:\n\n - the spy's root ends at that line and reaches FAR above it, so a section\n is inside it exactly while its top is past the line;\n - the CTA's root starts at the top of the viewport and reaches FAR below,\n so the first section leaves it exactly when its bottom scrolls off.\n\n Each entry carries the target's box, so the callbacks read nothing. The\n line depends on the bar's height, the sticky top and the viewport, and a\n root margin cannot change, so the observers are rebuilt when one moves. */\n _observeSections() {\n const sections = this._resolvedItems()\n .map(({ href }, i) => document.getElementById(sectionIdOf(href, i + 1)));\n const offset = this._stickyOffsetPx();\n // 2px under where a click leaves the section, so a section the bar has just\n // scrolled to counts as reached.\n const line = offset + 2;\n const viewport = document.documentElement.clientHeight;\n\n if (line === this._spyLine && viewport === this._spyViewport &&\n sections.length === this._sections.length &&\n sections.every((el, i) => el === this._sections[i])) return;\n\n /* A section a click scrolls to stops under the bar, not behind it, and so\n does one the URL's hash or the back button brings into view. */\n for (const el of this._sections) {\n if (el && !sections.includes(el)) el.style.removeProperty(\"scroll-margin-top\");\n }\n for (const el of sections) el?.style.setProperty(\"scroll-margin-top\", `${offset}px`);\n\n this._spyObserver?.disconnect();\n this._ctaObserver?.disconnect();\n this._spyObserver = this._ctaObserver = null;\n if (sections[0] !== this._sections[0]) this._firstSectionBehind = false;\n this._passed = new Map(sections.filter((el) => this._passed.has(el))\n .map((el) => [el, this._passed.get(el)]));\n this._sections = sections;\n this._spyLine = line;\n this._spyViewport = viewport;\n\n const found = sections.filter(Boolean) as HTMLElement[];\n if (found.length) {\n this._spyObserver = new IntersectionObserver(this._onSectionsCrossLine, {\n root : document,\n rootMargin: `${FAR} 0px ${line - viewport}px 0px`\n });\n found.forEach((el) => this._spyObserver!.observe(el));\n }\n if (sections[0]) {\n this._ctaObserver = new IntersectionObserver(this._onFirstSectionCross, {\n root : document,\n rootMargin: `0px 0px ${FAR} 0px`\n });\n this._ctaObserver.observe(sections[0]);\n }\n this._runScrollSpy();\n }\n\n _unobserveSections() {\n cancelAnimationFrame(this._spyFrame);\n this._spyFrame = 0;\n this._layoutObserver?.disconnect();\n this._spyObserver?.disconnect();\n this._ctaObserver?.disconnect();\n this._layoutObserver = this._spyObserver = this._ctaObserver = null;\n for (const el of this._sections) el?.style.removeProperty(\"scroll-margin-top\");\n this._sections = [];\n this._passed = new Map();\n }\n\n _onSectionsCrossLine(entries: IntersectionObserverEntry[]) {\n for (const { target, boundingClientRect, rootBounds } of entries) {\n this._passed.set(target, boundingClientRect.top <= rootBounds!.bottom);\n }\n this._runScrollSpy();\n }\n\n _onFirstSectionCross(entries: IntersectionObserverEntry[]) {\n const { boundingClientRect, rootBounds } = entries[entries.length - 1];\n this._firstSectionBehind = boundingClientRect.bottom <= rootBounds!.top;\n this._runScrollSpy();\n }\n\n _resolvedItems(): ResolvedItem[] {\n if (this.items && this.items.length) {\n return this.items.map((item, i) => ({\n title: item.title,\n href : item.href || `#anchor-${i + 1}-section`,\n id : `anchor-${i + 1}`\n }));\n }\n return Array.from(this.children)\n .filter((el) => el.tagName === \"BD-ANCHOR-NAV-ITEM\")\n .map((el, i) => ({\n title: el.getAttribute(\"title\"),\n href : el.getAttribute(\"href\") || `#anchor-${i + 1}-section`,\n id : `anchor-${i + 1}`\n }));\n }\n\n /* Read off what the observers last reported; while a click's scroll runs,\n the item it chose stays active. The CTA flag is set at every width, since\n only the stylesheet below md hides the CTA until the first section is\n behind the reader. */\n _runScrollSpy() {\n let next = this.activeId;\n\n if (this._sections.length && !this._programmaticScrollTargetId) {\n next = \"anchor-1\";\n this._sections.forEach((el, i) => {\n if (el && this._passed.get(el)) next = `anchor-${i + 1}`;\n });\n }\n\n this.activeId = next;\n this._mobileCtaRevealed = !this._sections[0] || this._firstSectionBehind;\n }\n\n _playMobileDropdownLabelSwap() {\n if (typeof window === \"undefined\") return;\n if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n if (!matchesBelow('md')) return;\n const el = this.renderRoot?.querySelector<HTMLElement>(\".bd-anchor-nav__dropdown-label\");\n if (!el) return;\n el.classList.remove(\"bd-anchor-nav__dropdown-label--swap\");\n void el.offsetWidth;\n el.classList.add(\"bd-anchor-nav__dropdown-label--swap\");\n el.addEventListener(\n \"animationend\",\n () => el.classList.remove(\"bd-anchor-nav__dropdown-label--swap\"),\n { once: true }\n );\n }\n\n /* Where a section stops under the bar: the sticky top, the bar, and a gap.\n The sticky top is read as the browser resolved it, so any length\n sticky-top accepts -- rem, calc(), a custom property -- counts. */\n _stickyOffsetPx() {\n const barPx = this.offsetHeight;\n const stickyTopPx = parseFloat(getComputedStyle(this).top) || 0;\n const insetRaw = getComputedStyle(this).getPropertyValue(\"--spacing-8\")\n .trim();\n const insetPx = parseLengthToPx(insetRaw) || 8;\n if (barPx > 0) return barPx + insetPx + stickyTopPx;\n const fallback = getComputedStyle(this).getPropertyValue(\"--spacing-128\")\n .trim();\n return parseLengthToPx(fallback) || 128;\n }\n\n /* A section link is an ordinary fragment link, and the browser follows it:\n the hash goes into the URL as a history entry, :target moves to the\n section, and the next Tab starts from there. This used to stop the\n click and scroll by hand -- pushState and scrollIntoView -- which kept\n the URL but left :target and the Tab position behind, so a keyboard\n reader who chose \"Pricing\" tabbed on through the nav. The section's own\n scroll-margin-top keeps it clear of the bar.\n\n The click's item stays current until the scroll is over, so the spy\n does not light the sections it passes on the way. A click with a\n modifier, or on an item whose section is not on this page, is left to\n the browser as an ordinary link. */\n handleClick(event: MouseEvent, id: string, href: string) {\n if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n this._cancelScrollSpyUnlock();\n this._programmaticScrollTargetId = null;\n this.activeId = id;\n const sectionId = sectionIdOf(href, id.replace(/^anchor-/, \"\"));\n if (!document.getElementById(sectionId)) return;\n\n this._programmaticScrollTargetId = id;\n this._smoothFragmentScroll();\n this._scheduleScrollSpyUnlock();\n }\n\n /* Fragment navigation scrolls with the root's scroll-behavior, and the\n page's <html> is not this component's to style. So for a reader who has\n not asked for less motion, the click sets it to smooth for the length of\n this one scroll -- before the navigation runs, which is after the click\n listeners -- and gives back whatever the page had when the scroll ends. */\n _smoothFragmentScroll() {\n if (this._restoreScrollBehavior) return;\n if (!window.matchMedia(\"(prefers-reduced-motion: no-preference)\").matches) return;\n const root = document.documentElement;\n const before = root.style.scrollBehavior;\n root.style.scrollBehavior = \"smooth\";\n this._restoreScrollBehavior = () => {\n root.style.scrollBehavior = before;\n this._restoreScrollBehavior = null;\n };\n }\n\n /* With a native popover, popovertarget opens and closes the panel and the\n toggle event reports it; this handler is the fallback's. */\n _toggleDropdown(e: Event) {\n if (NATIVE_POPOVER) return;\n e.preventDefault();\n e.stopPropagation();\n this._dropdownOpen = !this._dropdownOpen;\n }\n\n _onPanelToggle(e: ToggleEvent) {\n this._dropdownOpen = e.newState === \"open\";\n }\n\n _selectFromDropdown(e: MouseEvent, id: string, href: string) {\n if (NATIVE_POPOVER) {\n const panel = this.renderRoot.querySelector<HTMLElement>(\".bd-anchor-nav__dropdown-panel\");\n if (panel?.matches(\":popover-open\")) panel.hidePopover();\n } else {\n this._dropdownOpen = false;\n }\n this.handleClick(e, id, href);\n }\n\n _activeLabel(resolved: ResolvedItem[]) {\n const m = /^anchor-(\\d+)$/.exec(this.activeId || \"\");\n const n = m ? parseInt(m[1], 10) : 1;\n const idx = Math.min(Math.max(n - 1, 0), Math.max(0, resolved.length - 1));\n return resolved[idx]?.title || resolved[0]?.title || \"Section\";\n }\n\n render() {\n const resolved = this._resolvedItems();\n const dropdownLabel = this._activeLabel(resolved);\n\n const linkRow = (cls: string) => html`\n <div class=\"${cls}\">\n ${resolved.map(({ id, title, href }) => {\n const isActive = this.activeId === id;\n return html`\n <bd-link\n href=\"${href}\"\n variant=\"primary\"\n no-underline\n class=\"anchor-link\"\n current=${isActive ? \"location\" : nothing}\n @click=${(e: MouseEvent) => this.handleClick(e, id, href)}\n >${title}</bd-link>\n `;\n })}\n <span class=\"anchor-indicator\" aria-hidden=\"true\"></span>\n </div>\n `;\n\n const innerStyle = this.maxWidth ? `max-width: ${this.maxWidth};` : '';\n\n return html`\n <nav aria-label=${this.navLabel}>\n <div\n class=\"bd-ensemble bd-anchor-nav__inner\"\n part=\"inner\"\n style=\"${innerStyle}\"\n ?data-mobile-cta-visible=${this._mobileCtaRevealed}\n >\n ${linkRow(\"anchor-links anchor-links--desktop\")}\n\n <div class=\"bd-anchor-nav__dropdown\" part=\"dropdown\">\n <button\n type=\"button\"\n class=\"bd-anchor-nav__dropdown-toggle\"\n aria-expanded=${this._dropdownOpen ? \"true\" : \"false\"}\n aria-controls=${this._panelId}\n popovertarget=${NATIVE_POPOVER ? this._panelId : nothing}\n @click=${this._toggleDropdown}\n >\n <span class=\"bd-anchor-nav__dropdown-label\">${dropdownLabel}</span>\n <span class=\"bd-anchor-nav__dropdown-chevron\" aria-hidden=\"true\">\n <bd-arrow-down-icon size=\"md\"></bd-arrow-down-icon>\n </span>\n </button>\n <div\n class=\"bd-anchor-nav__dropdown-panel\"\n id=${this._panelId}\n popover=${NATIVE_POPOVER ? \"auto\" : nothing}\n ?hidden=${!NATIVE_POPOVER && !this._dropdownOpen}\n @toggle=${this._onPanelToggle}\n >\n <ul class=\"bd-anchor-nav__dropdown-list\">\n ${resolved.map(({ id, title, href }) => {\n const isActive = this.activeId === id;\n return html`\n <li>\n <a\n href=\"${href}\"\n class=\"bd-anchor-nav__dropdown-option\"\n aria-current=${isActive ? \"location\" : nothing}\n @click=${(e: MouseEvent) => this._selectFromDropdown(e, id, href)}\n >${title}</a>\n </li>\n `;\n })}\n </ul>\n </div>\n </div>\n\n <div class=\"bd-cta\">\n <div class=\"bd-cta__inner\"><slot name=\"cta\"></slot></div>\n </div>\n </div>\n </nav>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-anchor-nav-item\": BdAnchorNavItem;\n \"bd-anchor-nav\" : BdAnchorNav;\n }\n}\n"],"mappings":"A,ohBAYA,SAASE,EAAgB,EAAe,CACtC,IAAMC,GAAKC,GAAS,GAAA,CAAI,KAAK,EAC7B,GAAI,CAACD,EAAG,MAAO,GACf,GAAIA,EAAE,SAAS,IAAI,EAAG,OAAO,WAAWA,CAAC,EACzC,GAAIA,EAAE,SAAS,KAAK,EAAG,CACrB,IAAME,EAAO,WAAW,iBAAiB,SAAS,eAAe,CAAC,CAAC,QAAQ,GAAK,GAChF,OAAO,WAAWF,CAAC,EAAIE,CACzB,CACA,OAAO,WAAWF,CAAC,GAAK,CAC1B,CAEA,IAAMG,GAAe,EAAc,KAAwBC,GAAQ,GAAA,CAAI,QAAQ,K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AE,KAAM,OAAQ,UAAW,UAAW,CAAC,CAAA,EAAApD,EAAA,UAAA,UAAA,IAAA,EAAA,EAEhDb,EAAA,CAAAiE,EAAS,CAAE,KAAM,KAAM,CAAC,CAAA,EAAApD,EAAA,UAAA,QAAA,IAAA,EAAA,EAExBb,EAAA,CAAAiE,EAAS,CAAE,KAAM,OAAQ,UAAW,WAAY,CAAC,CAAA,EAAApD,EAAA,UAAA,WAAA,IAAA,EAAA,EAEjDb,EAAA,CAAAiE,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAApD,EAAA,UAAA,YAAA,IAAA,EAAA,EApBpD,EAAAb,EAAA,CAAAY,EAAc,eAAe,CAAA,EAAAC,CAAA"}
1
+ {"version":3,"file":"anchor-nav.js","names":["_decorate","__decorate","parseLengthToPx","s","value","root","sectionIdOf","href","n","FAR","NATIVE_POPOVER","BdAnchorNavItem","defineElement","BdAnchorNav","LitElement","ensembleCSS","anchorNavStyles","ObserverController","links","observer","changedProperties","prev","indicator","activeLink","row","scale","inner","gap","top","place","atTop","unlock","lastY","unlockOnceStill","sections","i","offset","line","viewport","el","found","entries","target","boundingClientRect","rootBounds","item","next","matchesBelow","barPx","stickyTopPx","insetPx","event","id","sectionId","before","panel","m","resolved","dropdownLabel","linkRow","cls","isActive","nothing","e","title","innerStyle","state","property"],"sources":["../../../../src/components/anchor/anchor-nav.ts"],"sourcesContent":["import { LitElement, html, nothing, type PropertyValues } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\nimport { ObserverController } from \"#shared/controller.observer.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/icons/arrow-down-icon.ts\";\nimport \"#components/button/button.ts\";\nimport \"#components/link/link.ts\";\nimport { anchorNavStyles } from \"./anchor-nav.css.ts\";\nimport { ensembleCSS } from \"#shared/ensemble.css.ts\";\nimport { matchesBelow } from \"#shared/token-scales.ts\";\n\nfunction parseLengthToPx(value: string) {\n const s = (value || \"\").trim();\n if (!s) return 0;\n if (s.endsWith(\"px\")) return parseFloat(s);\n if (s.endsWith(\"rem\")) {\n const root = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n return parseFloat(s) * root;\n }\n return parseFloat(s) || 0;\n}\n\nconst sectionIdOf = (href: string, n: number | string) => (href || \"\").replace(/^#/, \"\") || `anchor-${n}-section`;\n\n/* \"The rest of the page\" as a root margin: a hundred viewports. Each observer\n below watches one edge, and a jump only registers if it carries a section\n across that edge while still inside the root -- so the root reaches this far\n past the edge, beyond any jump a real page makes. */\nconst FAR = \"10000%\";\n\n/* The dropdown panel is a popover only where it can also be anchored to its\n toggle: in the top layer it leaves the toggle's box, and without anchor\n positioning it would sit in the middle of the viewport. Both are newer than\n the Widely available target, so elsewhere the panel keeps its z-index and\n the document listeners close it. */\nconst NATIVE_POPOVER = \"popover\" in HTMLElement.prototype && CSS.supports(\"anchor-name: --a\");\n\ninterface AnchorNavItem {\n title: string;\n href?: string;\n}\n\ninterface ResolvedItem {\n title: string | null;\n href : string;\n id : string;\n}\n\n@defineElement(\"bd-anchor-nav-item\")\nclass BdAnchorNavItem extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: \"open\" });\n }\n connectedCallback() { this.render(); }\n render() { this.shadowRoot!.innerHTML = `<slot></slot>`; }\n}\n\n@defineElement(\"bd-anchor-nav\")\nclass BdAnchorNav extends LitElement {\n static styles = [ensembleCSS, anchorNavStyles];\n\n @state()\n activeId = \"\";\n @property({ type: String, attribute: \"aria-label\" })\n navLabel = \"Section navigation\";\n @state()\n _dropdownOpen = false;\n @state()\n _mobileCtaRevealed = false;\n @property({ type: String, attribute: \"cta-label\" })\n ctaLabel = \"Buy now\";\n @property({ type: String, attribute: \"cta-href\" })\n ctaHref = \"\";\n @property({ type: Array })\n items: AnchorNavItem[] | null = null;\n @property({ type: String, attribute: \"max-width\" })\n maxWidth = \"\";\n @property({ type: String, attribute: \"sticky-top\" })\n stickyTop = \"0px\";\n\n _panelId : string;\n _spyFrame : number;\n _spyObserver : IntersectionObserver | null;\n _ctaObserver : IntersectionObserver | null;\n _layoutObserver : ResizeObserver | null;\n _sections : (HTMLElement | null)[];\n _spyLine : number;\n _spyViewport : number;\n _passed : Map<Element | null, boolean | undefined>;\n _firstSectionBehind : boolean;\n _programmaticScrollTargetId: string | null;\n _unlockScrollSpyTimer : number | null;\n _scrollEndUnlockHandler : (() => void) | null;\n _onStickyScroll : (() => void) | null;\n _restoreScrollBehavior : (() => void) | null;\n _indicatorReady : boolean;\n\n /* The indicator follows the link row's size and the bar's for as long as\n the nav is connected. It used to start in firstUpdated and stop on\n disconnect, so a nav moved in the page left its indicator where it was. */\n _indicatorSize = new ObserverController(this,\n () => new ResizeObserver(() => this._updateIndicator(\"ResizeObserver\")),\n observer => {\n const links = this.renderRoot.querySelector(\".anchor-links--desktop\");\n if (!links) return;\n observer.observe(links);\n observer.observe(this);\n });\n\n constructor() {\n super();\n this._panelId = `bd-anchor-nav-panel-${Math.random().toString(36)\n .slice(2, 11)}`;\n this._onDocumentPointerDown = this._onDocumentPointerDown.bind(this);\n this._onKeydown = this._onKeydown.bind(this);\n this._onSectionsCrossLine = this._onSectionsCrossLine.bind(this);\n this._onFirstSectionCross = this._onFirstSectionCross.bind(this);\n this._scheduleSpy = this._scheduleSpy.bind(this);\n this._spyFrame = 0;\n this._spyObserver = null;\n this._ctaObserver = null;\n this._layoutObserver = null;\n this._sections = [];\n this._spyLine = 0;\n this._spyViewport = 0;\n this._passed = new Map();\n this._firstSectionBehind = false;\n this._programmaticScrollTargetId = null;\n this._unlockScrollSpyTimer = null;\n this._scrollEndUnlockHandler = null;\n this._onStickyScroll = null;\n this._restoreScrollBehavior = null;\n this._handleResize = this._handleResize.bind(this);\n this._indicatorReady = false;\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\"resize\", this._handleResize);\n if (!NATIVE_POPOVER) {\n document.addEventListener(\"pointerdown\", this._onDocumentPointerDown, true);\n document.addEventListener(\"keydown\", this._onKeydown, true);\n }\n this._initSticky();\n /* The bar's height moves the line the sections are read against, and the\n page growing may bring a section that was not there yet. */\n this._layoutObserver = new ResizeObserver(this._scheduleSpy);\n this._layoutObserver.observe(this);\n this._layoutObserver.observe(document.documentElement);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this._cancelScrollSpyUnlock();\n this._restoreScrollBehavior?.();\n window.removeEventListener(\"resize\", this._handleResize);\n document.removeEventListener(\"pointerdown\", this._onDocumentPointerDown, true);\n document.removeEventListener(\"keydown\", this._onKeydown, true);\n this._destroySticky();\n this._unobserveSections();\n }\n\n /* The first item is active before the first render, not after it: state set\n in firstUpdated or updated starts a second render, the one Lit warns about\n as change-in-update. */\n willUpdate(changedProperties: PropertyValues<this>) {\n super.willUpdate(changedProperties);\n if (!this.hasUpdated && !this.activeId && this._resolvedItems().length) this.activeId = \"anchor-1\";\n }\n\n updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (changedProperties.has(\"stickyTop\")) {\n this.style.setProperty(\"--sticky-top\", this.stickyTop || \"0px\");\n }\n\n if (changedProperties.has(\"stickyTop\") || changedProperties.has(\"items\")) {\n this._scheduleSpy();\n }\n\n if (changedProperties.has(\"activeId\") || changedProperties.has(\"items\")) {\n requestAnimationFrame(() => this._updateIndicator(\"updated\"));\n }\n\n if (!changedProperties.has(\"activeId\")) return;\n const prev = changedProperties.get(\"activeId\");\n if (prev === undefined || prev === \"\") return;\n if (prev === this.activeId) return;\n queueMicrotask(() => this._playMobileDropdownLabelSwap());\n }\n\n firstUpdated() {\n requestAnimationFrame(() => this._updateIndicator(\"firstUpdated\"));\n }\n\n /* The indicator spans the link row and is moved and sized on the\n compositor: translate to the current link's corner, scale to its width.\n It used to animate top and width, which laid the bar out again on every\n frame of the slide. The offsets are physical -- offsetLeft is -- so the\n indicator is anchored at the row's physical left, on a right-to-left\n page too. */\n _updateIndicator(_caller?: string) {\n const indicator = this.renderRoot?.querySelector<HTMLElement>(\".anchor-indicator\");\n const activeLink = this.renderRoot?.querySelector<HTMLElement>(\n \".anchor-links--desktop .anchor-link[current]\"\n );\n if (!indicator || !activeLink) return;\n\n const row = indicator.offsetWidth;\n const scale = row ? activeLink.offsetWidth / row : 0;\n // The bar's bottom edge is the inner's padding-bottom below the link.\n const inner = this.renderRoot.querySelector(\".bd-anchor-nav__inner\");\n const gap = inner ? parseFloat(getComputedStyle(inner).paddingBottom) || 0 : 0;\n const top = activeLink.offsetTop + activeLink.offsetHeight + gap;\n\n const place = () => {\n indicator.style.translate = `${activeLink.offsetLeft}px ${top}px`;\n indicator.style.scale = `${scale} 1`;\n };\n\n if (!this._indicatorReady) {\n indicator.style.transition = \"none\";\n place();\n void indicator.offsetWidth;\n indicator.style.transition = \"\";\n this._indicatorReady = true;\n return;\n }\n\n place();\n }\n\n _handleResize() {\n this._updateIndicator(\"windowResize\");\n // The viewport's height places the spy's line inside its root.\n this._scheduleSpy();\n }\n\n /* The bar sticks with position: sticky, which keeps its own place in the\n flow and lets go at the end of its parent, so nothing here positions it.\n It used to: past its top it switched to position: fixed at the\n viewport's width, measured its parent to know when to let go, and left a\n placeholder behind to hold its space.\n\n While stuck it draws a shadow. A scroll-state container query says when\n that is, and it is newer than the Widely available target; where it is\n missing, this tells instead: the bar sits at its sticky top -- read as\n the browser resolved it, as _stickyOffsetPx() reads it, so calc(), em\n and custom properties count -- and the page has scrolled. A bar that\n merely rests at that line on an unscrolled page is not stuck, as the\n query would not call it. */\n _initSticky() {\n this.style.setProperty(\"--sticky-top\", this.stickyTop || \"0px\");\n if (CSS.supports(\"container-type: scroll-state\")) return;\n\n this._onStickyScroll = () => {\n const top = parseFloat(getComputedStyle(this).top) || 0;\n const atTop = Math.abs(this.getBoundingClientRect().top - top) < 1;\n this.classList.toggle(\"is-sticky\", atTop && window.scrollY > 0);\n };\n window.addEventListener(\"scroll\", this._onStickyScroll, { passive: true });\n window.addEventListener(\"resize\", this._onStickyScroll, { passive: true });\n /* Removed within a frame of connecting, the bar has torn this down. */\n requestAnimationFrame(() => this._onStickyScroll?.());\n }\n\n _destroySticky() {\n if (this._onStickyScroll) {\n window.removeEventListener(\"scroll\", this._onStickyScroll);\n window.removeEventListener(\"resize\", this._onStickyScroll);\n this._onStickyScroll = null;\n }\n this.classList.remove(\"is-sticky\");\n }\n\n _cancelScrollSpyUnlock() {\n if (this._unlockScrollSpyTimer != null) {\n clearTimeout(this._unlockScrollSpyTimer);\n this._unlockScrollSpyTimer = null;\n }\n if (this._scrollEndUnlockHandler) {\n window.removeEventListener(\"scrollend\", this._scrollEndUnlockHandler);\n this._scrollEndUnlockHandler = null;\n }\n }\n\n /* The click's item stays active until the scroll is over. scrollend says so\n where the browser has it. The timer is for a click that scrolls nothing,\n which no scrollend follows, and for browsers without the event: it ends\n the lock once the page has stopped moving. It used to end it after a\n fixed second, and a long smooth scroll outlasts that -- measured 1.3s\n from the first section to the third on the playground at 1280, with the\n second item lit for the last 250ms of it. */\n _scheduleScrollSpyUnlock() {\n this._cancelScrollSpyUnlock();\n const unlock = () => {\n this._cancelScrollSpyUnlock();\n this._restoreScrollBehavior?.();\n this._programmaticScrollTargetId = null;\n this._runScrollSpy();\n };\n this._scrollEndUnlockHandler = unlock;\n window.addEventListener(\"scrollend\", unlock, { passive: true });\n let lastY = window.scrollY;\n const unlockOnceStill = () => {\n if (window.scrollY === lastY) return unlock();\n lastY = window.scrollY;\n this._unlockScrollSpyTimer = window.setTimeout(unlockOnceStill, 250);\n };\n this._unlockScrollSpyTimer = window.setTimeout(unlockOnceStill, 250);\n }\n\n _onKeydown(e: KeyboardEvent) {\n if (e.key === \"Escape\" && this._dropdownOpen) {\n this._dropdownOpen = false;\n this.requestUpdate();\n this.updateComplete.then(() =>\n this.renderRoot?.querySelector<HTMLButtonElement>(\".bd-anchor-nav__dropdown-toggle\")?.focus());\n }\n }\n\n _onDocumentPointerDown(e: PointerEvent) {\n if (!this._dropdownOpen) return;\n const path = e.composedPath();\n if (path.includes(this)) return;\n this._dropdownOpen = false;\n this.requestUpdate();\n }\n\n _scheduleSpy() {\n if (this._spyFrame) return;\n this._spyFrame = requestAnimationFrame(() => {\n this._spyFrame = 0;\n this._observeSections();\n });\n }\n\n /* Scroll-spy, without reading the page on every scroll. The active item is\n the last section whose top has reached a line just under the stuck bar,\n and two IntersectionObservers say when an edge crosses:\n\n - the spy's root ends at that line and reaches FAR above it, so a section\n is inside it exactly while its top is past the line;\n - the CTA's root starts at the top of the viewport and reaches FAR below,\n so the first section leaves it exactly when its bottom scrolls off.\n\n Each entry carries the target's box, so the callbacks read nothing. The\n line depends on the bar's height, the sticky top and the viewport, and a\n root margin cannot change, so the observers are rebuilt when one moves. */\n _observeSections() {\n const sections = this._resolvedItems()\n .map(({ href }, i) => document.getElementById(sectionIdOf(href, i + 1)));\n const offset = this._stickyOffsetPx();\n // 2px under where a click leaves the section, so a section the bar has just\n // scrolled to counts as reached.\n const line = offset + 2;\n const viewport = document.documentElement.clientHeight;\n\n if (line === this._spyLine && viewport === this._spyViewport &&\n sections.length === this._sections.length &&\n sections.every((el, i) => el === this._sections[i])) return;\n\n /* A section a click scrolls to stops under the bar, not behind it, and so\n does one the URL's hash or the back button brings into view. */\n for (const el of this._sections) {\n if (el && !sections.includes(el)) el.style.removeProperty(\"scroll-margin-top\");\n }\n for (const el of sections) el?.style.setProperty(\"scroll-margin-top\", `${offset}px`);\n\n this._spyObserver?.disconnect();\n this._ctaObserver?.disconnect();\n this._spyObserver = this._ctaObserver = null;\n if (sections[0] !== this._sections[0]) this._firstSectionBehind = false;\n this._passed = new Map(sections.filter((el) => this._passed.has(el))\n .map((el) => [el, this._passed.get(el)]));\n this._sections = sections;\n this._spyLine = line;\n this._spyViewport = viewport;\n\n const found = sections.filter(Boolean) as HTMLElement[];\n if (found.length) {\n this._spyObserver = new IntersectionObserver(this._onSectionsCrossLine, {\n root : document,\n rootMargin: `${FAR} 0px ${line - viewport}px 0px`\n });\n found.forEach((el) => this._spyObserver!.observe(el));\n }\n if (sections[0]) {\n this._ctaObserver = new IntersectionObserver(this._onFirstSectionCross, {\n root : document,\n rootMargin: `0px 0px ${FAR} 0px`\n });\n this._ctaObserver.observe(sections[0]);\n }\n this._runScrollSpy();\n }\n\n _unobserveSections() {\n cancelAnimationFrame(this._spyFrame);\n this._spyFrame = 0;\n this._layoutObserver?.disconnect();\n this._spyObserver?.disconnect();\n this._ctaObserver?.disconnect();\n this._layoutObserver = this._spyObserver = this._ctaObserver = null;\n for (const el of this._sections) el?.style.removeProperty(\"scroll-margin-top\");\n this._sections = [];\n this._passed = new Map();\n }\n\n _onSectionsCrossLine(entries: IntersectionObserverEntry[]) {\n for (const { target, boundingClientRect, rootBounds } of entries) {\n this._passed.set(target, boundingClientRect.top <= rootBounds!.bottom);\n }\n this._runScrollSpy();\n }\n\n _onFirstSectionCross(entries: IntersectionObserverEntry[]) {\n const { boundingClientRect, rootBounds } = entries[entries.length - 1];\n this._firstSectionBehind = boundingClientRect.bottom <= rootBounds!.top;\n this._runScrollSpy();\n }\n\n _resolvedItems(): ResolvedItem[] {\n if (this.items && this.items.length) {\n return this.items.map((item, i) => ({\n title: item.title,\n href : item.href || `#anchor-${i + 1}-section`,\n id : `anchor-${i + 1}`\n }));\n }\n return Array.from(this.children)\n .filter((el) => el.tagName === \"BD-ANCHOR-NAV-ITEM\")\n .map((el, i) => ({\n title: el.getAttribute(\"title\"),\n href : el.getAttribute(\"href\") || `#anchor-${i + 1}-section`,\n id : `anchor-${i + 1}`\n }));\n }\n\n /* Read off what the observers last reported; while a click's scroll runs,\n the item it chose stays active. The CTA flag is set at every width, since\n only the stylesheet below md hides the CTA until the first section is\n behind the reader. */\n _runScrollSpy() {\n let next = this.activeId;\n\n if (this._sections.length && !this._programmaticScrollTargetId) {\n next = \"anchor-1\";\n this._sections.forEach((el, i) => {\n if (el && this._passed.get(el)) next = `anchor-${i + 1}`;\n });\n }\n\n this.activeId = next;\n this._mobileCtaRevealed = !this._sections[0] || this._firstSectionBehind;\n }\n\n _playMobileDropdownLabelSwap() {\n if (typeof window === \"undefined\") return;\n if (window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n if (!matchesBelow('md')) return;\n const el = this.renderRoot?.querySelector<HTMLElement>(\".bd-anchor-nav__dropdown-label\");\n if (!el) return;\n el.classList.remove(\"bd-anchor-nav__dropdown-label--swap\");\n void el.offsetWidth;\n el.classList.add(\"bd-anchor-nav__dropdown-label--swap\");\n el.addEventListener(\n \"animationend\",\n () => el.classList.remove(\"bd-anchor-nav__dropdown-label--swap\"),\n { once: true }\n );\n }\n\n /* Where a section stops under the bar: the sticky top, the bar, and a gap.\n The sticky top is read as the browser resolved it, so any length\n sticky-top accepts -- rem, calc(), a custom property -- counts. */\n _stickyOffsetPx() {\n const barPx = this.offsetHeight;\n const stickyTopPx = parseFloat(getComputedStyle(this).top) || 0;\n const insetRaw = getComputedStyle(this).getPropertyValue(\"--spacing-8\")\n .trim();\n const insetPx = parseLengthToPx(insetRaw) || 8;\n if (barPx > 0) return barPx + insetPx + stickyTopPx;\n const fallback = getComputedStyle(this).getPropertyValue(\"--spacing-128\")\n .trim();\n return parseLengthToPx(fallback) || 128;\n }\n\n /* A section link is an ordinary fragment link, and the browser follows it:\n the hash goes into the URL as a history entry, :target moves to the\n section, and the next Tab starts from there. This used to stop the\n click and scroll by hand -- pushState and scrollIntoView -- which kept\n the URL but left :target and the Tab position behind, so a keyboard\n reader who chose \"Pricing\" tabbed on through the nav. The section's own\n scroll-margin-top keeps it clear of the bar.\n\n The click's item stays current until the scroll is over, so the spy\n does not light the sections it passes on the way. A click with a\n modifier, or on an item whose section is not on this page, is left to\n the browser as an ordinary link. */\n handleClick(event: MouseEvent, id: string, href: string) {\n if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;\n this._cancelScrollSpyUnlock();\n this._programmaticScrollTargetId = null;\n this.activeId = id;\n const sectionId = sectionIdOf(href, id.replace(/^anchor-/, \"\"));\n if (!document.getElementById(sectionId)) return;\n\n this._programmaticScrollTargetId = id;\n this._smoothFragmentScroll();\n this._scheduleScrollSpyUnlock();\n }\n\n /* Fragment navigation scrolls with the root's scroll-behavior, and the\n page's <html> is not this component's to style. So for a reader who has\n not asked for less motion, the click sets it to smooth for the length of\n this one scroll -- before the navigation runs, which is after the click\n listeners -- and gives back whatever the page had when the scroll ends. */\n _smoothFragmentScroll() {\n if (this._restoreScrollBehavior) return;\n if (!window.matchMedia(\"(prefers-reduced-motion: no-preference)\").matches) return;\n const root = document.documentElement;\n const before = root.style.scrollBehavior;\n root.style.scrollBehavior = \"smooth\";\n this._restoreScrollBehavior = () => {\n root.style.scrollBehavior = before;\n this._restoreScrollBehavior = null;\n };\n }\n\n /* With a native popover, popovertarget opens and closes the panel and the\n toggle event reports it; this handler is the fallback's. */\n _toggleDropdown(e: Event) {\n if (NATIVE_POPOVER) return;\n e.preventDefault();\n e.stopPropagation();\n this._dropdownOpen = !this._dropdownOpen;\n }\n\n _onPanelToggle(e: ToggleEvent) {\n this._dropdownOpen = e.newState === \"open\";\n }\n\n _selectFromDropdown(e: MouseEvent, id: string, href: string) {\n if (NATIVE_POPOVER) {\n const panel = this.renderRoot.querySelector<HTMLElement>(\".bd-anchor-nav__dropdown-panel\");\n if (panel?.matches(\":popover-open\")) panel.hidePopover();\n } else {\n this._dropdownOpen = false;\n }\n this.handleClick(e, id, href);\n }\n\n _activeLabel(resolved: ResolvedItem[]) {\n const m = /^anchor-(\\d+)$/.exec(this.activeId || \"\");\n const n = m ? parseInt(m[1], 10) : 1;\n const idx = Math.min(Math.max(n - 1, 0), Math.max(0, resolved.length - 1));\n return resolved[idx]?.title || resolved[0]?.title || \"Section\";\n }\n\n render() {\n const resolved = this._resolvedItems();\n const dropdownLabel = this._activeLabel(resolved);\n\n const linkRow = (cls: string) => html`\n <div class=\"${cls}\">\n ${resolved.map(({ id, title, href }) => {\n const isActive = this.activeId === id;\n return html`\n <bd-link\n href=\"${href}\"\n variant=\"primary\"\n no-underline\n class=\"anchor-link\"\n current=${isActive ? \"location\" : nothing}\n @click=${(e: MouseEvent) => this.handleClick(e, id, href)}\n >${title}</bd-link>\n `;\n })}\n <span class=\"anchor-indicator\" aria-hidden=\"true\"></span>\n </div>\n `;\n\n const innerStyle = this.maxWidth ? `max-width: ${this.maxWidth};` : '';\n\n return html`\n <nav aria-label=${this.navLabel}>\n <div\n class=\"bd-ensemble bd-anchor-nav__inner\"\n part=\"inner\"\n style=\"${innerStyle}\"\n ?data-mobile-cta-visible=${this._mobileCtaRevealed}\n >\n ${linkRow(\"anchor-links anchor-links--desktop\")}\n\n <div class=\"bd-anchor-nav__dropdown\" part=\"dropdown\">\n <button\n type=\"button\"\n class=\"bd-anchor-nav__dropdown-toggle\"\n aria-expanded=${this._dropdownOpen ? \"true\" : \"false\"}\n aria-controls=${this._panelId}\n popovertarget=${NATIVE_POPOVER ? this._panelId : nothing}\n @click=${this._toggleDropdown}\n >\n <span class=\"bd-anchor-nav__dropdown-label\">${dropdownLabel}</span>\n <span class=\"bd-anchor-nav__dropdown-chevron\" aria-hidden=\"true\">\n <bd-arrow-down-icon size=\"md\"></bd-arrow-down-icon>\n </span>\n </button>\n <div\n class=\"bd-anchor-nav__dropdown-panel\"\n id=${this._panelId}\n popover=${NATIVE_POPOVER ? \"auto\" : nothing}\n ?hidden=${!NATIVE_POPOVER && !this._dropdownOpen}\n @toggle=${this._onPanelToggle}\n >\n <ul class=\"bd-anchor-nav__dropdown-list\">\n ${resolved.map(({ id, title, href }) => {\n const isActive = this.activeId === id;\n return html`\n <li>\n <a\n href=\"${href}\"\n class=\"bd-anchor-nav__dropdown-option\"\n aria-current=${isActive ? \"location\" : nothing}\n @click=${(e: MouseEvent) => this._selectFromDropdown(e, id, href)}\n >${title}</a>\n </li>\n `;\n })}\n </ul>\n </div>\n </div>\n\n <div class=\"bd-cta\">\n <div class=\"bd-cta__inner\"><slot name=\"cta\"></slot></div>\n </div>\n </div>\n </nav>\n `;\n }\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;;;;;;KAWjB,CACF,EArkBGhE,EAAA,CAAAkE,EAAM,CAAA,EAAArD,EAAA,UAAA,WAAA,IAAA,EAAA,EAENb,EAAA,CAAAmE,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAtD,EAAA,UAAA,WAAA,IAAA,EAAA,EAElDb,EAAA,CAAAkE,EAAM,CAAA,EAAArD,EAAA,UAAA,gBAAA,IAAA,EAAA,EAENb,EAAA,CAAAkE,EAAM,CAAA,EAAArD,EAAA,UAAA,qBAAA,IAAA,EAAA,EAENb,EAAA,CAAAmE,EAAS,CAAE,KAAM,OAAQ,UAAW,WAAY,CAAC,CAAA,EAAAtD,EAAA,UAAA,WAAA,IAAA,EAAA,EAEjDb,EAAA,CAAAmE,EAAS,CAAE,KAAM,OAAQ,UAAW,UAAW,CAAC,CAAA,EAAAtD,EAAA,UAAA,UAAA,IAAA,EAAA,EAEhDb,EAAA,CAAAmE,EAAS,CAAE,KAAM,KAAM,CAAC,CAAA,EAAAtD,EAAA,UAAA,QAAA,IAAA,EAAA,EAExBb,EAAA,CAAAmE,EAAS,CAAE,KAAM,OAAQ,UAAW,WAAY,CAAC,CAAA,EAAAtD,EAAA,UAAA,WAAA,IAAA,EAAA,EAEjDb,EAAA,CAAAmE,EAAS,CAAE,KAAM,OAAQ,UAAW,YAAa,CAAC,CAAA,EAAAtD,EAAA,UAAA,YAAA,IAAA,EAAA,EApBpD,EAAAb,EAAA,CAAAY,EAAc,eAAe,CAAA,EAAAC,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { LitElement } from "lit";
2
+ import "../../tokens/tokens.js";
2
3
  import "../button/button.js";
3
4
  import "../heading/heading.js";
4
5
  type HeadingTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
@@ -1,19 +1,19 @@
1
- import{defineElement as e}from"../shared/define-element.js";import{tokens as t}from"../../tokens/tokens.js";import n from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import"../heading/heading.js";import"../button/button.js";import{audienceCardCSS as r}from"./audience-card.css.js";import{LitElement as i,html as a,nothing as o}from"lit";import{property as s}from"lit/decorators.js";var c=class extends i{constructor(...e){super(...e),this.eyebrow=``,this.heading=``,this.description=``,this.href=``,this.target=``,this.label=``,this.as=`h2`}static{this.styles=[t,r]}render(){return a`
1
+ import{defineElement as e}from"../shared/define-element.js";import"../../tokens/tokens.js";import t from"../../_bundled/oxc-project_runtime/helpers/esm/decorate.js";import"../heading/heading.js";import"../button/button.js";import{audienceCardCSS as n}from"./audience-card.css.js";import{LitElement as r,html as i,nothing as a}from"lit";import{property as o}from"lit/decorators.js";var s=class extends r{constructor(...e){super(...e),this.eyebrow=``,this.heading=``,this.description=``,this.href=``,this.target=``,this.label=``,this.as=`h2`}static{this.styles=[n]}render(){return i`
2
2
  <article class="card">
3
3
  <div class="copy">
4
- ${this.eyebrow?a`<p class="eyebrow"><slot name="icon"></slot><span class="text">${this.eyebrow}</span></p>`:o}
4
+ ${this.eyebrow?i`<p class="eyebrow"><slot name="icon"></slot><span class="text">${this.eyebrow}</span></p>`:a}
5
5
  <bd-h as="${this.as}" visual-level="h4" class="heading"><span class="text">${this.heading}</span></bd-h>
6
- ${this.description?a`<p class="description">${this.description}</p>`:o}
6
+ ${this.description?i`<p class="description">${this.description}</p>`:a}
7
7
  </div>
8
- ${this.href?a`<bd-button-link
8
+ ${this.href?i`<bd-button-link
9
9
  class="arrow"
10
10
  variant="accent"
11
11
  size="md"
12
12
  icon-only
13
13
  href="${this.href}"
14
- target="${this.target||o}"
14
+ target="${this.target||a}"
15
15
  label="${this.label||this.eyebrow||this.heading}"
16
- ></bd-button-link>`:o}
16
+ ></bd-button-link>`:a}
17
17
  </article>
18
- `}};n([s({type:String})],c.prototype,`eyebrow`,void 0),n([s({type:String})],c.prototype,`heading`,void 0),n([s({type:String})],c.prototype,`description`,void 0),n([s({type:String})],c.prototype,`href`,void 0),n([s({type:String})],c.prototype,`target`,void 0),n([s({type:String})],c.prototype,`label`,void 0),n([s({type:String})],c.prototype,`as`,void 0),c=n([e(`bd-audience-card`)],c);export{c as AudienceCard};
18
+ `}};t([o({type:String})],s.prototype,`eyebrow`,void 0),t([o({type:String})],s.prototype,`heading`,void 0),t([o({type:String})],s.prototype,`description`,void 0),t([o({type:String})],s.prototype,`href`,void 0),t([o({type:String})],s.prototype,`target`,void 0),t([o({type:String})],s.prototype,`label`,void 0),t([o({type:String})],s.prototype,`as`,void 0),s=t([e(`bd-audience-card`)],s);export{s as AudienceCard};
19
19
  //# sourceMappingURL=audience-card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audience-card.js","names":["_decorate","__decorate","AudienceCard","LitElement","_args","tokens","audienceCardCSS","nothing","property","defineElement"],"sources":["../../../../src/components/audience-card/audience-card.ts"],"sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\nimport { tokens } from \"#tokens/tokens.ts\";\nimport \"#components/button/button.ts\";\nimport \"#components/heading/heading.ts\";\nimport { audienceCardCSS } from \"./audience-card.css.ts\";\n\ntype HeadingTag = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n/**\n * The homepage's audience entry: who it is for, a title, a line of\n * description, and a round arrow into that audience's page. Drawn in the\n * foundation Figma file as Audience card.\n *\n * One link, not three. The arrow is the link and carries the accessible name\n * (`label`, the eyebrow by default, e.g. \"For home\"), so the page reads one\n * link per card instead of a title, a paragraph and an arrow. Its hit area is\n * stretched across the card by an ::after on the link itself (see\n * audience-card.css.ts), so a click anywhere on the card is a click on the\n * link: middle-click and Ctrl/Cmd-click open it in a new tab and the link's\n * context menu is there, which the click handler that stood here could not\n * do -- it forwarded a plain click() whatever the reader had asked for.\n *\n * Between md and lg -- the tablet frame -- the card turns into a row, the copy\n * on the left and the arrow on the right; above and below it stacks.\n */\n@defineElement(\"bd-audience-card\")\nexport class AudienceCard extends LitElement {\n static styles = [tokens, audienceCardCSS];\n\n @property({ type: String })\n eyebrow = \"\";\n @property({ type: String })\n heading = \"\";\n @property({ type: String })\n description = \"\";\n @property({ type: String })\n href = \"\";\n @property({ type: String })\n target = \"\";\n @property({ type: String })\n label = \"\";\n // three cards under the hero's h1\n @property({ type: String })\n as: HeadingTag = \"h2\";\n\n render() {\n return html`\n <article class=\"card\">\n <div class=\"copy\">\n ${this.eyebrow\n ? html`<p class=\"eyebrow\"><slot name=\"icon\"></slot><span class=\"text\">${this.eyebrow}</span></p>`\n : nothing}\n <bd-h as=\"${this.as}\" visual-level=\"h4\" class=\"heading\"><span class=\"text\">${this.heading}</span></bd-h>\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n </div>\n ${this.href\n ? html`<bd-button-link\n class=\"arrow\"\n variant=\"accent\"\n size=\"md\"\n icon-only\n href=\"${this.href}\"\n target=\"${this.target || nothing}\"\n label=\"${this.label || this.eyebrow || this.heading}\"\n ></bd-button-link>`\n : nothing}\n </article>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-audience-card\": AudienceCard;\n }\n}\n"],"mappings":"A,8YA4BO,IAAME,EAAN,cAA2BC,CAAW,C,8BAIjC,KAAA,QAAA,GAEA,KAAA,QAAA,GAEI,KAAA,YAAA,GAEP,KAAA,KAAA,GAEE,KAAA,OAAA,GAED,KAAA,MAAA,GAGS,KAAA,GAAA,I,QAhBD,KAAA,OAAA,CAACE,EAAQC,CAAe,C,CAkBxC,QAAS,CACP,MAAO,EAAI;;;YAGH,KAAK,QACH,CAAI,kEAAkE,KAAK,QAAQ,aACnFC,EAAQ;sBACA,KAAK,GAAG,yDAAyD,KAAK,QAAQ;YACxF,KAAK,YAAc,CAAI,0BAA0B,KAAK,YAAY,MAAQA,EAAQ;;UAEpF,KAAK,KACH,CAAI;;;;;sBAKM,KAAK,KAAK;wBACR,KAAK,QAAUA,EAAQ;uBACxB,KAAK,OAAS,KAAK,SAAW,KAAK,QAAQ;gCAEtDA,EAAQ;;KAGlB,CACF,EAxCGP,EAAA,CAAAQ,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,UAAA,IAAA,EAAA,EAEzBF,EAAA,CAAAQ,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,UAAA,IAAA,EAAA,EAEzBF,EAAA,CAAAQ,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,cAAA,IAAA,EAAA,EAEzBF,EAAA,CAAAQ,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,OAAA,IAAA,EAAA,EAEzBF,EAAA,CAAAQ,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,SAAA,IAAA,EAAA,EAEzBF,EAAA,CAAAQ,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,QAAA,IAAA,EAAA,EAGzBF,EAAA,CAAAQ,EAAS,CAAE,KAAM,MAAO,CAAC,CAAA,EAAAN,EAAA,UAAA,KAAA,IAAA,EAAA,EAjB3B,EAAAF,EAAA,CAAAS,EAAc,kBAAkB,CAAA,EAAAP,CAAA,E"}
1
+ {"version":3,"file":"audience-card.js","names":["_decorate","__decorate","AudienceCard","LitElement","_args","audienceCardCSS","nothing","property","defineElement"],"sources":["../../../../src/components/audience-card/audience-card.ts"],"sourcesContent":["import { LitElement, html, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { defineElement } from \"#shared/define-element.ts\";\n// Installs the design tokens into document scope; see src/tokens/tokens.ts\nimport \"#tokens/tokens.ts\";\nimport \"#components/button/button.ts\";\nimport \"#components/heading/heading.ts\";\nimport { audienceCardCSS } from \"./audience-card.css.ts\";\n\ntype HeadingTag = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n/**\n * The homepage's audience entry: who it is for, a title, a line of\n * description, and a round arrow into that audience's page. Drawn in the\n * foundation Figma file as Audience card.\n *\n * One link, not three. The arrow is the link and carries the accessible name\n * (`label`, the eyebrow by default, e.g. \"For home\"), so the page reads one\n * link per card instead of a title, a paragraph and an arrow. Its hit area is\n * stretched across the card by an ::after on the link itself (see\n * audience-card.css.ts), so a click anywhere on the card is a click on the\n * link: middle-click and Ctrl/Cmd-click open it in a new tab and the link's\n * context menu is there, which the click handler that stood here could not\n * do -- it forwarded a plain click() whatever the reader had asked for.\n *\n * Between md and lg -- the tablet frame -- the card turns into a row, the copy\n * on the left and the arrow on the right; above and below it stacks.\n */\n@defineElement(\"bd-audience-card\")\nexport class AudienceCard extends LitElement {\n static styles = [audienceCardCSS];\n\n @property({ type: String })\n eyebrow = \"\";\n @property({ type: String })\n heading = \"\";\n @property({ type: String })\n description = \"\";\n @property({ type: String })\n href = \"\";\n @property({ type: String })\n target = \"\";\n @property({ type: String })\n label = \"\";\n // three cards under the hero's h1\n @property({ type: String })\n as: HeadingTag = \"h2\";\n\n render() {\n return html`\n <article class=\"card\">\n <div class=\"copy\">\n ${this.eyebrow\n ? html`<p class=\"eyebrow\"><slot name=\"icon\"></slot><span class=\"text\">${this.eyebrow}</span></p>`\n : nothing}\n <bd-h as=\"${this.as}\" visual-level=\"h4\" class=\"heading\"><span class=\"text\">${this.heading}</span></bd-h>\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n </div>\n ${this.href\n ? html`<bd-button-link\n class=\"arrow\"\n variant=\"accent\"\n size=\"md\"\n icon-only\n href=\"${this.href}\"\n target=\"${this.target || nothing}\"\n label=\"${this.label || this.eyebrow || this.heading}\"\n ></bd-button-link>`\n : nothing}\n </article>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"bd-audience-card\": AudienceCard;\n }\n}\n"],"mappings":"A,6XA6BO,IAAME,EAAN,cAA2BC,CAAW,C,8BAIjC,KAAA,QAAA,GAEA,KAAA,QAAA,GAEI,KAAA,YAAA,GAEP,KAAA,KAAA,GAEE,KAAA,OAAA,GAED,KAAA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paratives-icon.js";
3
4
  import "../icons/best-brands-icon.js";
4
5
  import "../icons/laurel-icon.js";
@@ -50,8 +51,8 @@ export declare class AwardsFlex extends LitElement {
50
51
  _iconHeight(): 64 | 56;
51
52
  _renderIcon(iconKey: string): import("lit-html").TemplateResult<1>;
52
53
  _renderBadge(award: AwardsFlexBadge): import("lit-html").TemplateResult<1>;
53
- _renderQuoteCard(award: AwardsFlexBadge): import("lit-html").TemplateResult<1> | typeof nothing;
54
- _renderDots(): import("lit-html").TemplateResult<1> | typeof nothing;
54
+ _renderQuoteCard(award: AwardsFlexBadge): typeof nothing | import("lit-html").TemplateResult<1>;
55
+ _renderDots(): typeof nothing | import("lit-html").TemplateResult<1>;
55
56
  _renderCarousel(): import("lit-html").TemplateResult<1>;
56
57
  _renderLaurel(): import("lit-html").TemplateResult<1>;
57
58
  render(): import("lit-html").TemplateResult<1>;