@nldd/design-system 0.8.97 → 0.8.98

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 (80) hide show
  1. package/custom-elements.json +34 -15
  2. package/dist/components/components.js +288 -93
  3. package/dist/components/content/code-viewer/code-viewer.d.ts +4 -1
  4. package/dist/components/content/code-viewer/code-viewer.d.ts.map +1 -1
  5. package/dist/components/content/code-viewer/code-viewer.js +43 -5
  6. package/dist/components/content/code-viewer/code-viewer.js.map +1 -1
  7. package/dist/components/content/code-viewer/code-viewer.styles.d.ts.map +1 -1
  8. package/dist/components/content/code-viewer/code-viewer.styles.js +11 -0
  9. package/dist/components/content/code-viewer/code-viewer.styles.js.map +1 -1
  10. package/dist/components/content/code-viewer/code-viewer.template.d.ts.map +1 -1
  11. package/dist/components/content/code-viewer/code-viewer.template.js +1 -0
  12. package/dist/components/content/code-viewer/code-viewer.template.js.map +1 -1
  13. package/dist/components/content/tooltip/tooltip.d.ts +7 -0
  14. package/dist/components/content/tooltip/tooltip.d.ts.map +1 -1
  15. package/dist/components/content/tooltip/tooltip.js +29 -2
  16. package/dist/components/content/tooltip/tooltip.js.map +1 -1
  17. package/dist/components/{dist-CH9m014O.js → dist-B2QcygzG.js} +1 -1
  18. package/dist/components/{dist-DMHTTJRJ.js → dist-BB5mlo7D.js} +2 -2
  19. package/dist/components/{dist-C3uWRipu.js → dist-Bo5Jeyfn.js} +1 -1
  20. package/dist/components/{dist-CpW8MF-L.js → dist-Bud_7w5g.js} +232 -214
  21. package/dist/components/{dist-CvL6_ezZ.js → dist-CA0yDFIt.js} +2 -2
  22. package/dist/components/{dist-DV6Mp5N1.js → dist-CaxHkqR2.js} +3 -3
  23. package/dist/components/{dist-BWRYv3Mp.js → dist-Ch3gNAuT.js} +1 -1
  24. package/dist/components/{dist-PlhQXXtE.js → dist-DbNhCpS5.js} +1 -1
  25. package/dist/components/{dist-DTOshgo1.js → dist-DkqAbJH8.js} +1 -1
  26. package/dist/components/{dist-BWEAw34D.js → dist-DnZmcpbQ.js} +1 -1
  27. package/dist/components/{dist-Bi4EHsFY.js → dist-iC2RTM0V.js} +2 -2
  28. package/dist/components/forms/validation-list/validation-list.d.ts +19 -9
  29. package/dist/components/forms/validation-list/validation-list.d.ts.map +1 -1
  30. package/dist/components/forms/validation-list/validation-list.js +38 -12
  31. package/dist/components/forms/validation-list/validation-list.js.map +1 -1
  32. package/dist/components/{icon-button-NN0SrgS3.js → icon-button-CJIikwyu.js} +15 -2
  33. package/dist/components/inputs/segmented-control/segmented-control.d.ts +1 -1
  34. package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
  35. package/dist/components/inputs/segmented-control/segmented-control.js +1 -4
  36. package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
  37. package/dist/components/inputs/toggle-button/toggle-button.d.ts +1 -1
  38. package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
  39. package/dist/components/inputs/toggle-button/toggle-button.js +1 -4
  40. package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
  41. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.d.ts.map +1 -1
  42. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.js +3 -1
  43. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.styles.js.map +1 -1
  44. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.template.js +6 -6
  45. package/dist/components/layout/page-sections/sidebar-section/sidebar-section.template.js.map +1 -1
  46. package/dist/components/lists-and-tables/list/list.d.ts +6 -1
  47. package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
  48. package/dist/components/lists-and-tables/list/list.js +7 -2
  49. package/dist/components/lists-and-tables/list/list.js.map +1 -1
  50. package/dist/components/lists-and-tables/list-item/list-item.d.ts +16 -1
  51. package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
  52. package/dist/components/lists-and-tables/list-item/list-item.js +35 -4
  53. package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
  54. package/dist/components/lists-and-tables/list-item/list-item.template.d.ts +1 -1
  55. package/dist/components/lists-and-tables/list-item/list-item.template.d.ts.map +1 -1
  56. package/dist/components/lists-and-tables/list-item/list-item.template.js +7 -6
  57. package/dist/components/lists-and-tables/list-item/list-item.template.js.map +1 -1
  58. package/dist/components/navigation/menu-bar/menu-bar.d.ts.map +1 -1
  59. package/dist/components/navigation/menu-bar/menu-bar.js +19 -2
  60. package/dist/components/navigation/menu-bar/menu-bar.js.map +1 -1
  61. package/dist/components/navigation/menu-bar-item/menu-bar-item.d.ts +2 -2
  62. package/dist/components/navigation/menu-bar-item/menu-bar-item.js +2 -2
  63. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.d.ts +1 -0
  64. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.d.ts.map +1 -1
  65. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js +45 -31
  66. package/dist/components/navigation/menu-bar-item/menu-bar-item.template.js.map +1 -1
  67. package/dist/components/navigation/skip-link/skip-link.d.ts +50 -4
  68. package/dist/components/navigation/skip-link/skip-link.d.ts.map +1 -1
  69. package/dist/components/navigation/skip-link/skip-link.js +140 -13
  70. package/dist/components/navigation/skip-link/skip-link.js.map +1 -1
  71. package/dist/components/navigation/skip-link/skip-link.template.d.ts.map +1 -1
  72. package/dist/components/navigation/skip-link/skip-link.template.js +1 -0
  73. package/dist/components/navigation/skip-link/skip-link.template.js.map +1 -1
  74. package/dist/components/navigation/top-title-bar/top-title-bar.d.ts +8 -1
  75. package/dist/components/navigation/top-title-bar/top-title-bar.d.ts.map +1 -1
  76. package/dist/components/navigation/top-title-bar/top-title-bar.js +8 -1
  77. package/dist/components/navigation/top-title-bar/top-title-bar.js.map +1 -1
  78. package/dist/nldd.min.js +664 -645
  79. package/dist/types/vue.d.ts +18 -14
  80. package/package.json +2 -2
@@ -3,14 +3,14 @@ import { n as slottedReset, t as inheritedTextReset } from "./shadow-resets-CPa5
3
3
  import { i as linkRel, n as setTranslations, r as translate, t as withTranslations } from "./with-translations-C8_0-9y8.js";
4
4
  import { t as __decorate } from "./decorate-CO88j7Lc.js";
5
5
  import { t as reflectNonDefault } from "./reflect-non-default-OLaK60rT.js";
6
- import { i as PopupAnchorController, n as NLDDTooltip, r as NLDDActivityIndicator, t as NLDDIconButton } from "./icon-button-NN0SrgS3.js";
6
+ import { i as PopupAnchorController, n as NLDDTooltip, r as NLDDActivityIndicator, t as NLDDIconButton } from "./icon-button-CJIikwyu.js";
7
7
  import { t as NLDDIcon } from "./icon-D_ZGezHx.js";
8
8
  import { n as isPointerMode, r as isTouchMode, t as isKeyboardMode } from "./input-modality-DhTeUxKi.js";
9
9
  import { t as breakpoints } from "./breakpoints-CkxsiRgH.js";
10
10
  import { t as VisibilityMixin } from "./visibility-mixin-Crbt8PFP.js";
11
- import { $ as layer, A as syntaxTree, B as Tree, C as indentNodeProp, Ct as countColumn, D as matchBrackets, E as languageDataProp, F as NodeProp, G as RectangleMarker, H as Decoration, I as NodeSet, J as drawSelection, K as ViewPlugin, L as NodeType, M as styleTags, N as tags, Q as keymap, S as getIndentation, St as combineConfig, T as indentUnit, U as Direction, V as parseMixed, W as EditorView, X as getDrawSelectionConfig, Y as dropCursor, _t as StateField, a as HighlightStyle, at as Annotation, b as foldService, c as Language, ct as Compartment, d as ParseContext, dt as Facet, et as lineNumbers, f as StreamLanguage, gt as StateEffect, h as defineLanguageFacet, it as tooltips, j as Tag, k as syntaxHighlighting, l as LanguageDescription, lt as EditorSelection, mt as RangeSetBuilder, nt as placeholder, o as IndentContext, ot as ChangeDesc, pt as Prec, q as WidgetType, rt as showTooltip, st as ChangeSet, u as LanguageSupport, ut as EditorState, vt as Text, w as indentString, wt as findClusterBreak, x as getIndentUnit, y as foldNodeProp, yt as Transaction, z as Parser } from "./dist-CpW8MF-L.js";
12
- import { i as completionStatus, n as autocompletion, s as startCompletion, t as CompletionContext } from "./dist-DTOshgo1.js";
13
- import { n as html$2, r as htmlCompletionSource } from "./dist-DV6Mp5N1.js";
11
+ import { $ as layer, A as syntaxTree, B as Tree, C as indentNodeProp, Ct as countColumn, D as matchBrackets, E as languageDataProp, F as NodeProp, G as RectangleMarker, H as Decoration, I as NodeSet, J as drawSelection, K as ViewPlugin, L as NodeType, M as styleTags, N as tags, Q as keymap, S as getIndentation, St as combineConfig, T as indentUnit, U as Direction, V as parseMixed, W as EditorView, X as getDrawSelectionConfig, Y as dropCursor, _t as StateField, a as HighlightStyle, at as Annotation, b as foldService, c as Language, ct as Compartment, d as ParseContext, dt as Facet, et as lineNumbers, f as StreamLanguage, gt as StateEffect, h as defineLanguageFacet, it as tooltips, j as Tag, k as syntaxHighlighting, l as LanguageDescription, lt as EditorSelection, mt as RangeSetBuilder, nt as placeholder, o as IndentContext, ot as ChangeDesc, pt as Prec, q as WidgetType, rt as showTooltip, st as ChangeSet, u as LanguageSupport, ut as EditorState, vt as Text, w as indentString, wt as findClusterBreak, x as getIndentUnit, y as foldNodeProp, yt as Transaction, z as Parser } from "./dist-Bud_7w5g.js";
12
+ import { i as completionStatus, n as autocompletion, s as startCompletion, t as CompletionContext } from "./dist-DkqAbJH8.js";
13
+ import { n as html$2, r as htmlCompletionSource } from "./dist-CaxHkqR2.js";
14
14
  import { LitElement, css, html, nothing, svg, unsafeCSS } from "lit";
15
15
  import { customElement, property, query, state } from "lit/decorators.js";
16
16
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
@@ -9394,7 +9394,7 @@ var NLDDList = (_NLDDList2 = class NLDDList extends LitElement {
9394
9394
  * the branch and the next top-level row, so the last row of the list is the
9395
9395
  * deepest last child, not the last item in the list's own slot. */
9396
9396
  _getPaintedRows(rows = this._getItems()) {
9397
- return rows.filter((row) => !row.hasAttribute("hidden")).flatMap((row) => row.expanded ? [row, ...this._getPaintedRows(row.childRows)] : [row]);
9397
+ return rows.filter((row) => !row.hasAttribute("hidden")).flatMap((row) => row._childrenOpen ? [row, ...this._getPaintedRows(row.childRows)] : [row]);
9398
9398
  }
9399
9399
  _updateItems() {
9400
9400
  const items = this._getItems();
@@ -10336,11 +10336,11 @@ var listItemStyles = css`
10336
10336
  //#region src/components/lists-and-tables/list-item/list-item.template.ts
10337
10337
  var content = html`<slot></slot>`;
10338
10338
  var divider = html`<div class="list-item__divider"></div>`;
10339
- var template$13 = (button, href, target, rel, opensInNewTabLabel, actionTabindex, isHighlighted = false, checkbox = false, radio = false, checked = false, expanded, showChildren = false, hasCheckedSegment = false, disabled = false) => {
10339
+ var template$13 = (button, href, target, rel, opensInNewTabLabel, actionTabindex, isHighlighted = false, checkbox = false, radio = false, checked = false, expanded, showChildren = false, hasCheckedSegment = false, disabled = false, childrenRole = "group", childrenOpen = expanded === true) => {
10340
10340
  const ariaExpanded = expanded === void 0 ? nothing : String(expanded);
10341
10341
  const children = showChildren ? html`<div class="list-item__children"
10342
- role="group"
10343
- ?hidden=${expanded !== true}
10342
+ role=${childrenRole}
10343
+ ?hidden=${!childrenOpen}
10344
10344
  ><slot name="children"></slot></div>` : html`<slot name="children" hidden></slot>`;
10345
10345
  const blockClass = classMap({
10346
10346
  "list-item": true,
@@ -10491,6 +10491,8 @@ var NLDDListItem = (_NLDDListItem2 = class NLDDListItem extends withTranslations
10491
10491
  this._observedMarkerTargets = [];
10492
10492
  this._warnedDegenerateDivider = false;
10493
10493
  this._warnedChildrenOutsideTree = false;
10494
+ this._warnedExpandedInNavigation = false;
10495
+ this._warnedStrayExpanded = false;
10494
10496
  this._warnedStrayContent = false;
10495
10497
  this._warnedNestedControl = false;
10496
10498
  this._ownCellSize = /* @__PURE__ */ new WeakMap();
@@ -10754,11 +10756,27 @@ var NLDDListItem = (_NLDDListItem2 = class NLDDListItem extends withTranslations
10754
10756
  * attribute keeps its other meaning: this row discloses nothing, emit no
10755
10757
  * aria-expanded at all. Without this split, `?expanded=\${false}` (which
10756
10758
  * removes the attribute) would leave a branch that never collapses.
10759
+ *
10760
+ * A navigation list is the exception. Its sub-pages are always shown, so a
10761
+ * row with children discloses nothing there and emits no aria-expanded,
10762
+ * whatever `expanded` says: "collapsed" next to visible children would be
10763
+ * a contradiction.
10757
10764
  */
10758
10765
  get _resolvedExpanded() {
10766
+ if (this._showChildren && this._parentType === "navigation") return void 0;
10759
10767
  if (this._showChildren) return this.expanded === true;
10760
10768
  return this.expanded;
10761
10769
  }
10770
+ /**
10771
+ * Whether the child rows are on screen. A tree branch is closed until it
10772
+ * says `expanded`. In a navigation list the sub-pages are always there: it
10773
+ * has no branches to open, which is what sets it apart from a tree.
10774
+ *
10775
+ * @internal Read by the list, which walks the rows that paint.
10776
+ */
10777
+ get _childrenOpen() {
10778
+ return this._parentType === "navigation" || this.expanded === true;
10779
+ }
10762
10780
  /** Segments marked `disclosure` announce the row's expanded state, so the
10763
10781
  * consumer writes it once — here, where it also drives the children group. */
10764
10782
  _relayExpanded() {
@@ -11057,7 +11075,7 @@ var NLDDListItem = (_NLDDListItem2 = class NLDDListItem extends withTranslations
11057
11075
  render() {
11058
11076
  const opensInNewTabLabel = this.href && this.target === "_blank" ? this._t("components.list-item.opens-in-new-tab-label") : void 0;
11059
11077
  const actionTabindex = this._isListboxOption ? "-1" : this._arrowNavigation ? this._rovingActive ? "0" : "-1" : void 0;
11060
- return template$13(this.button, this.href, this.target, this.rel, opensInNewTabLabel, actionTabindex, this._highlighted, this.checkbox, this.radio, this.checked, this._resolvedExpanded, this._showChildren, this._hasCheckedSegment, this.disabled);
11078
+ return template$13(this.button, this.href, this.target, this.rel, opensInNewTabLabel, actionTabindex, this._highlighted, this.checkbox, this.radio, this.checked, this._resolvedExpanded, this._showChildren, this._hasCheckedSegment, this.disabled, this._parentType === "navigation" ? "list" : "group", this._childrenOpen);
11061
11079
  }
11062
11080
  }, _NLDDListItem = _NLDDListItem2, _NLDDListItem2.styles = [listItemStyles], _NLDDListItem2.SIZED_CELLS = "nldd-text-cell, nldd-drag-handle-cell", _NLDDListItem2);
11063
11081
  __decorate([property({
@@ -11920,16 +11938,16 @@ var nlddCodeMirrorTheme = [baseTheme, syntaxHighlighting(highlightStyle)];
11920
11938
  //#endregion
11921
11939
  //#region src/utilities/codemirror/languages.ts
11922
11940
  var loaders = {
11923
- json: async () => (await import("./dist-CH9m014O.js")).json(),
11924
- yaml: async () => (await import("./dist-BWRYv3Mp.js")).yaml(),
11925
- javascript: async () => (await import("./dist-DMHTTJRJ.js").then((n) => n.t)).javascript(),
11926
- typescript: async () => (await import("./dist-DMHTTJRJ.js").then((n) => n.t)).javascript({ typescript: true }),
11927
- css: async () => (await import("./dist-PlhQXXtE.js").then((n) => n.r)).css(),
11928
- html: async () => (await import("./dist-DV6Mp5N1.js").then((n) => n.t)).html(),
11929
- xml: async () => (await import("./dist-BWEAw34D.js")).xml(),
11930
- python: async () => (await import("./dist-Bi4EHsFY.js")).python(),
11931
- rust: async () => (await import("./dist-C3uWRipu.js")).rust(),
11932
- sql: async () => (await import("./dist-CvL6_ezZ.js")).sql(),
11941
+ json: async () => (await import("./dist-B2QcygzG.js")).json(),
11942
+ yaml: async () => (await import("./dist-Ch3gNAuT.js")).yaml(),
11943
+ javascript: async () => (await import("./dist-BB5mlo7D.js").then((n) => n.t)).javascript(),
11944
+ typescript: async () => (await import("./dist-BB5mlo7D.js").then((n) => n.t)).javascript({ typescript: true }),
11945
+ css: async () => (await import("./dist-DbNhCpS5.js").then((n) => n.r)).css(),
11946
+ html: async () => (await import("./dist-CaxHkqR2.js").then((n) => n.t)).html(),
11947
+ xml: async () => (await import("./dist-DnZmcpbQ.js")).xml(),
11948
+ python: async () => (await import("./dist-iC2RTM0V.js")).python(),
11949
+ rust: async () => (await import("./dist-Bo5Jeyfn.js")).rust(),
11950
+ sql: async () => (await import("./dist-CA0yDFIt.js")).sql(),
11933
11951
  markdown: async () => (await Promise.resolve().then(() => dist_exports)).markdown(),
11934
11952
  bash: async () => new LanguageSupport(StreamLanguage.define((await import("./shell-C61GCsJA.js")).shell)),
11935
11953
  toml: async () => new LanguageSupport(StreamLanguage.define((await import("./toml-C2HBbPgG.js")).toml)),
@@ -11972,6 +11990,7 @@ var codeViewerStyles = css`
11972
11990
  --_code-viewer-actions-area-padding: var(--primitives-space-8);
11973
11991
  --_code-viewer-actions-area-size: calc(var(--semantics-controls-md-min-size) + var(--_code-viewer-actions-area-padding) * 2);
11974
11992
  --_code-viewer-actions-z-index: 1;
11993
+ --_code-viewer-max-height: none;
11975
11994
 
11976
11995
  ${inheritedTextReset}
11977
11996
  display: flex;
@@ -12052,6 +12071,16 @@ var codeViewerStyles = css`
12052
12071
  box-shadow: var(--semantics-focus-ring-box-shadow), var(--_code-viewer-border-shadow);
12053
12072
  }
12054
12073
 
12074
+ :host([max-height]) .code-viewer {
12075
+ display: flex;
12076
+ max-height: var(--_code-viewer-max-height);
12077
+ flex-direction: column;
12078
+ }
12079
+
12080
+ :host([max-height]) .cm-editor {
12081
+ min-height: 0;
12082
+ }
12083
+
12055
12084
  .cm-content {
12056
12085
  tab-size: 2;
12057
12086
  }
@@ -12119,6 +12148,7 @@ function codeViewerTemplate(component) {
12119
12148
  tooltip-timing="never"
12120
12149
  size="md"
12121
12150
  @click=${component._onCopyClick}
12151
+ @focusout=${component._onCopyBlur}
12122
12152
  ></nldd-icon-button>
12123
12153
  </nldd-tooltip>
12124
12154
  </div>
@@ -12209,6 +12239,11 @@ function forceScrollLayerRepaint(el) {
12209
12239
  * Whitespace is preserved; long lines scroll horizontally by default. Set
12210
12240
  * `wrap` to break long lines onto the next visual line.
12211
12241
  *
12242
+ * The viewer grows with its content. Set `max-height` to show a long file in
12243
+ * a frame of its own: the block grows up to that height and scrolls beyond it.
12244
+ * A scroller that overflows, in either direction, is a tab stop with a role
12245
+ * and a name, so the keyboard reaches what a pointer can scroll to.
12246
+ *
12212
12247
  * ## Syntax highlighting
12213
12248
  * Set `language` to one of the supported grammars (yaml, json, javascript,
12214
12249
  * typescript, css, html, xml, bash, markdown, rust, gherkin, toml, sql,
@@ -12227,6 +12262,7 @@ function forceScrollLayerRepaint(el) {
12227
12262
  * @attr {string} language - Grammar to highlight with. Empty disables highlighting.
12228
12263
  * @attr {boolean} no-copy - Hide the copy-to-clipboard button (shown by default).
12229
12264
  * @attr {boolean} wrap - Wrap long lines instead of horizontal scroll
12265
+ * @attr {string} max-height - Tallest the block may get, as a CSS length (e.g. '400px', '50vh'). Beyond it the content scrolls vertically. Unset means no cap.
12230
12266
  * @attr {object} translations - Override translation keys (e.g. the copy button
12231
12267
  * labels and the scroll-region label); unset keys fall back to Dutch.
12232
12268
  *
@@ -12244,6 +12280,7 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12244
12280
  this.language = "";
12245
12281
  this.noCopy = false;
12246
12282
  this.wrap = false;
12283
+ this.maxHeight = "";
12247
12284
  this._copyUnavailable = false;
12248
12285
  this.translations = {};
12249
12286
  this._isScrollable = false;
@@ -12331,6 +12368,10 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12331
12368
  }
12332
12369
  updated(changed) {
12333
12370
  if (changed.has("noCopy")) this._copyUnavailable = !this.noCopy && !isClipboardAvailable();
12371
+ if (changed.has("maxHeight")) {
12372
+ if (this.maxHeight && CSS.supports("max-height", this.maxHeight)) this.style.setProperty("--_code-viewer-max-height", this.maxHeight);
12373
+ else this.style.removeProperty("--_code-viewer-max-height");
12374
+ }
12334
12375
  if (!this.view) return;
12335
12376
  if (this._isScrollable) this.view.scrollDOM.setAttribute("aria-label", this._t("components.code-viewer.region-label"));
12336
12377
  if (changed.has("language")) this._applyLanguage();
@@ -12338,7 +12379,7 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12338
12379
  this.reconfigure(this._wrapCompartment, this.wrap ? EditorView.lineWrapping : []);
12339
12380
  this._updateScrollable();
12340
12381
  }
12341
- if (changed.has("appearance") || changed.has("noCopy") || changed.has("_copyUnavailable")) this._updateScrollable();
12382
+ if (changed.has("appearance") || changed.has("maxHeight") || changed.has("noCopy") || changed.has("_copyUnavailable")) this._updateScrollable();
12342
12383
  }
12343
12384
  _onSlotChange() {
12344
12385
  this.setDoc(this._getRawText());
@@ -12387,7 +12428,7 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12387
12428
  const scroller = this.view?.scrollDOM;
12388
12429
  if (!scroller) return;
12389
12430
  if (scroller.clientWidth === 0) return;
12390
- const scrollable = !this.wrap && scroller.scrollWidth > scroller.clientWidth;
12431
+ const scrollable = scroller.scrollHeight > scroller.clientHeight || !this.wrap && scroller.scrollWidth > scroller.clientWidth;
12391
12432
  this._isScrollable = scrollable;
12392
12433
  if (scrollable) {
12393
12434
  scroller.setAttribute("tabindex", "0");
@@ -12404,7 +12445,8 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12404
12445
  if (!slot) return "";
12405
12446
  return slot.assignedNodes({ flatten: true }).map((n) => n.textContent ?? "").join("");
12406
12447
  }
12407
- async _onCopyClick() {
12448
+ async _onCopyClick(event) {
12449
+ (event?.currentTarget)?.focus?.();
12408
12450
  try {
12409
12451
  if (!isClipboardAvailable()) throw new Error("Clipboard API unavailable");
12410
12452
  await navigator.clipboard.writeText(this._getRawText());
@@ -12413,10 +12455,15 @@ var NLDDCodeViewer = (_NLDDCodeViewer = class NLDDCodeViewer extends NLDDCodeMir
12413
12455
  this._copyState = "failure";
12414
12456
  }
12415
12457
  clearTimeout(this._copyResetTimer);
12458
+ if (this._copyState === "failure") return;
12416
12459
  this._copyResetTimer = setTimeout(() => {
12417
12460
  this._copyState = "idle";
12418
12461
  }, COPY_FEEDBACK_DURATION_MS);
12419
12462
  }
12463
+ /** Leaving the button clears a failure, which no timer does. */
12464
+ _onCopyBlur() {
12465
+ if (this._copyState === "failure") this._copyState = "idle";
12466
+ }
12420
12467
  /** Escape on the open feedback tooltip dismisses it early (WCAG 1.4.13). */
12421
12468
  _onCopyDismiss() {
12422
12469
  clearTimeout(this._copyResetTimer);
@@ -12444,6 +12491,11 @@ __decorate([property({
12444
12491
  type: Boolean,
12445
12492
  reflect: true
12446
12493
  })], NLDDCodeViewer.prototype, "wrap", void 0);
12494
+ __decorate([property({
12495
+ reflect: true,
12496
+ attribute: "max-height",
12497
+ converter: reflectNonDefault("")
12498
+ })], NLDDCodeViewer.prototype, "maxHeight", void 0);
12447
12499
  __decorate([property({
12448
12500
  type: Boolean,
12449
12501
  reflect: true,
@@ -15766,10 +15818,10 @@ function validationItemTemplate(_component) {
15766
15818
  * the command ("Gebruik minimaal 8 tekens"): before a verdict it stands there as
15767
15819
  * what the field wants, after one as what the value does not meet.
15768
15820
  *
15769
- * @attr {string} match - Regular expression the value has to contain. Not anchored, unlike the native `pattern`: `[A-Z]` means "has a capital in it".
15770
- * @attr {number} minlength - Fewest characters the value may have.
15821
+ * @attr {string} match - Regular expression the value has to contain. Not anchored, unlike the native `pattern`: `[A-Z]` means "has a capital in it". Not held against an empty value unless the field is required.
15822
+ * @attr {number} minlength - Fewest characters the value may have. Not held against an empty value unless the field is required.
15771
15823
  * @attr {number} maxlength - Most characters the value may have.
15772
- * @attr {boolean} required - The value may not be empty. Use it on a field whose other rules would pass an empty value.
15824
+ * @attr {boolean} required - The value may not be empty. Without it, and without `required` on the control, an empty value passes every rule in the list, as it does for the native `pattern` and `minlength`. The control is read by its `required` property or attribute; one that only says `aria-required` needs this item.
15773
15825
  * @attr {boolean} hint - Show this item before there is a verdict, whatever the list says.
15774
15826
  * @attr {boolean} unmet - Whether the value fails this item. Managed by the list; do not set it yourself.
15775
15827
  * @attr {boolean} visible - Whether the item is on screen. Managed by the list.
@@ -15805,11 +15857,9 @@ var _NLDDValidationItem = class NLDDValidationItem extends LitElement {
15805
15857
  * Whether `value` satisfies this item, or null when there is nothing to
15806
15858
  * satisfy because the item carries no rule.
15807
15859
  *
15808
- * An empty value is held against the rules like any other, so "minimaal 8
15809
- * tekens" fails on it, because it does. What keeps a fresh field from
15810
- * lighting up all of its requirements is not this method but the verdict: an
15811
- * item only turns critical once the control says `invalid`, and an untouched
15812
- * field has not been judged yet.
15860
+ * An empty value is held against the rules like any other here, so "minimaal
15861
+ * 8 tekens" fails on it. Whether an empty value is judged at all is not this
15862
+ * item's call but the list's, which knows if the field needs a value.
15813
15863
  */
15814
15864
  test(value) {
15815
15865
  if (!this.hasRule) return null;
@@ -15823,6 +15873,21 @@ var _NLDDValidationItem = class NLDDValidationItem extends LitElement {
15823
15873
  super.connectedCallback();
15824
15874
  this.setAttribute("role", "listitem");
15825
15875
  }
15876
+ /**
15877
+ * A rule that changes after the fact changes the verdict, and `required`
15878
+ * changes it for every item in the list. The list only re-checks on input
15879
+ * and on its control's attributes, so the item tells it.
15880
+ */
15881
+ updated(changed) {
15882
+ if (![
15883
+ "match",
15884
+ "minlength",
15885
+ "maxlength",
15886
+ "required"
15887
+ ].some((key) => changed.has(key))) return;
15888
+ const list = this.parentElement;
15889
+ if (list instanceof NLDDValidationList) list.requestUpdate();
15890
+ }
15826
15891
  render() {
15827
15892
  return validationItemTemplate(this);
15828
15893
  }
@@ -15919,7 +15984,11 @@ var NLDDValidationList = (_NLDDValidationList = class NLDDValidationList extends
15919
15984
  });
15920
15985
  this._observer.observe(next, {
15921
15986
  attributes: true,
15922
- attributeFilter: ["invalid", "unmet"]
15987
+ attributeFilter: [
15988
+ "invalid",
15989
+ "unmet",
15990
+ "required"
15991
+ ]
15923
15992
  });
15924
15993
  }
15925
15994
  _detach() {
@@ -15939,17 +16008,27 @@ var NLDDValidationList = (_NLDDValidationList = class NLDDValidationList extends
15939
16008
  * `unmet` on the control. Never both: a rule is held against the value as it
15940
16009
  * is now, while `unmet` is a snapshot of the last check and therefore older,
15941
16010
  * so letting the snapshot win would show a mistake that has been fixed.
16011
+ *
16012
+ * An empty value in a field that does not need one passes every rule, the
16013
+ * way the native `pattern` and `minlength` leave an empty input alone. A
16014
+ * field needs a value when an item says `required` or the control does.
16015
+ * Without this a `match` under an optional field blocked every submit that
16016
+ * left it empty, and nothing on screen said why.
15942
16017
  */
15943
16018
  _evaluate() {
15944
16019
  const control = this._resolved;
15945
16020
  const invalid = control?.hasAttribute("invalid") ?? false;
15946
16021
  const named = (control?.getAttribute("unmet") ?? "").split(" ").filter(Boolean);
15947
16022
  const value = this._currentValue();
16023
+ const items = this._items;
16024
+ const needsValue = items.some((item) => item.required) || Boolean(control?.required) || (control?.hasAttribute("required") ?? false);
16025
+ const skipRules = value === "" && !needsValue;
15948
16026
  let anyVisible = false;
15949
16027
  let anyRuleFails = false;
15950
16028
  const messages = [];
15951
- for (const item of this._items) {
15952
- const rule = item.test(value);
16029
+ for (const item of items) {
16030
+ const tested = item.test(value);
16031
+ const rule = tested !== null && skipRules ? true : tested;
15953
16032
  const failing = rule === null ? named.includes(item.id) : !rule;
15954
16033
  item.unmet = invalid && failing;
15955
16034
  item.visible = item.unmet || !this.judging && (item.hint || this.hint);
@@ -20397,9 +20476,16 @@ function topTitleBarTemplate(component) {
20397
20476
  * everyone. Anchor at the heading, then, and not at some other element that
20398
20477
  * happens to sit at the right height: the bar hands its title over to it.
20399
20478
  *
20479
+ * The title stays on one line and is cut off with an ellipsis when it does not
20480
+ * fit, which on a narrow screen or at 400% zoom is soon. The bar is therefore
20481
+ * not the place for the full title: put that in an `nldd-title` at the top of
20482
+ * the content, which wraps and always fits, and point `collapse-anchor` at it.
20483
+ * A bar without an anchor holds the only copy of its title, so keep that one to
20484
+ * a word or two.
20485
+ *
20400
20486
  * @element nldd-top-title-bar
20401
20487
  *
20402
- * @attr {string} text - Title of the bar, rendered as the heading in the title group.
20488
+ * @attr {string} text - Title of the bar, rendered as the heading in the title group. One line, cut off with an ellipsis when it does not fit; see above for a title that can run long.
20403
20489
  * @attr {string} supporting-text - Text under the title.
20404
20490
  * @attr {1|2|3|4|5|6} heading-level - Heading level of the title: 1–6 (default: 1). Lower it where the bar is not the top of the page, such as a pane beside content that already has its h1.
20405
20491
  * @attr {string} collapse-anchor - Id of the element whose top edge triggers the compact state on scroll. Without it the state is static (see above).
@@ -26396,7 +26482,6 @@ var NLDDSegmentedControlItem = (_NLDDSegmentedControlItem = class NLDDSegmentedC
26396
26482
  this._select();
26397
26483
  return;
26398
26484
  }
26399
- if (e.key === "Escape") this._tooltip?._handleTriggerLeave();
26400
26485
  };
26401
26486
  }
26402
26487
  connectedCallback() {
@@ -26416,7 +26501,7 @@ var NLDDSegmentedControlItem = (_NLDDSegmentedControlItem = class NLDDSegmentedC
26416
26501
  /**
26417
26502
  * The tooltip of the icon variant, which shows itself when focus moves into
26418
26503
  * it. In radio mode the focus is on this element, outside it, so it hears
26419
- * about focus and Escape from here.
26504
+ * about focus from here. Escape it hears by itself, from the document.
26420
26505
  */
26421
26506
  get _tooltip() {
26422
26507
  return this.inputType === "radio" ? this.shadowRoot?.querySelector("nldd-tooltip") ?? null : null;
@@ -36704,7 +36789,6 @@ var _NLDDToggleButton = class NLDDToggleButton extends DescribedBy(FormAssociate
36704
36789
  submitOnEnter(this, e);
36705
36790
  return;
36706
36791
  }
36707
- if (e.key === "Escape") this._tooltip?._handleTriggerLeave();
36708
36792
  };
36709
36793
  this._onRadioFocus = () => {
36710
36794
  this._tooltip?._handleFocusIn();
@@ -36792,7 +36876,7 @@ var _NLDDToggleButton = class NLDDToggleButton extends DescribedBy(FormAssociate
36792
36876
  /**
36793
36877
  * The tooltip of an icon-only button, which shows itself when focus moves
36794
36878
  * into it. In radio mode the focus is on this element, outside it, so it
36795
- * hears about focus and Escape from here.
36879
+ * hears about focus from here. Escape it hears by itself, from the document.
36796
36880
  */
36797
36881
  get _tooltip() {
36798
36882
  return this.type === "radio" ? this.shadowRoot?.querySelector("nldd-tooltip") ?? null : null;
@@ -43222,9 +43306,11 @@ var sidebarSectionStyles = css`
43222
43306
  /* # Box — the surface around it, edged by a divider. Sticky + scrollable only
43223
43307
  beside the main (wide); when stacked it's a plain full-width box above the
43224
43308
  main, so no sticky (which would scroll over the main) and no viewport
43225
- height cap. */
43309
+ height cap. The box is the aside itself: Firefox puts a tab stop on
43310
+ whatever scrolls, and that stop needs the landmark's role and name. */
43226
43311
 
43227
43312
  .sidebar-section__sidebar-box {
43313
+ display: block;
43228
43314
  box-sizing: border-box;
43229
43315
  border-radius: var(--semantics-surfaces-corner-radius);
43230
43316
  background-color: var(--_sidebar-section-sidebar-box-background-color);
@@ -43259,13 +43345,13 @@ function sidebarSectionTemplate(component) {
43259
43345
  </header>
43260
43346
  <div class="sidebar-section__columns">
43261
43347
  ${!collapsed ? html`
43262
- <aside class="sidebar-section__sidebar"
43263
- aria-label=${sidebarLabel}
43264
- >
43265
- <div class="sidebar-section__sidebar-box">
43348
+ <div class="sidebar-section__sidebar">
43349
+ <aside class="sidebar-section__sidebar-box"
43350
+ aria-label=${sidebarLabel}
43351
+ >
43266
43352
  <slot name="sidebar"></slot>
43267
- </div>
43268
- </aside>
43353
+ </aside>
43354
+ </div>
43269
43355
  ` : nothing}
43270
43356
  <div class="sidebar-section__main">
43271
43357
  <slot></slot>
@@ -48261,8 +48347,10 @@ var menuBarItemStyles = css`
48261
48347
  function template$4(component) {
48262
48348
  const safeHref = sanitizeUrl(component.href);
48263
48349
  const isLink = Boolean(safeHref);
48264
- const isIconOnly = Boolean((component.iconOnly || component.contentPriority === "icon" && component.compact) && component.text);
48265
- const ariaLabel = component.accessibleLabel || (isIconOnly ? component.text : nothing);
48350
+ const hasIcon = Boolean(component.icon) || component._hasSlottedIcon;
48351
+ const showsIconOnly = Boolean(component.text) && (component.iconOnly || component.contentPriority === "icon" && component.compact && hasIcon);
48352
+ const ariaLabel = component.accessibleLabel || (showsIconOnly ? component.text : nothing);
48353
+ const tooltipText = showsIconOnly ? component.accessibleLabel || component.text : "";
48266
48354
  const ariaCurrent = component.current ? component.currentType : nothing;
48267
48355
  const ariaHaspopup = component.expandable ? "menu" : component.haspopup || nothing;
48268
48356
  const ariaExpanded = component.expandable || component.haspopup ? String(component.expanded) : nothing;
@@ -48274,14 +48362,40 @@ function template$4(component) {
48274
48362
  </span>
48275
48363
  `;
48276
48364
  if (isLink) return html`
48277
- <a class="menu-bar-item"
48278
- href=${safeHref}
48279
- aria-disabled=${component.disabled || nothing}
48280
- tabindex=${component.disabled ? "-1" : nothing}
48365
+ <nldd-tooltip text=${tooltipText}>
48366
+ <a class="menu-bar-item"
48367
+ href=${safeHref}
48368
+ aria-disabled=${component.disabled || nothing}
48369
+ tabindex=${component.disabled ? "-1" : nothing}
48370
+ aria-current=${ariaCurrent}
48371
+ aria-label=${ariaLabel}
48372
+ aria-haspopup=${ariaHaspopup}
48373
+ aria-expanded=${ariaExpanded}
48374
+ >
48375
+ ${icon}
48376
+ <span class="menu-bar-item__text">
48377
+ ${component.text}
48378
+ </span>
48379
+ ${component.expandable ? html`
48380
+ <span class="menu-bar-item__disclosure-icon">
48381
+ <nldd-icon icon="chevron-down-small"></nldd-icon>
48382
+ </span>
48383
+ ` : nothing}
48384
+ </a>
48385
+ </nldd-tooltip>
48386
+ <slot @slotchange=${component._onSlotChange}></slot>
48387
+ `;
48388
+ return html`
48389
+ <nldd-tooltip text=${tooltipText}>
48390
+ <button class="menu-bar-item"
48391
+ type="button"
48392
+ ?disabled=${component.disabled}
48281
48393
  aria-current=${ariaCurrent}
48282
48394
  aria-label=${ariaLabel}
48283
48395
  aria-haspopup=${ariaHaspopup}
48284
48396
  aria-expanded=${ariaExpanded}
48397
+ .popoverTargetElement=${component.popoverTargetElement}
48398
+ .popoverTargetAction=${component.popoverTargetAction}
48285
48399
  >
48286
48400
  ${icon}
48287
48401
  <span class="menu-bar-item__text">
@@ -48292,30 +48406,8 @@ function template$4(component) {
48292
48406
  <nldd-icon icon="chevron-down-small"></nldd-icon>
48293
48407
  </span>
48294
48408
  ` : nothing}
48295
- </a>
48296
- <slot @slotchange=${component._onSlotChange}></slot>
48297
- `;
48298
- return html`
48299
- <button class="menu-bar-item"
48300
- type="button"
48301
- ?disabled=${component.disabled}
48302
- aria-current=${ariaCurrent}
48303
- aria-label=${ariaLabel}
48304
- aria-haspopup=${ariaHaspopup}
48305
- aria-expanded=${ariaExpanded}
48306
- .popoverTargetElement=${component.popoverTargetElement}
48307
- .popoverTargetAction=${component.popoverTargetAction}
48308
- >
48309
- ${icon}
48310
- <span class="menu-bar-item__text">
48311
- ${component.text}
48312
- </span>
48313
- ${component.expandable ? html`
48314
- <span class="menu-bar-item__disclosure-icon">
48315
- <nldd-icon icon="chevron-down-small"></nldd-icon>
48316
- </span>
48317
- ` : nothing}
48318
- </button>
48409
+ </button>
48410
+ </nldd-tooltip>
48319
48411
  <slot @slotchange=${component._onSlotChange}></slot>
48320
48412
  `;
48321
48413
  }
@@ -48336,8 +48428,8 @@ function template$4(component) {
48336
48428
  * @attr {string} href - Optional link URL. Without href it renders as a button.
48337
48429
  * @attr {string} icon - Optional icon name (nldd-icon)
48338
48430
  * @attr {boolean} expandable - Show the disclosure icon and open the slotted `<nldd-menu>` on click
48339
- * @attr {boolean} icon-only - Hide the text visually (always)
48340
- * @attr {'icon'|'text'} content-priority - Decides what stays visible in compact mode: 'icon' hides the text, 'text' hides the icon
48431
+ * @attr {boolean} icon-only - Hide the text visually (always). The text then shows as a tooltip on hover and focus.
48432
+ * @attr {'icon'|'text'} content-priority - Decides what stays visible in compact mode: 'icon' hides the text, 'text' hides the icon. A bar is compact on a narrow screen and also at 200% zoom on a desktop, so with 'icon' the text is gone there too and shows as a tooltip instead.
48341
48433
  * @attr {boolean} compact - Activates content-priority behavior (set by the parent nldd-menu-bar)
48342
48434
  * @attr {boolean} disabled - Turn interaction off
48343
48435
  * @attr {string} accessible-label - Override aria-label
@@ -48708,6 +48800,7 @@ var _NLDDMenuBar = class NLDDMenuBar extends withTranslations(LitElement, nlddMe
48708
48800
  const menuItem = document.createElement("nldd-menu-item");
48709
48801
  menuItem.setAttribute("text", item.text);
48710
48802
  if (item.icon) menuItem.setAttribute("icon", item.icon);
48803
+ if (item.href) menuItem.setAttribute("href", item.href);
48711
48804
  if (item.current) menuItem.setAttribute("selected", "");
48712
48805
  if (item.disabled) menuItem.setAttribute("disabled", "");
48713
48806
  if (item.expandable) {
@@ -48725,8 +48818,24 @@ var _NLDDMenuBar = class NLDDMenuBar extends withTranslations(LitElement, nlddMe
48725
48818
  continue;
48726
48819
  }
48727
48820
  }
48728
- menuItem.addEventListener("click", () => {
48729
- item.click();
48821
+ menuItem.addEventListener("click", (event) => {
48822
+ if (!item.href) {
48823
+ item.click();
48824
+ return;
48825
+ }
48826
+ const { button, ctrlKey, metaKey, shiftKey, altKey } = event;
48827
+ const forwarded = new MouseEvent("click", {
48828
+ bubbles: true,
48829
+ cancelable: true,
48830
+ composed: true,
48831
+ button,
48832
+ ctrlKey,
48833
+ metaKey,
48834
+ shiftKey,
48835
+ altKey
48836
+ });
48837
+ item.dispatchEvent(forwarded);
48838
+ if (forwarded.defaultPrevented) event.preventDefault();
48730
48839
  });
48731
48840
  this._overflowMenu.appendChild(menuItem);
48732
48841
  }
@@ -49130,6 +49239,7 @@ function template$2(component) {
49130
49239
  ${safeHref ? html`
49131
49240
  <a class="skip-link__control"
49132
49241
  href=${safeHref}
49242
+ @click=${component._handleLinkClick}
49133
49243
  >
49134
49244
  ${component._text}
49135
49245
  </a>
@@ -49154,13 +49264,22 @@ var nlddSkipLinkTranslations = { "components.skip-link.action": "Sla over" };
49154
49264
  * Nederlandse Digitale Dienst Skip Link Component (Lit + TypeScript)
49155
49265
  *
49156
49266
  * Accessibility pattern that lets keyboard users skip past content. Wraps
49157
- * content in a default slot. Without href it focuses the first element after
49158
- * the skip link in the DOM (nextElementSibling). Make sure a focusable element
49267
+ * content in a default slot. Without href it moves focus to the first rendered
49268
+ * element after the skip link, so the next Tab lands on the first link or
49269
+ * button in it. An element that is not rendered, such as a `<noscript>`, a
49270
+ * `<script>` or anything hidden, is passed over. Make sure a rendered element
49159
49271
  * follows the component, otherwise the skip link has no effect.
49160
49272
  *
49273
+ * With an `href` that points at an id on the same page, the link scrolls to
49274
+ * that element and moves focus to it too. The target needs no `tabindex` of
49275
+ * its own. An href to another page is left to the browser.
49276
+ *
49277
+ * The component cannot know what it skips, so its default text only says
49278
+ * "Sla over". Name it with `text`: "Sla navigatie over", "Sla filters over".
49279
+ *
49161
49280
  * @element nldd-skip-link
49162
- * @attr {string} text - Text of the skip link. Falls back to the i18n default.
49163
- * @attr {string} href - Optional external target id. Without href it jumps to the end of its own content.
49281
+ * @attr {string} text - Text of the skip link. Name what is skipped. Falls back to the i18n default.
49282
+ * @attr {string} href - Optional external target id. Without href it jumps to the first rendered element after the skip link.
49164
49283
  *
49165
49284
  * @slot - Content that can be skipped
49166
49285
  */
@@ -49170,21 +49289,97 @@ var _NLDDSkipLink = class NLDDSkipLink extends withTranslations(LitElement, nldd
49170
49289
  this.text = "";
49171
49290
  this.href = "";
49172
49291
  this._handleClick = () => {
49173
- const next = this.nextElementSibling;
49174
- if (next) {
49175
- if (!next.hasAttribute("tabindex")) {
49176
- next.setAttribute("tabindex", "-1");
49177
- next.addEventListener("blur", () => {
49178
- next.removeAttribute("tabindex");
49179
- }, { once: true });
49180
- }
49181
- next.focus();
49182
- }
49292
+ const next = this._target();
49293
+ if (!next) return;
49294
+ this._focus(next);
49295
+ };
49296
+ this._handleLinkClick = (event) => {
49297
+ const hash = this._samePageHash();
49298
+ if (!hash) return;
49299
+ if (event && (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) return;
49300
+ let id = hash.slice(1);
49301
+ try {
49302
+ id = decodeURIComponent(id);
49303
+ } catch {}
49304
+ const target = this.getRootNode().getElementById?.(id) ?? document.getElementById(id);
49305
+ if (!target) return;
49306
+ clearTimeout(this._focusTimer);
49307
+ this._focusTimer = setTimeout(() => this._focus(target));
49183
49308
  };
49184
49309
  }
49185
49310
  get _text() {
49186
49311
  return this.text || this._t("components.skip-link.action");
49187
49312
  }
49313
+ /**
49314
+ * The fragment of an href that stays on this page, or an empty string. An
49315
+ * absolute URL to the page you are on counts too: a router or a CMS writes
49316
+ * `/pagina#inhoud` as readily as `#inhoud`.
49317
+ */
49318
+ _samePageHash() {
49319
+ try {
49320
+ const url = new URL(this.href, location.href);
49321
+ return url.origin === location.origin && url.pathname === location.pathname && url.search === location.search ? url.hash : "";
49322
+ } catch {
49323
+ return "";
49324
+ }
49325
+ }
49326
+ disconnectedCallback() {
49327
+ super.disconnectedCallback();
49328
+ clearTimeout(this._focusTimer);
49329
+ }
49330
+ /**
49331
+ * Focuses the target and leaves it as it was once focus moves on.
49332
+ *
49333
+ * The tabindex is 0 and not -1, also when the target came with a -1 of its
49334
+ * own. WebKit skips everything inside a shadow host that has a negative
49335
+ * tabindex, slotted content included, so with -1 on an nldd-* section the
49336
+ * next Tab left the page instead of reaching the first link in it.
49337
+ */
49338
+ _focus(target) {
49339
+ this._restoreTarget?.();
49340
+ const previous = target.getAttribute("tabindex");
49341
+ const restore = () => {
49342
+ target.removeEventListener("blur", restore);
49343
+ if (this._restoreTarget === restore) this._restoreTarget = void 0;
49344
+ if (previous === null) target.removeAttribute("tabindex");
49345
+ else target.setAttribute("tabindex", previous);
49346
+ };
49347
+ this._restoreTarget = restore;
49348
+ target.setAttribute("tabindex", "0");
49349
+ target.addEventListener("blur", restore);
49350
+ target.focus();
49351
+ if (target.getRootNode().activeElement !== target) restore();
49352
+ }
49353
+ /**
49354
+ * The first following sibling that is rendered. `focus()` does nothing on
49355
+ * an element without a box, and a `<noscript>` or a hidden element sitting
49356
+ * between the skip link and the content left the button dead.
49357
+ */
49358
+ _target() {
49359
+ let next = this.nextElementSibling;
49360
+ while (next) {
49361
+ const rendered = this._rendered(next);
49362
+ if (rendered) return rendered;
49363
+ next = next.nextElementSibling;
49364
+ }
49365
+ return null;
49366
+ }
49367
+ /**
49368
+ * The element itself when it has a box and can take focus. A `display:
49369
+ * contents` wrapper has no box, yet its children are on screen, so the
49370
+ * first rendered one of those stands in for it. An element that is
49371
+ * `visibility: hidden` or inert does have a box and still refuses focus.
49372
+ */
49373
+ _rendered(el) {
49374
+ if (!(el instanceof HTMLElement)) return null;
49375
+ if (el.getClientRects().length > 0) return getComputedStyle(el).visibility !== "hidden" && !el.closest("[inert]") ? el : null;
49376
+ if (getComputedStyle(el).display !== "contents") return null;
49377
+ for (const child of el.children) {
49378
+ const rendered = this._rendered(child);
49379
+ if (rendered) return rendered;
49380
+ }
49381
+ return null;
49382
+ }
49188
49383
  render() {
49189
49384
  return template$2(this);
49190
49385
  }